jonahgao opened a new pull request, #21049:
URL: https://github.com/apache/datafusion/pull/21049

   ## Which issue does this PR close?
   
   N/A
   
   ## Rationale for this change
   
   PR https://github.com/apache/datafusion/pull/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, 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.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to