fix(sql): reject unsupported relation modifiers - #24758
Draft
geoffreyclaude wants to merge 1 commit into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24758 +/- ##
==========================================
- Coverage 81.48% 81.48% -0.01%
==========================================
Files 1122 1122
Lines 404248 404292 +44
Branches 404248 404292 +44
==========================================
+ Hits 329390 329420 +30
- Misses 55547 55558 +11
- Partials 19311 19314 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Which issue does this PR close?
Rationale for this change
SQL should either do what the user wrote or explain that it cannot. Today, if no
RelationPlannerclaims a relation, the default path can silently drop modifiers such asTABLESAMPLEorVERSION AS OFand produce an ordinary table scan. That is especially surprising after an extension planner deliberately passes the relation through: a successful query may have different semantics from the SQL on the screen.Real integrations show why this boundary matters:
VERSION AS OFandTIMESTAMP AS OF.TABLESAMPLE.This PR puts the same safety net at DataFusion's default fallback boundary.
What changes are included in this PR?
WITH ORDINALITY, and table-functionSETTINGSwith clear errors.TableFactorandTableFunctionArgsshapes exhaustively. A future sqlparser field now requires an explicit decision at compile time.Are these changes tested?
Yes. The regression test exercises both fallback paths—without an extension planner and after a pass-through planner—and covers five representative forms across named tables, derived tables, and table functions.
I also ran:
cargo fmt --allcargo clippy --all-targets --all-features -- -D warningsAre there any user-facing changes?
Yes, intentionally: syntax that was previously accepted but ignored now returns a clear “not supported” planning error. Queries without these modifiers are unchanged, and extensions that consume a modifier before fallback continue to work as before.