-
Notifications
You must be signed in to change notification settings - Fork 67
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
Fix parsing failure on WITH clauses #531
base: main
Are you sure you want to change the base?
Fix parsing failure on WITH clauses #531
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.
The changes look ok but overall I think we are doing the wrong thing here .. we really should not try to parse the query since we are missing the full context .. only the coordinator really has that. I think in the long run we have to go down the route of farming this work out to a coordinator .. otherwise we end up pulling everything in and duplicating it so we kinda end up with the whole parsing code again.
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.
Please add a test.
gateway-ha/src/main/java/io/trino/gateway/ha/router/TrinoQueryProperties.java
Outdated
Show resolved
Hide resolved
I agree, even if it is quite helpful information. We should talk more on this next time. |
3e1cbb3
to
05d0600
Compare
05d0600
to
cfca1ed
Compare
gateway-ha/src/test/java/io/trino/gateway/ha/router/TestRoutingGroupSelector.java
Outdated
Show resolved
Hide resolved
gateway-ha/src/test/java/io/trino/gateway/ha/router/TestRoutingGroupSelector.java
Outdated
Show resolved
Hide resolved
gateway-ha/src/test/java/io/trino/gateway/ha/router/TestRoutingGroupSelector.java
Outdated
Show resolved
Hide resolved
cfca1ed
to
f35c48c
Compare
gateway-ha/src/test/java/io/trino/gateway/ha/router/TestRoutingGroupSelector.java
Outdated
Show resolved
Hide resolved
gateway-ha/src/test/java/io/trino/gateway/ha/router/TestRoutingGroupSelector.java
Outdated
Show resolved
Hide resolved
f35c48c
to
998379d
Compare
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.
it looks like we are preserving with clause names in the tables list - I think we should exclude them. Lets discuss if needed
// ignore temporary tables created by WITH clause as they can have various table parts | ||
if (temporaryTables.contains(table)) { | ||
return table; | ||
} |
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.
this relies on the WITH
clause being parsed before the name is referenced. This is how the parser works today but is not guaranteed afaik. Delaying name qualification until the full list of WithQuery
names is available should be more reliable.
If we are ok with relying on the parsing order, then this check can be moved to case Table
in getNames
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.
@ebyhr wdyt? Can we assume that the parser always processes a WITH clause before it is referenced in a FROM clause?
gateway-ha/src/test/java/io/trino/gateway/ha/router/TestRoutingGroupSelector.java
Outdated
Show resolved
Hide resolved
2802539
to
32ddf59
Compare
Description
Fix parsing failure on WITH clauses.
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: