peter-toth commented on a change in pull request #24949: 
[SPARK-28002][SQL][FOLLOWUP] Add more WITH test cases
URL: https://github.com/apache/spark/pull/24949#discussion_r296871258
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/inputs/cte.sql
 ##########
 @@ -28,6 +28,20 @@ FROM   CTE1 t1
 WITH t(x) AS (SELECT 1)
 SELECT * FROM t WHERE x = 1;
 
+-- CTE with multiple column aliases
+WITH t(x, y) AS (SELECT 1, 2)
+SELECT * FROM t WHERE x = 1 AND y = 2;
+
+-- CTE with empty column alias list is not allowed
+WITH t() AS (SELECT 1)
+SELECT * FROM t;
+
+-- CTE with duplicate name is not allowed
 
 Review comment:
   Hmm, I added the `t(x, x)` case, but it is allowed, and I think it is right 
to be allowed. 
   I thought @gatorsmile referred to the
   ```
   WITH
     t(x) AS (SELECT 1),
     t(x) AS (SELECT 2)
   SELECT * FROM t;
   ```
   case, which is not.
   
   @gatorsmile we capture the duplicate CTE name during parsing, I fixed the 
error message though.
   
   If I got something wrong please let me know.

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