Github user maropu commented on a diff in the pull request:
https://github.com/apache/spark/pull/20174#discussion_r160040260
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala ---
@@ -666,4 +666,16 @@ class DataFrameAggregateSuite extends QueryTest with
SharedSQLContext {
assert(exchangePlans.length == 1)
}
}
+
+ test("SPARK-22951: aggregation on empty data frame should only return
initial values") {
+ // non code gen
+ withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "false") {
+ assert(spark.emptyDataFrame.dropDuplicates.count == 0)
+ }
+
+ // code gen
+ withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "true") {
+ assert(spark.emptyDataFrame.dropDuplicates.count == 0)
+ }
+ }
--- End diff --
cc: @gatorsmile
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]