-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: Upgrade to sqlparser-rs 0.62.0 #22069
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
Open
andygrove
wants to merge
8
commits into
apache:main
Choose a base branch
from
andygrove:sqlparser-0.62.0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
658827d
chore: pin sqlparser to apache/datafusion-sqlparser-rs main (9833c033)
andygrove 5374947
docs: explain exclude_owned scope and large_enum_variant suppression
andygrove abf1cac
refactor: use ObjectNamePart::as_ident() for ObjectName→Ident conversion
andygrove b6ee65b
use sqlparser 0.62.0 release
andygrove c6813c0
Merge remote-tracking branch 'apache/main' into sqlparser-0.62.0
andygrove 7829edf
fix: regenerate Cargo.lock to repair merge artifact
andygrove dd8a549
Consolidate and document SQL AST shims
alamb 0dcd70f
refactor: align fallback SQL AST shims with sqlparser 0.62
andygrove File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
I'm not too sure about this feature gating, tbh.
This is what Claude suggested
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.
Claude says:
Here's what's happening and why the cfg(feature = "sql") gates exist:
The setup. datafusion-expr has a sql feature (on by default) that depends on sqlparser. When sql is enabled, ExcludeSelectItem is re-exported from sqlparser::ast. When it's disabled, expr.rs provides its
own fallback enum with Ident payloads (datafusion/expr/src/expr.rs:1431-1436). The two paths in utils.rs already exist via the existing #[cfg(...)] imports at lines 41-45.
What sqlparser 0.62 changed. In 0.61, ExcludeSelectItem::Single carried Ident and Multiple carried Vec. In 0.62, both now carry ObjectName (a possibly multi-part name like schema.column). The
fallback enum in expr.rs still uses Ident because that crate-local copy hasn't changed.
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.
I suggest we should update the fallback copy in DataFusion to match the sql parser one.
For example
datafusion/datafusion/expr/src/expr.rs
Lines 1452 to 1457 in 658827d
That will avoid the need to have two copies
Looks like this copy came in via #17332 from @timsaucer
Maybe we can add some comments explaining the rationale for the second copy better (any isolate the cfg sql somewhere to make it clearer)
Uh oh!
There was an error while loading. Please reload this page.
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.
I was trying to understand it. My understanding of this, please correct if I'm wrong is supporting
select * exclude(col)using sqlparser(sql feature is on) and using Datafuiosn, specifically referring toExceptSelectItem. Why we need to keep parts of parser in DF? Maybe I'm missing somethingThere 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.
Why can't we have unified approach, to use parser or use DataFusion, did they diverge at some point?
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.
I think the idea is to avoid a dependency on
sqlparser-rsif you aren't using the SQL interfaceI will propose some comments to make this celar
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.
I made a PR to try and make the "use ast shims" clearer