Fix CTE reference resolution slt tests#21049
Open
jonahgao wants to merge 2 commits intoapache:mainfrom
Open
Conversation
jonahgao
commented
Mar 19, 2026
|
|
||
| // Override the default "datafusion" catalog for this test file so that any | ||
| // unexpected lookup is caught immediately. | ||
| ctx.register_catalog( |
Member
Author
There was a problem hiding this comment.
Register a new schema instead of overriding the default datafusion catalog to avoid impacting other CTE tests.
|
|
||
| let file_name = relative_path.file_name().unwrap().to_str().unwrap(); | ||
| match file_name { | ||
| "cte_quoted_reference.slt" => { |
Member
Author
There was a problem hiding this comment.
cte_quoted_reference.slt has been consolidated into cte.slt, and no longer exists.
jonahgao
commented
Mar 19, 2026
| WITH a AS (SELECT 1), a AS (SELECT 2) SELECT * FROM a; | ||
|
|
||
| statement ok | ||
| CREATE TABLE orders AS VALUES (1), (2); |
Member
Author
There was a problem hiding this comment.
Should use the orders table from the StrictSchemaProvider, rather than creating a new one
jonahgao
commented
Mar 19, 2026
|
|
||
| # Reset to default configs | ||
| statement ok | ||
| set datafusion.sql_parser.enable_ident_normalization = true; |
martin-g
approved these changes
Mar 19, 2026
martin-g
reviewed
Mar 19, 2026
Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
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?
N/A
Rationale for this change
PR #19519 introduces new tests to verify that DataFusion won't unexpectedly lookup CTE names from the catalog. It registers a strict SchemaProvider that panics with unexpected table lookups.
datafusion/datafusion/sqllogictest/src/test_context.rs
Lines 230 to 241 in d138c36
The problem is that PR #19862 skips registering the strict SchemaProvider and bypasses the unexpected lookup check. Therefore, there tests become meaningless.
What changes are included in this PR?
Re-register the strict SchemaProvider into cte.slt.
Are these changes tested?
Yes.
I also backported these new tests to tag 52.0.0, which does not include the fix in #19519, and they failed as expected.
Are there any user-facing changes?
No.