peter-toth opened a new pull request #25029: [WIP][SPARK-28228][SQL] Better 
support for WITH clause
URL: https://github.com/apache/spark/pull/25029
 
 
   ## What changes were proposed in this pull request?
   
   This PR adds compatibility of handling a `WITH` clause within another `WITH` 
cause. Before this PR these queries retuned `1` while after this PR they return 
`2` as PostgreSQL does:
   ```
   WITH
     t AS (SELECT 1),
     t2 AS (
       WITH t AS (SELECT 2)
       SELECT * FROM t
     )
   SELECT * FROM t2
   ```
   ```
   WITH t AS (SELECT 1)
   SELECT (
     WITH t AS (SELECT 2)
     SELECT * FROM t
   )
   ```
   As this is an incompatible change, the PR introduces the 
`spark.sql.legacy.cte.substitution.enabled` flag as an option to restore old 
behaviour.
   
   ## How was this patch tested?
   
   Added new UTs.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to