maropu commented on a change in pull request #24831: [SPARK-19799][SQL] Support
WITH clause in subqueries
URL: https://github.com/apache/spark/pull/24831#discussion_r300193431
##########
File path: sql/core/src/test/resources/sql-tests/results/cte.sql.out
##########
@@ -88,26 +98,192 @@ struct<c1:int,c2:int>
1 1
--- !query 7
+-- !query 8
WITH t(x) AS (SELECT 1)
SELECT * FROM t WHERE x = 1
--- !query 7 schema
+-- !query 8 schema
struct<x:int>
--- !query 7 output
+-- !query 8 output
1
--- !query 8
+-- !query 9
+WITH t as (
+ WITH t2 AS (SELECT 1)
+ SELECT * FROM t2
+)
+SELECT * FROM t
+-- !query 9 schema
+struct<1:int>
+-- !query 9 output
+1
+
+
+-- !query 10
+SELECT max(c) FROM (
+ WITH t(c) AS (SELECT 1)
+ SELECT * FROM t
+)
+-- !query 10 schema
+struct<max(c):int>
+-- !query 10 output
+1
+
+
+-- !query 11
+SELECT (
+ WITH t AS (SELECT 1)
+ SELECT * FROM t
+)
+-- !query 11 schema
+struct<scalarsubquery():int>
+-- !query 11 output
+1
+
+
+-- !query 12
+WITH
+ t AS (SELECT 1),
+ t2 AS (
+ WITH t AS (SELECT 2)
+ SELECT * FROM t
+ )
+SELECT * FROM t2
+-- !query 12 schema
+struct<1:int>
+-- !query 12 output
+1
+
Review comment:
This result is different from the pg one;
```
postgres=# WITH
postgres-# t AS (SELECT 1),
postgres-# t2 AS (
postgres(# WITH t AS (SELECT 2)
postgres(# SELECT * FROM t
postgres(# )
postgres-# SELECT * FROM t2;
?column?
----------
2
(1 row)
```
This will be address in the following #25029?
----------------------------------------------------------------
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]