Github user mgaido91 commented on a diff in the pull request:
https://github.com/apache/spark/pull/20174#discussion_r160114031
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/HashAggregateExec.scala
---
@@ -102,10 +102,12 @@ case class HashAggregateExec(
val beforeAgg = System.nanoTime()
val hasInput = iter.hasNext
- val res = if (!hasInput && groupingExpressions.nonEmpty) {
- // This is a grouped aggregate and the input iterator is empty,
+ val res = if (!hasInput && (groupingExpressions.nonEmpty ||
resultExpressions.isEmpty)) {
+ // The input iterator is empty, and this is a grouped aggregate or
without result columns,
// so return an empty iterator.
Iterator.empty
+ } else if (!hasInput && resultExpressions.isEmpty) {
--- End diff --
This is covered in the previous condition, isn't it?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]