wangyum commented on a change in pull request #24743: [WIP][SPARK-27883][SQL] Port AGGREGATES.sql [Part 2] URL: https://github.com/apache/spark/pull/24743#discussion_r289015929
########## File path: sql/core/src/test/resources/sql-tests/results/pgSQL/aggregates_part2.sql.out ########## @@ -0,0 +1,320 @@ +-- Automatically generated by SQLQueryTestSuite +-- Number of queries: 28 + + +-- !query 0 +-- boolean and transitions + -- null because strict + -- and actual computations + + -- boolean or transitions + -- null because strict + -- actual computations + + + + + + + + +explain + select min(unique1) from tenk1 +-- !query 0 schema +struct<plan:string> +-- !query 0 output +== Physical Plan == +*HashAggregate(keys=[], functions=[min(unique1#x)]) ++- *HashAggregate(keys=[], functions=[partial_min(unique1#x)]) + +- *Project [unique1#x] + +- *BatchScan[unique1#x] CSVScan Location: InMemoryFileIndex[file:/Users/yumwang/SPARK-27883/spark/sql/core/target/scala-2.12/test-classes/t..., ReadSchema: struct<unique1:int> + + +-- !query 1 +select min(unique1) from tenk1 +-- !query 1 schema +struct<min(unique1):int> +-- !query 1 output +0 + + +-- !query 2 +explain + select max(unique1) from tenk1 +-- !query 2 schema +struct<plan:string> +-- !query 2 output +== Physical Plan == +*HashAggregate(keys=[], functions=[max(unique1#x)]) ++- *HashAggregate(keys=[], functions=[partial_max(unique1#x)]) + +- *Project [unique1#x] + +- *BatchScan[unique1#x] CSVScan Location: InMemoryFileIndex[file:/Users/yumwang/SPARK-27883/spark/sql/core/target/scala-2.12/test-classes/t..., ReadSchema: struct<unique1:int> + + +-- !query 3 +select max(unique1) from tenk1 +-- !query 3 schema +struct<max(unique1):int> +-- !query 3 output +9999 + + +-- !query 4 +explain + select max(unique1) from tenk1 where unique1 < 42 +-- !query 4 schema +struct<plan:string> +-- !query 4 output +== Physical Plan == +*HashAggregate(keys=[], functions=[max(unique1#x)]) ++- *HashAggregate(keys=[], functions=[partial_max(unique1#x)]) + +- *Project [unique1#x] + +- *Filter (isnotnull(unique1#x) AND (unique1#x < 42)) + +- *BatchScan[unique1#x] CSVScan Location: InMemoryFileIndex[file:/Users/yumwang/SPARK-27883/spark/sql/core/target/scala-2.12/test-classes/t..., ReadSchema: struct<unique1:int> + + +-- !query 5 +select max(unique1) from tenk1 where unique1 < 42 +-- !query 5 schema +struct<max(unique1):int> +-- !query 5 output +41 + + +-- !query 6 +explain + select max(unique1) from tenk1 where unique1 > 42 +-- !query 6 schema +struct<plan:string> +-- !query 6 output +== Physical Plan == +*HashAggregate(keys=[], functions=[max(unique1#x)]) ++- *HashAggregate(keys=[], functions=[partial_max(unique1#x)]) + +- *Project [unique1#x] + +- *Filter (isnotnull(unique1#x) AND (unique1#x > 42)) + +- *BatchScan[unique1#x] CSVScan Location: InMemoryFileIndex[file:/Users/yumwang/SPARK-27883/spark/sql/core/target/scala-2.12/test-classes/t..., ReadSchema: struct<unique1:int> + + +-- !query 7 +select max(unique1) from tenk1 where unique1 > 42 +-- !query 7 schema +struct<max(unique1):int> +-- !query 7 output +9999 + + +-- !query 8 +explain + select max(unique1) from tenk1 where unique1 > 42000 +-- !query 8 schema +struct<plan:string> +-- !query 8 output +== Physical Plan == +*HashAggregate(keys=[], functions=[max(unique1#x)]) ++- *HashAggregate(keys=[], functions=[partial_max(unique1#x)]) + +- *Project [unique1#x] + +- *Filter (isnotnull(unique1#x) AND (unique1#x > 42000)) + +- *BatchScan[unique1#x] CSVScan Location: InMemoryFileIndex[file:/Users/yumwang/SPARK-27883/spark/sql/core/target/scala-2.12/test-classes/t..., ReadSchema: struct<unique1:int> + + +-- !query 9 +select max(unique1) from tenk1 where unique1 > 42000 +-- !query 9 schema +struct<max(unique1):int> +-- !query 9 output +NULL Review comment: It's empty at postgres side, but `NULL` at Spark SQL side: https://github.com/postgres/postgres/blob/REL_12_BETA1/src/test/regress/expected/aggregates.out#L800-L804 ---------------------------------------------------------------- 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]
