HyukjinKwon commented on a change in pull request #25202: 
[SPARK-28289][SQL][PYTHON][TESTS] Convert and port 'union.sql' into UDF test 
base
URL: https://github.com/apache/spark/pull/25202#discussion_r305656850
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/inputs/udf/udf-union.sql
 ##########
 @@ -0,0 +1,56 @@
+-- This test file was converted from union.sql.
+
+CREATE OR REPLACE TEMPORARY VIEW t1 AS VALUES (1, 'a'), (2, 'b') tbl(c1, c2);
+CREATE OR REPLACE TEMPORARY VIEW t2 AS VALUES (1.0, 1), (2.0, 4) tbl(c1, c2);
+
+-- Simple Union
+SELECT *
+FROM   (SELECT * FROM t1
+        UNION ALL
+        SELECT * FROM t1);
+
+-- Type Coerced Union
+SELECT *
+FROM   (SELECT * FROM t1
+        UNION ALL
+        SELECT * FROM t2
+        UNION ALL
+        SELECT * FROM t2);
+
+-- Regression test for SPARK-18622
+SELECT udf(a) as a
+FROM (SELECT udf(0) a, udf(0) b
+      UNION ALL
+      SELECT udf(SUM(1)) a, udf(CAST(0 AS BIGINT)) b
+      UNION ALL SELECT udf(0) a, udf(0) b) T;
+
+-- Regression test for SPARK-18841 Push project through union should not be 
broken by redundant alias removal.
+CREATE OR REPLACE TEMPORARY VIEW p1 AS VALUES 1 T(col);
+CREATE OR REPLACE TEMPORARY VIEW p2 AS VALUES 1 T(col);
+CREATE OR REPLACE TEMPORARY VIEW p3 AS VALUES 1 T(col);
+SELECT udf(1) AS x,
+       udf(col) as col
+FROM   (SELECT udf(col) AS col
+        FROM (SELECT udf(p1.col) AS col
+              FROM   p1 CROSS JOIN p2
+              UNION ALL
+              SELECT udf(col)
+              FROM p3) T1) T2;
+
+-- SPARK-24012 Union of map and other compatible columns.
+SELECT map(1, 2), udf('str') as str
 
 Review comment:
   I would do `udf(map(1, 2))` as well

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to