-
Notifications
You must be signed in to change notification settings - Fork 605
Support "Select * from (a)" queries (when the table name is inside Parenthesis) #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! As I suspected, this is rather complex - I didn't manage to recall all the necessary details in 15 minutes I had for this.
In order for me to be happy with the merge, the comments should be updated and it should be clear which syntax we wanted the parser to accept and which to reject: we have already established that Snowflake doesn't reject FROM ( table_name )
, but FROM ( foo bar )
(which the patched version seems to accept) doesn't make sense to me. I'd also still like to hear from Nikhil and/or Andy.
Hi , I think added the bare table before the join - as I don't want the object to be "table with joins" but without join's - i think it's will be more correct that bare table will be just a table_factor (I also updated the comment's in that section) . |
I don't know how travis permissions work, but it allows me to restart the build once I log in with github. Judging from https://rust-lang-nursery.github.io/rust-toolstate/ the nightly rustfmt we use is currently unavailable, so restarting the build until that's fixed will not help. |
The joins in The code you have now strips the extraneous parens, while it would arguably be more correct to keep them in the AST via I believe this would be less code, less nesting, and less intrusive patch overall. |
But - if i understand right you suggestion : "From a" - will be parsed as :
while "From (a)" - will be parsed as :
even we don't have any nested join in the query... |
Right. You may argue that an object representing the extra parentheses does NOT belong to an abstract syntax tree, but in other cases we prefer preserving detail in the AST, and in this particular case IMO this should make the particularly complex piece of the parser easier to manage. |
Changed according to your suggestion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This does seem simpler.
Please see the comments about the modified tests.
Hi , |
Thanks, I opened #159 to fix that.
I think you should be able to expand that section and "Re-request review" to change its state. That's not the reason I didn't get to it, though, sorry! |
Following the discussion in issue #154 ,
I tried to add support to parenthesis around table name,
waiting for reviews :)