|
From: Jose F. R. (JIRA) <nh...@gm...> - 2010-08-30 21:03:48
|
Select after Take does not work properly
----------------------------------------
Key: NH-2317
URL: http://216.121.112.228/browse/NH-2317
Project: NHibernate
Issue Type: Bug
Components: Linq Provider
Affects Versions: 3.0.0.Alpha2
Reporter: Jose F. Romaniello
Priority: Major
artists.Take(10).Select(a => a.Id) throws exception on
NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
artists.Select(a => a.Id).Take(10) works properly
These two queries work with the old provider.
--
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: Jose F. R. (JIRA) <nh...@gm...> - 2010-08-30 21:05:46
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jose F. Romaniello updated NH-2317:
-----------------------------------
Attachment: NH2317.7z
this is the test case
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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...> - 2010-09-22 22:28:54
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19868#action_19868 ]
Fabio Maulo commented on NH-2317:
---------------------------------
The matter here is that even in RAM the Take before the Select and the Take after the Select has two completely different meaning and overall behavior.
In a simple query, perhaps, there is no problem but in a complex query with paged subqueries...
we have to talk with re-linq guys.
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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: Stefan W. (JIRA) <nh...@gm...> - 2011-01-05 08:42:14
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20413#action_20413 ]
Stefan Wenig commented on NH-2317:
----------------------------------
re-linq guy thinks: Take().Select() and Select().Take() is sementically the same. In-memory execution would be different, but that's just imperative code. An optimizing query engine would be free to come up with the same query plan for both. So I think you're cool just mentally swapping those.
As Fabio said, for some other scenarios, with or without subqueries, a global SetMaxResults() won't do (same for Skip/SetFirstResult). If you want to make it work in every case, you'll have to get it into the HQL statement.
I'd consider adding that syntax to HQL, but there might be a trick to pack it into the query's where clause. I wouldn't know though.
Or you might go ahead and just implement what HQL can do. If there's been no request to add that feature to HQL, it might not be that important to have it in LINQ. But it's ugly to have valid LINQ code break at runtime.
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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 (JIRA) <nh...@gm...> - 2011-02-28 13:44:30
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=20603#action_20603 ]
Andrei commented on NH-2317:
----------------------------
Hello,
I wanted to add that this issue breaks the functionality of the Expand method in a WCF Data Service scenario where paging is enabled. The WCF Data Service call first the paging operators (OrderBy, Skip, Take) and then does the projection for the Expand method.
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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-23 14:03:56
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21153#action_21153 ]
Fabio Maulo commented on NH-2317:
---------------------------------
Test committed.
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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-23 15:10:57
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21156#action_21156 ]
Fabio Maulo commented on NH-2317:
---------------------------------
As said above:
"The matter here is that even in RAM the Take before the Select and the Take after the Select has two completely different meaning and overall behavior."
The HQL equivalent of :
session.Query<Artist>().Take(3).Select(a => a.Id)
is:
select a.id from Artist a where a.id in (from Artist take 3)
and not
select a.id from Artist a take 3
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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: Jose F. R. (JIRA) <nh...@gm...> - 2011-05-23 15:16:51
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21157#action_21157 ]
Jose F. Romaniello commented on NH-2317:
----------------------------------------
I think it doesn't matter the underlaying sql/(hql?)
Thing is that:
var result = artists.Take(10).Select(a => a.Id).ToArray()
should have the same result than:
var result = artists.Select(a => a.Id).Take(10).ToArray()
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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: Stefan W. (JIRA) <nh...@gm...> - 2011-05-23 15:40:55
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21158#action_21158 ]
Stefan Wenig commented on NH-2317:
----------------------------------
I can't see a situation with a semantic difference between take + select and select + take. If the two queries that Fabio provided don't return the same results, I'd question the accuracy of at least one of them. So I'd say swithing consecutive Take and Select calls is OK.
But why would you want to do this? As soon as anything gets between Take and Select, you'll have to go the other path anyway. If you have a good way to specify it "right" in HQL, such as the sub query (from Artists take 3), I'd take it.
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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-23 18:45:53
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21160#action_21160 ]
Fabio Maulo commented on NH-2317:
---------------------------------
The matter is not when the last sentence is just a select...
in that case it can be reduced.
In practice this HQL
select a.id from Artist a where a in (from Artist take 3)
can be reduce to this other
select a.id from Artist a take 3
The matter is when the clause after a skip/take has a body (re-linq meaning of it) as
Query<A>().Take(10).Where(x=> x.Name.StartWith("P"))
In this last case we have to transform it with a subquery (... where possible in HQL)
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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-23 19:10:45
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fabio Maulo resolved NH-2317.
-----------------------------
Resolution: Fixed
Fix Version/s: 3.2.0CR1
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Fix For: 3.2.0CR1
>
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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-06-17 16:29:40
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21299#action_21299 ]
Kelly Stuard commented on NH-2317:
----------------------------------
I grabbed trunk and tried this out. This simple case has been fixed. However, further testing needs to be done to have it be a complete feature.
Sure this works:
artists.Take(10).Select(a => a.Id)
But these don't:
artists.OrderBy(a => a.Age).Take(10).Select(a => a.Id)
artists.Where(a => a.Age > 21).Take(10).Select(a => a.Id)
It fails with the original error. (PolymorphicQuerySourceDetector)
If this needs to have additional test cases or be another bug, please let me know; I'm still new around here. I'll be happy to do either/both.
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Fix For: 3.2.0Beta2
>
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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-06-19 14:25:26
|
[ http://216.121.112.228/browse/NH-2317?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21304#action_21304 ]
Fabio Maulo commented on NH-2317:
---------------------------------
Yes are different cases:
artists.OrderBy(a => a.Age).Take(10).Select(a => a.Id)
artists.Take(10).OrderBy(a => a.Age).Select(a => a.Id)
Are two completely different SQL with different results.
> Select after Take does not work properly
> ----------------------------------------
>
> Key: NH-2317
> URL: http://216.121.112.228/browse/NH-2317
> Project: NHibernate
> Issue Type: Bug
> Components: Linq Provider
> Affects Versions: 3.0.0.Alpha2
> Reporter: Jose F. Romaniello
> Priority: Major
> Fix For: 3.2.0Beta2
>
> Attachments: NH2317.7z
>
>
> artists.Take(10).Select(a => a.Id) throws exception on
> NHibernate.Hql.Ast.ANTLR.PolymorphicQuerySourceDetector.GetClassName(IASTNode querySource) en PolymorphicQuerySourceDetector.cs: line 62
> artists.Select(a => a.Id).Take(10) works properly
> These two queries work with the old provider.
--
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
|