vinodkc opened a new pull request #25089: [SPARK-28275][SQL] Convert and port 
'count.sql' into UDF test base
URL: https://github.com/apache/spark/pull/25089
 
 
   ## What changes were proposed in this pull request?
   
   This PR adds some tests converted from count.sql' to test UDFs
   
   <details><summary>Diff comparing to 'count.sql'</summary>
   <p>
   
   ```diff
   diff --git a/sql/core/src/test/resources/sql-tests/results/count.sql.out 
b/sql/core/src/test/resources/sql-tests/results/udf/udf-count.sql.out
   index b8a86d4c44..9476937abd 100644
   --- a/sql/core/src/test/resources/sql-tests/results/count.sql.out
   +++ b/sql/core/src/test/resources/sql-tests/results/udf/udf-count.sql.out
   @@ -14,42 +14,42 @@ struct<>
    
    -- !query 1
    SELECT
   -  count(*), count(1), count(null), count(a), count(b), count(a + b), 
count((a, b))
   +  udf(count(*)), udf(count(1)), udf(count(null)), udf(count(a)), 
udf(count(b)), udf(count(a + b)), udf(count((a, b)))
    FROM testData
    -- !query 1 schema
   
-struct<count(1):bigint,count(1):bigint,count(NULL):bigint,count(a):bigint,count(b):bigint,count((a
 + b)):bigint,count(named_struct(a, a, b, b)):bigint>
   
+struct<udf(count(1)):string,udf(count(1)):string,udf(count(null)):string,udf(count(a)):string,udf(count(b)):string,udf(count((a
 + b))):string,udf(count(named_struct(a, a, b, b))):string>
    -- !query 1 output
    7   7       0       5       5       4       7
    
    
    -- !query 2
    SELECT
   -  count(DISTINCT 1),
   -  count(DISTINCT null),
   -  count(DISTINCT a),
   -  count(DISTINCT b),
   -  count(DISTINCT (a + b)),
   -  count(DISTINCT (a, b))
   +  udf(count(DISTINCT 1)),
   +  udf(count(DISTINCT null)),
   +  udf(count(DISTINCT a)),
   +  udf(count(DISTINCT b)),
   +  udf(count(DISTINCT (a + b))),
   +  udf(count(DISTINCT (a, b)))
    FROM testData
    -- !query 2 schema
   -struct<count(DISTINCT 1):bigint,count(DISTINCT NULL):bigint,count(DISTINCT 
a):bigint,count(DISTINCT b):bigint,count(DISTINCT (a + 
b)):bigint,count(DISTINCT named_struct(a, a, b, b)):bigint>
   +struct<udf(count(distinct 1)):string,udf(count(distinct 
null)):string,udf(count(distinct a)):string,udf(count(distinct 
b)):string,udf(count(distinct (a + b))):string,udf(count(distinct 
named_struct(a, a, b, b))):string>
    -- !query 2 output
    1   0       2       2       2       6
    
    
    -- !query 3
   -SELECT count(a, b), count(b, a), count(testData.*) FROM testData
   +SELECT udf(count(a, b)), udf(count(b, a)), udf(count(testData.*)) FROM 
testData
    -- !query 3 schema
   -struct<count(a, b):bigint,count(b, a):bigint,count(a, b):bigint>
   +struct<udf(count(a, b)):string,udf(count(b, a)):string,udf(count(a, 
b)):string>
    -- !query 3 output
    4   4       4
    
    
    -- !query 4
    SELECT
   -  count(DISTINCT a, b), count(DISTINCT b, a), count(DISTINCT *), 
count(DISTINCT testData.*)
   +  udf(count(DISTINCT a, b)), udf(count(DISTINCT b, a)), udf(count(DISTINCT 
*)), udf(count(DISTINCT testData.*))
    FROM testData
    -- !query 4 schema
   -struct<count(DISTINCT a, b):bigint,count(DISTINCT b, 
a):bigint,count(DISTINCT a, b):bigint,count(DISTINCT a, b):bigint>
   +struct<udf(count(distinct a, b)):string,udf(count(distinct b, 
a)):string,udf(count(distinct a, b)):string,udf(count(distinct a, b)):string>
    -- !query 4 output
    3   3       3       3
   
   ```
   
   </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