peter-toth opened a new pull request, #36146:
URL: https://github.com/apache/spark/pull/36146

   ### What changes were proposed in this pull request?
   Fix CTE resolution in non-legacy, non-command cases with collecting already 
resolved outer CTEs. These outer CTE definitions are requires to property 
define inner CTEs.
   
   ### Why are the changes needed?
   Fix a bug introduced in 3.2.0 with 
[SPARK-36447](https://issues.apache.org/jira/browse/SPARK-36447).
   Currently the following query can't resolve `t1` in the inner CTE.
   After this PR the following query returns the expected value.
   ```
   WITH
     t1 AS (SELECT 1),
     t2 AS (
       WITH t3 AS (
         SELECT * FROM t1
       )
       SELECT * FROM t3
     )
   SELECT * FROM t2;
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, the query works again.
   
   ### How was this patch tested?
   Added new test case.
   


-- 
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