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

 ##########
 File path: sql/core/src/test/resources/sql-tests/results/udf/udf-union.sql.out
 ##########
 @@ -0,0 +1,166 @@
+-- Automatically generated by SQLQueryTestSuite
+-- Number of queries: 16
+
+
+-- !query 0
+CREATE OR REPLACE TEMPORARY VIEW t1 AS VALUES (1, 'a'), (2, 'b') tbl(c1, c2)
+-- !query 0 schema
+struct<>
+-- !query 0 output
+
+
+
+-- !query 1
+CREATE OR REPLACE TEMPORARY VIEW t2 AS VALUES (1.0, 1), (2.0, 4) tbl(c1, c2)
+-- !query 1 schema
+struct<>
+-- !query 1 output
+
+
+
+-- !query 2
+SELECT udf(c1) as c1, udf(c2) as c2
+FROM   (SELECT udf(c1) as c1, udf(c2) as c2 FROM t1
+        UNION ALL
+        SELECT udf(c1) as c1, udf(c2) as c2 FROM t1)
+-- !query 2 schema
+struct<c1:int,c2:string>
+-- !query 2 output
+1      a
+1      a
+2      b
+2      b
+
+
+-- !query 3
+SELECT udf(c1) as c1, udf(c2) as c2
+FROM   (SELECT udf(c1) as c1, udf(c2) as c2 FROM t1
+        UNION ALL
+        SELECT udf(c1) as c1, udf(c2) as c2 FROM t2
+        UNION ALL
+        SELECT udf(c1) as c1, udf(c2) as c2 FROM t2)
+-- !query 3 schema
+struct<c1:decimal(11,1),c2:string>
+-- !query 3 output
+1      1
+1      1
+1      a
+2      4
+2      4
+2      b
+
+
+-- !query 4
+SELECT udf(a) as a, udf(udf(a)) as a1
+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
+-- !query 4 schema
+struct<a:bigint,a1:bigint>
+-- !query 4 output
+0      0
+0      0
+1      1
 
 Review comment:
   As your [review 
comment](https://github.com/apache/spark/pull/25202#discussion_r305656980), I 
add a udf(udf(a)) to the select fields. So now there're two columns in the 
output instead of one.

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