peter-toth commented on a change in pull request #24831: [SPARK-19799][SQL] 
Better support for WITH clause
URL: https://github.com/apache/spark/pull/24831#discussion_r299012134
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/inputs/cte.sql
 ##########
 @@ -28,6 +28,177 @@ FROM   CTE1 t1
 WITH t(x) AS (SELECT 1)
 SELECT * FROM t WHERE x = 1;
 
+-- CTE in CTE definition
+WITH t as (
+  WITH t2 AS (SELECT 1)
+  SELECT * FROM t2
+)
+SELECT * FROM t;
+
+-- CTE in subquery
+SELECT max(c) FROM (
+  WITH t(c) AS (SELECT 1)
+  SELECT * FROM t
+);
+
+-- CTE in subquery expression
+SELECT (
+  WITH t AS (SELECT 1)
+  SELECT * FROM t
+);
+
+-- CTE in CTE definition shadows outer (legacy substitution)
+SET spark.sql.legacy.cte.substitution.enabled=true;
 
 Review comment:
   ok, done

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