Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Chaho12
Copy link
Member

@Chaho12 Chaho12 commented Oct 21, 2024

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:

* Fix parsing failures on WITH clauses. ({issue}`528`)

@Chaho12 Chaho12 self-assigned this Oct 21, 2024
@cla-bot cla-bot bot added the cla-signed label Oct 21, 2024
Copy link
Member

@mosabua mosabua left a 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.

Copy link
Member

@ebyhr ebyhr left a 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.

@Chaho12
Copy link
Member Author

Chaho12 commented Oct 22, 2024

we really should not try to parse the query since we are missing the full context .. only the coordinator really has that.

I agree, even if it is quite helpful information. We should talk more on this next time.

@Chaho12 Chaho12 force-pushed the feature/jaeho.yoo/fix-temporary-table branch from 3e1cbb3 to 05d0600 Compare October 23, 2024 01:47
.gitignore Outdated Show resolved Hide resolved
@Chaho12 Chaho12 force-pushed the feature/jaeho.yoo/fix-temporary-table branch from 05d0600 to cfca1ed Compare October 23, 2024 02:22
@Chaho12 Chaho12 force-pushed the feature/jaeho.yoo/fix-temporary-table branch from cfca1ed to f35c48c Compare October 23, 2024 02:57
@Chaho12 Chaho12 requested a review from ebyhr October 23, 2024 02:58
@Chaho12 Chaho12 force-pushed the feature/jaeho.yoo/fix-temporary-table branch from f35c48c to 998379d Compare October 23, 2024 05:05
Copy link
Contributor

@willmostly willmostly left a 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

Comment on lines 399 to 402
// ignore temporary tables created by WITH clause as they can have various table parts
if (temporaryTables.contains(table)) {
return table;
}
Copy link
Contributor

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

Copy link
Contributor

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?

@Chaho12 Chaho12 force-pushed the feature/jaeho.yoo/fix-temporary-table branch from 2802539 to 32ddf59 Compare October 24, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Parsing fails when there isn't default schema
4 participants