huaxingao opened a new pull request #25101: 
[SPARK-28277][SQL][PYTHON][TESTS]Convert and port 'except.sql' into UDF test 
base
URL: https://github.com/apache/spark/pull/25101
 
 
   
   
   ## What changes were proposed in this pull request?
   
   This PR adds some tests converted from ```except.sql'``` to test UDFs. 
Please see contribution guide of this umbrella ticket - [SPARK-27921](url).
   <details><summary>Diff comparing to 'except.sql'</summary>
   <p>
   
   ```diff
   except.sql.out 
sql/core/src/test/resources/sql-tests/results/udf/udf-except.sql.out
   diff --git a/sql/core/src/test/resources/sql-tests/results/except.sql.out 
b/sql/core/src/test/resources/sql-tests/results/udf/udf-except.sql.out
   index c9b712d4d2..f21fe942c7 100644
   --- a/sql/core/src/test/resources/sql-tests/results/except.sql.out
   +++ b/sql/core/src/test/resources/sql-tests/results/udf/udf-except.sql.out
   @@ -39,7 +39,7 @@ two   2
    
    
    -- !query 3
   -SELECT * FROM t1 EXCEPT SELECT * FROM t1 where v <> 1 and v <> 2
   +SELECT * FROM t1 EXCEPT SELECT * FROM t1 where udf(v) <> 1 and v <> udf(2)
    -- !query 3 schema
    struct<k:string,v:int>
    -- !query 3 output
   @@ -49,7 +49,7 @@ two   2
    
    
    -- !query 4
   -SELECT * FROM t1 where v <> 1 and v <> 22 EXCEPT SELECT * FROM t1 where v 
<> 2 and v >= 3
   +SELECT * FROM t1 where udf(v) <> 1 and v <> udf(22) EXCEPT SELECT * FROM t1 
where udf(v) <> 2 and v >= udf(3)
    -- !query 4 schema
    struct<k:string,v:int>
    -- !query 4 output
   @@ -59,7 +59,7 @@ two   2
    -- !query 5
    SELECT t1.* FROM t1, t2 where t1.k = t2.k
    EXCEPT
   -SELECT t1.* FROM t1, t2 where t1.k = t2.k and t1.k != 'one'
   +SELECT t1.* FROM t1, t2 where t1.k = t2.k and t1.k != udf('one')
    -- !query 5 schema
    struct<k:string,v:int>
    -- !query 5 output
   @@ -68,7 +68,7 @@ one   NULL
    
    
    -- !query 6
   -SELECT * FROM t2 where v >= 1 and v <> 22 EXCEPT SELECT * FROM t1
   +SELECT * FROM t2 where v >= udf(1) and udf(v) <> 22 EXCEPT SELECT * FROM t1
    -- !query 6 schema
    struct<k:string,v:int>
    -- !query 6 output
   @@ -77,9 +77,9 @@ one   5
    
    
    -- !query 7
   -SELECT (SELECT min(k) FROM t2 WHERE t2.k = t1.k) min_t2 FROM t1
   +SELECT (SELECT min(udf(k)) FROM t2 WHERE t2.k = t1.k) min_t2 FROM t1
    MINUS
   -SELECT (SELECT min(k) FROM t2) abs_min_t2 FROM t1 WHERE  t1.k = 'one'
   +SELECT (SELECT udf(min(k)) FROM t2) abs_min_t2 FROM t1 WHERE  t1.k = 
udf('one')
    -- !query 7 schema
    struct<min_t2:string>
    -- !query 7 output
   @@ -90,13 +90,13 @@ two
    -- !query 8
    SELECT t1.k
    FROM   t1
   -WHERE  t1.v <= (SELECT   max(t2.v)
   +WHERE  t1.v <= (SELECT   max(udf(t2.v))
                    FROM     t2
                    WHERE    t2.k = t1.k)
    MINUS
    SELECT t1.k
    FROM   t1
   -WHERE  t1.v >= (SELECT   min(t2.v)
   +WHERE  udf(t1.v) >= (SELECT   min(udf(t2.v))
                    FROM     t2
                    WHERE    t2.k = t1.k)
    -- !query 8 schema
   ```
   
   </p>
   </details>
   
   ## How was this patch tested?
   Tested as guided in [SPARK-27921.](url)
   
   

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