From: Kelly S. (JIRA) <nh...@gm...> - 2011-05-04 21:02:56
|
Linq LongCount() behavior different from Count() ------------------------------------------------ Key: NH-2691 URL: http://216.121.112.228/browse/NH-2691 Project: NHibernate Issue Type: Bug Components: Linq Provider Affects Versions: 3.1.0 Reporter: Kelly Stuard Priority: Minor It seems to me that Count() and LongCount() should behave the same, except for the max value they return. I am finding this not to be the case. Consider the following example: var query = from cat in session.Query<Cat>() orderby cat.Born select cat; var queryCount = query.Count(); // NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from Cat cat0_ var queryLongCount = query.LongCount(); // NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from Cat cat0_ order by cat0_.Born I am partial to the behavior of .Count() where it ignores the order. Also, it seems that LongCount() should probably cast as a long, instead of an int. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Kelly S. (JIRA) <nh...@gm...> - 2011-05-04 21:05:03
|
[ http://216.121.112.228/browse/NH-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20997#action_20997 ] Kelly Stuard commented on NH-2691: ---------------------------------- If anyone knows how to create tests that are specific to "long", I would love to have your input. Creating int.MaxValue+1 of Cats takes an extremely long time; even in SQLite. As such, I cannot make any failing tests of this issue and am requesting guidance. > Linq LongCount() behavior different from Count() > ------------------------------------------------ > > Key: NH-2691 > URL: http://216.121.112.228/browse/NH-2691 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Minor > > It seems to me that Count() and LongCount() should behave the same, except for the max value they return. I am finding this not to be the case. Consider the following example: > var query = > from cat in session.Query<Cat>() > orderby cat.Born > select cat; > var queryCount = query.Count(); > // NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from Cat cat0_ > var queryLongCount = query.LongCount(); > // NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from Cat cat0_ order by cat0_.Born > I am partial to the behavior of .Count() where it ignores the order. Also, it seems that LongCount() should probably cast as a long, instead of an int. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Andrei A. (JIRA) <nh...@gm...> - 2011-05-11 15:43:58
|
[ http://216.121.112.228/browse/NH-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21060#action_21060 ] Andrei Alecu commented on NH-2691: ---------------------------------- SQLite only has INTEGER, which can be up to 64 bits, so the cast is correct here for the SQLite dialect. What seems wrong is the order clause though. You might want to check if the cast is correct for some other dialect that treats has separate types for 64 bit integers. (maybe SQL Express) > Linq LongCount() behavior different from Count() > ------------------------------------------------ > > Key: NH-2691 > URL: http://216.121.112.228/browse/NH-2691 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Minor > > It seems to me that Count() and LongCount() should behave the same, except for the max value they return. I am finding this not to be the case. Consider the following example: > var query = > from cat in session.Query<Cat>() > orderby cat.Born > select cat; > var queryCount = query.Count(); > // NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from Cat cat0_ > var queryLongCount = query.LongCount(); > // NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from Cat cat0_ order by cat0_.Born > I am partial to the behavior of .Count() where it ignores the order. Also, it seems that LongCount() should probably cast as a long, instead of an int. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Fabio M. (JIRA) <nh...@gm...> - 2011-05-12 18:33:57
|
[ http://216.121.112.228/browse/NH-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo resolved NH-2691. ----------------------------- Resolution: Fixed Fix Version/s: 3.2.0Beta1 > Linq LongCount() behavior different from Count() > ------------------------------------------------ > > Key: NH-2691 > URL: http://216.121.112.228/browse/NH-2691 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Kelly Stuard > Priority: Minor > Fix For: 3.2.0Beta1 > > > It seems to me that Count() and LongCount() should behave the same, except for the max value they return. I am finding this not to be the case. Consider the following example: > var query = > from cat in session.Query<Cat>() > orderby cat.Born > select cat; > var queryCount = query.Count(); > // NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from Cat cat0_ > var queryLongCount = query.LongCount(); > // NHibernate: select cast(count(*) as INTEGER) as col_0_0_ from Cat cat0_ order by cat0_.Born > I am partial to the behavior of .Count() where it ignores the order. Also, it seems that LongCount() should probably cast as a long, instead of an int. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |