Consolidate cte_quoted_reference.slt into cte.slt#19862
Merged
alamb merged 1 commit intoapache:mainfrom Jan 20, 2026
Merged
Conversation
- Merged CTE reference resolution tests into main cte.slt file - Added CREATE TABLE statement for orders table used in tests - Fixed 3 case-sensitivity issues: changed 'WHERE N < 10' to 'WHERE n < 10' Fixes apache#19786
Jefffrey
approved these changes
Jan 18, 2026
Contributor
Jefffrey
left a comment
There was a problem hiding this comment.
Fixed 3 pre-existing case-sensitivity bugs by changing WHERE N < 10 to WHERE n < 10 in recursive CTE tests
Not exactly sure how these are bugs 🤔
| ---- | ||
| 1 | ||
| 2 | ||
|
|
Contributor
There was a problem hiding this comment.
Would be good to ensure we cleanup the orders table to ensure this section of tests are isolated
Contributor
|
Thank you @AnjaliChoudhary99 |
xudong963
approved these changes
Jan 20, 2026
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 22, 2026
## 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. https://github.com/apache/datafusion/blob/d138c36cb08c2dc028b29bbd20853b24cf0f3b8b/datafusion/sqllogictest/src/test_context.rs#L230-L241 The problem is that PR #19862 skips registering the strict SchemaProvider and bypasses the unexpected lookup check. Therefore, there tests become meaningless. <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> ## What changes are included in this PR? Re-register the strict SchemaProvider into cte.slt. <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## 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. ```sh $ cargo test --profile release-nonlto --test sqllogictests -- cte Compiling datafusion-sqllogictest v52.0.0 (/Users/jonah/Work/datafusion/datafusion/sqllogictest) Finished `release-nonlto` profile [optimized] target(s) in 19.50s Running bin/sqllogictests.rs (/Users/jonah/Work/datafusion/target/release-nonlto/deps/sqllogictests-f9c15c7896eb5af9) [00:00:00] ####------------------------------------ 6/75 "cte.slt" thread 'tokio-runtime-worker' (486408) panicked at datafusion/sqllogictest/src/test_context.rs:215:22: unexpected table lookup: barbaz. This maybe indicates a CTE reference was incorrectly treated as a catalog table reference. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Completed 3 test files in 0 seconds failure in cte.slt for sql with barbaz as (select * from orders) select * from "barbaz"; caused by External error: task 13 panicked with message "unexpected table lookup: barbaz. This maybe indicates a CTE reference was incorrectly treated as a catalog table reference." Error: Execution("1 failures") error: test failed, to rerun pass `-p datafusion-sqllogictest --test sqllogictests` ``` <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? No. <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> --------- Co-authored-by: Martin Grigorov <martin-g@users.noreply.github.com>
de-bgunter
pushed a commit
to de-bgunter/datafusion
that referenced
this pull request
Mar 24, 2026
- Merged CTE reference resolution tests into main cte.slt file - Added CREATE TABLE statement for orders table used in tests - Fixed 3 case-sensitivity issues: changed 'WHERE N < 10' to 'WHERE n < 10' Fixes apache#19786 ## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes apache#123` indicates that this PR will close issue apache#123. --> - Closes apache#19786 ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> This PR consolidates the small test file `cte_quoted_reference.slt` into the main `cte.slt` file as requested in issue apache#19786. The separate file was small enough that it didn't need to be maintained independently, and consolidating it improves code organization and maintainability. ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> - Merged CTE reference resolution tests from `cte_quoted_reference.slt` into `cte.slt` - Added `CREATE TABLE orders AS VALUES (1), (2);` statement to support the merged tests - Fixed 3 pre-existing case-sensitivity bugs by changing `WHERE N < 10` to `WHERE n < 10` in recursive CTE tests - Deleted `cte_quoted_reference.slt` as it's now consolidated into the main file ## Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> Yes, all changes are tested: - The consolidated tests from `cte_quoted_reference.slt` are now part of the `cte.slt` test suite - All sqllogictest tests pass successfully: `cargo test --test sqllogictests -- cte` - The case-sensitivity fixes ensure that field references match their definitions (lowercase `n`) ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> No, there are no user-facing changes. This is purely a test file reorganization that improves code maintainability without affecting DataFusion's functionality or API. <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> Co-authored-by: Anjali Choudhary <anjalicy@amazon.com>
de-bgunter
pushed a commit
to de-bgunter/datafusion
that referenced
this pull request
Mar 24, 2026
## Which issue does this PR close? N/A ## Rationale for this change PR apache#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. https://github.com/apache/datafusion/blob/d138c36cb08c2dc028b29bbd20853b24cf0f3b8b/datafusion/sqllogictest/src/test_context.rs#L230-L241 The problem is that PR apache#19862 skips registering the strict SchemaProvider and bypasses the unexpected lookup check. Therefore, there tests become meaningless. <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> ## What changes are included in this PR? Re-register the strict SchemaProvider into cte.slt. <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## Are these changes tested? Yes. I also backported these new tests to tag 52.0.0, which does not include the fix in apache#19519, and they failed as expected. ```sh $ cargo test --profile release-nonlto --test sqllogictests -- cte Compiling datafusion-sqllogictest v52.0.0 (/Users/jonah/Work/datafusion/datafusion/sqllogictest) Finished `release-nonlto` profile [optimized] target(s) in 19.50s Running bin/sqllogictests.rs (/Users/jonah/Work/datafusion/target/release-nonlto/deps/sqllogictests-f9c15c7896eb5af9) [00:00:00] ####------------------------------------ 6/75 "cte.slt" thread 'tokio-runtime-worker' (486408) panicked at datafusion/sqllogictest/src/test_context.rs:215:22: unexpected table lookup: barbaz. This maybe indicates a CTE reference was incorrectly treated as a catalog table reference. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Completed 3 test files in 0 seconds failure in cte.slt for sql with barbaz as (select * from orders) select * from "barbaz"; caused by External error: task 13 panicked with message "unexpected table lookup: barbaz. This maybe indicates a CTE reference was incorrectly treated as a catalog table reference." Error: Execution("1 failures") error: test failed, to rerun pass `-p datafusion-sqllogictest --test sqllogictests` ``` <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? No. <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> --------- 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.
Fixes #19786
Which issue does this PR close?
Rationale for this change
This PR consolidates the small test file
cte_quoted_reference.sltinto the maincte.sltfile as requested in issue #19786. The separate file was small enough that it didn't need to be maintained independently, and consolidating it improves code organization and maintainability.What changes are included in this PR?
cte_quoted_reference.sltintocte.sltCREATE TABLE orders AS VALUES (1), (2);statement to support the merged testsWHERE N < 10toWHERE n < 10in recursive CTE testscte_quoted_reference.sltas it's now consolidated into the main fileAre these changes tested?
Yes, all changes are tested:
cte_quoted_reference.sltare now part of thecte.slttest suitecargo test --test sqllogictests -- cten)Are there any user-facing changes?
No, there are no user-facing changes. This is purely a test file reorganization that improves code maintainability without affecting DataFusion's functionality or API.