yiheng opened a new 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
 
 
   ## What changes were proposed in this pull request?
   This PR adds some tests converted from 'udaf.sql' to test UDFs
   
   <details><summary>Diff comparing to 'xxx.sql'</summary>
   <p>
   
   ```diff
   iff --git a/sql/core/src/test/resources/sql-tests/results/union.sql.out 
b/sql/core/src/test/resources/sql-tests/results/udf/udf-union.sql.out
   index b023df825d..881005d769 100644
   --- a/sql/core/src/test/resources/sql-tests/results/union.sql.out
   +++ b/sql/core/src/test/resources/sql-tests/results/udf/udf-union.sql.out
   @@ -51,11 +51,11 @@ struct<c1:decimal(11,1),c2:string>
   
   
    -- !query 4
   -SELECT a
   -FROM (SELECT 0 a, 0 b
   +SELECT udf(a) as a
   +FROM (SELECT udf(0) a, udf(0) b
          UNION ALL
   -      SELECT SUM(1) a, CAST(0 AS BIGINT) b
   -      UNION ALL SELECT 0 a, 0 b) T
   +      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>
    -- !query 4 output
   @@ -89,13 +89,13 @@ struct<>
   
   
    -- !query 8
   -SELECT 1 AS x,
   -       col
   -FROM   (SELECT col AS col
   -        FROM (SELECT p1.col AS 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 col
   +              SELECT udf(col)
                  FROM p3) T1) T2
    -- !query 8 schema
    struct<x:int,col:int>
   @@ -105,9 +105,9 @@ struct<x:int,col:int>
   
   
    -- !query 9
   -SELECT map(1, 2), 'str'
   +SELECT map(1, 2), udf('str') as str
    UNION ALL
   -SELECT map(1, 2, 3, NULL), 1
   +SELECT map(1, 2, 3, NULL), udf(1)
    -- !query 9 schema
    struct<map(1, 2):map<int,int>,str:string>
    -- !query 9 output
   @@ -116,9 +116,9 @@ struct<map(1, 2):map<int,int>,str:string>
   
   
    -- !query 10
   -SELECT array(1, 2), 'str'
   +SELECT array(1, 2), udf('str') as str
    UNION ALL
   -SELECT array(1, 2, 3, NULL), 1
   +SELECT array(1, 2, 3, NULL), udf(1)
    -- !query 10 schema
    struct<array(1, 2):array<int>,str:string>
    -- !query 10 output
   ```
   
   </p>
   </details>
   
   ## How was this patch tested?
   Tested as guided in SPARK-27921.
   

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