You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/09 18:20:32 UTC

[GitHub] [spark] imback82 opened a new pull request #25086: [SPARK-28271][SQL][PYTHON] Convert and port 'pgSQL/aggregates_part2.sql' into UDF test base

imback82 opened a new pull request #25086: [SPARK-28271][SQL][PYTHON] Convert and port 'pgSQL/aggregates_part2.sql' into UDF test base
URL: https://github.com/apache/spark/pull/25086
 
 
   ## What changes were proposed in this pull request?
   
   This PR adds some tests converted from `pgSQL/aggregates_part2.sql'` to test UDFs. Please see contribution guide of this umbrella ticket - [SPARK-27921](https://issues.apache.org/jira/browse/SPARK-27921).
   
   <details><summary>Diff comparing to 'pgSQL/aggregates_part2.sql'</summary>
   <p>
   
   ```diff
   diff --git a/sql/core/src/test/resources/sql-tests/results/pgSQL/aggregates_part2.sql.out b/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-aggregates_part2.sql.out
   index 2606d2eba7..00c06f94b5 100644
   --- a/sql/core/src/test/resources/sql-tests/results/pgSQL/aggregates_part2.sql.out
   +++ b/sql/core/src/test/resources/sql-tests/results/udf/pgSQL/udf-aggregates_part2.sql.out
   @@ -57,23 +57,23 @@ true        false   true    false   true    true    true    true    true
   
   
    -- !query 3
   -select min(unique1) from tenk1
   +select min(udf(unique1)) from tenk1
    -- !query 3 schema
   -struct<min(unique1):int>
   +struct<min(udf(unique1)):string>
    -- !query 3 output
    0
   
   
    -- !query 4
   -select max(unique1) from tenk1
   +select udf(max(unique1)) from tenk1
    -- !query 4 schema
   -struct<max(unique1):int>
   +struct<udf(max(unique1)):string>
    -- !query 4 output
    9999
   
   
    -- !query 5
   -select max(unique1) from tenk1 where unique1 < 42
   +select max(unique1) from tenk1 where udf(unique1) < 42
    -- !query 5 schema
    struct<max(unique1):int>
    -- !query 5 output
   @@ -81,7 +81,7 @@ struct<max(unique1):int>
   
   
    -- !query 6
   -select max(unique1) from tenk1 where unique1 > 42
   +select max(unique1) from tenk1 where unique1 > udf(42)
    -- !query 6 schema
    struct<max(unique1):int>
    -- !query 6 output
   @@ -89,7 +89,7 @@ struct<max(unique1):int>
   
   
    -- !query 7
   -select max(unique1) from tenk1 where unique1 > 42000
   +select max(unique1) from tenk1 where udf(unique1) > 42000
    -- !query 7 schema
    struct<max(unique1):int>
    -- !query 7 output
   @@ -97,7 +97,7 @@ NULL
   
   
    -- !query 8
   -select max(tenthous) from tenk1 where thousand = 33
   +select max(tenthous) from tenk1 where udf(thousand) = 33
    -- !query 8 schema
    struct<max(tenthous):int>
    -- !query 8 output
   @@ -105,7 +105,7 @@ struct<max(tenthous):int>
   
   
    -- !query 9
   -select min(tenthous) from tenk1 where thousand = 33
   +select min(tenthous) from tenk1 where udf(thousand) = 33
    -- !query 9 schema
    struct<min(tenthous):int>
    -- !query 9 output
   @@ -113,15 +113,15 @@ struct<min(tenthous):int>
   
   
    -- !query 10
   -select distinct max(unique2) from tenk1
   +select distinct max(udf(unique2)) from tenk1
    -- !query 10 schema
   -struct<max(unique2):int>
   +struct<max(udf(unique2)):string>
    -- !query 10 output
    9999
   
   
    -- !query 11
   -select max(unique2) from tenk1 order by 1
   +select max(unique2) from tenk1 order by udf(1)
    -- !query 11 schema
    struct<max(unique2):int>
    -- !query 11 output
   @@ -129,7 +129,7 @@ struct<max(unique2):int>
   
    -- !query 12
   -select max(unique2) from tenk1 order by max(unique2)
   +select max(unique2) from tenk1 order by max(udf(unique2))
    -- !query 12 schema
    struct<max(unique2):int>
    -- !query 12 output
   @@ -137,7 +137,7 @@ struct<max(unique2):int>
   
   
    -- !query 13
   -select max(unique2) from tenk1 order by max(unique2)+1
   +select max(unique2) from tenk1 order by udf(max(unique2))+1
    -- !query 13 schema
    struct<max(unique2):int>
    -- !query 13 output
   @@ -145,9 +145,9 @@ struct<max(unique2):int>
   
   
    -- !query 14
   -select t1.max_unique2, g from (select max(unique2) as max_unique2 FROM tenk1) t1 LATERAL VIEW explode(array(1,2,3)) t2 AS g order by g desc
   +select t1.max_unique2, udf(g) from (select max(udf(unique2)) as max_unique2 FROM tenk1) t1 LATERAL VIEW explode(array(1,2,3)) t2 AS g order by g desc
    -- !query 14 schema
   -struct<max_unique2:int,g:int>
   +struct<max_unique2:string,udf(g):string>
    -- !query 14 output
    9999   3
    9999   2
   @@ -155,8 +155,8 @@ struct<max_unique2:int,g:int>
   
   
    -- !query 15
   -select max(100) from tenk1
   +select udf(max(100)) from tenk1
    -- !query 15 schema
   -struct<max(100):int>
   +struct<udf(max(100)):string>
    -- !query 15 output
    100
   ```
   
   </p>
   </details> 
   
   ## How was this patch tested?
   
   Tested as guided in [SPARK-27921](https://issues.apache.org/jira/browse/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:
users@infra.apache.org


With regards,
Apache Git Services

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