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 2022/02/11 07:34:44 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #35490: [SPARK-38185][SQL] Fix data incorrect if aggregate function is empty

cloud-fan commented on a change in pull request #35490:
URL: https://github.com/apache/spark/pull/35490#discussion_r804410010



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -984,7 +984,8 @@ case class Aggregate(
 
   // Whether this Aggregate operator is group only. For example: SELECT a, a FROM t GROUP BY a
   private[sql] def groupOnly: Boolean = {
-    aggregateExpressions.map {
+    // aggregateExpressions can be empty through Dateset.agg
+    aggregateExpressions.nonEmpty && aggregateExpressions.map {

Review comment:
       is it more explicit to check `groupingExpressions.nonEmpty`? Logically, an aggregate operator without output columns is still group only if it has group columns.




-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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