Folks,
I noticed that the following simple *SqlQuery* doesn't not work: SELECT * FROM Employee e The reason is that it is incorrectly expanded to SELECT *Employee*._KEY, *Employee*._VAL FROM Employee *e* ... while correct form should be: SELECT *e*._KEY, *e*._VAL FROM Employee *e* I understand that this is not very easy to fix because excessive query parsing will be required to find our whether table has alias or not. Then I tried another approach, which doesn't work either: SELECT e.* FROM Employee e And here the failure is forced by our code intentionally: only "SELECT *" is allowed. This looks very trivial to fix for me: just allow "SELECT [table/alias].*" as well. Does anyone see any other problems here? I created the ticket: https://issues.apache.org/jira/browse/IGNITE-2641 Vladimir. |
Use SqlFieldsQuery, Luke! I tried, it works! :)
I was always against SELECT in SqlQuery, it was terrible design decision, but for "historical reasons" it is supported in SqlQuery. As for adding new parsing, the more fancier parsing we will introduce, the worse performance we will have. Sergi 2016-02-12 15:11 GMT+03:00 Vladimir Ozerov <[hidden email]>: > Folks, > > I noticed that the following simple *SqlQuery* doesn't not work: > SELECT * FROM Employee e > > The reason is that it is incorrectly expanded to > SELECT *Employee*._KEY, *Employee*._VAL FROM Employee *e* > > ... while correct form should be: > SELECT *e*._KEY, *e*._VAL FROM Employee *e* > > I understand that this is not very easy to fix because excessive query > parsing will be required to find our whether table has alias or not. > > Then I tried another approach, which doesn't work either: > SELECT e.* FROM Employee e > > And here the failure is forced by our code intentionally: only "SELECT *" > is allowed. > > This looks very trivial to fix for me: just allow "SELECT [table/alias].*" > as well. Does anyone see any other problems here? > > I created the ticket: https://issues.apache.org/jira/browse/IGNITE-2641 > > Vladimir. > |
Sergi,
This problem is more about aliases, then about "SELECT *". The query FROM Employee e doesn't work either. And this is the problem, because as soon as JOINs appear, aliases greatly help to reduce SQL boilerplate. And as I understand it is hard to make this query work due to complex parsing. But we can make the query SELECT e.* FROM Employee e ... work with minimal efforts. On Fri, Feb 12, 2016 at 8:42 PM, Sergi Vladykin <[hidden email]> wrote: > Use SqlFieldsQuery, Luke! I tried, it works! :) > > I was always against SELECT in SqlQuery, it was terrible design decision, > but for "historical reasons" it is supported in SqlQuery. > > As for adding new parsing, the more fancier parsing we will introduce, the > worse performance we will have. > > Sergi > > 2016-02-12 15:11 GMT+03:00 Vladimir Ozerov <[hidden email]>: > > > Folks, > > > > I noticed that the following simple *SqlQuery* doesn't not work: > > SELECT * FROM Employee e > > > > The reason is that it is incorrectly expanded to > > SELECT *Employee*._KEY, *Employee*._VAL FROM Employee *e* > > > > ... while correct form should be: > > SELECT *e*._KEY, *e*._VAL FROM Employee *e* > > > > I understand that this is not very easy to fix because excessive query > > parsing will be required to find our whether table has alias or not. > > > > Then I tried another approach, which doesn't work either: > > SELECT e.* FROM Employee e > > > > And here the failure is forced by our code intentionally: only "SELECT *" > > is allowed. > > > > This looks very trivial to fix for me: just allow "SELECT > [table/alias].*" > > as well. Does anyone see any other problems here? > > > > I created the ticket: https://issues.apache.org/jira/browse/IGNITE-2641 > > > > Vladimir. > > > |
Free forum by Nabble | Edit this page |