Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19324#discussion_r141035150
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/HashAggregateExec.scala
 ---
    @@ -462,18 +464,36 @@ case class HashAggregateExec(
            $evaluateAggResults
            ${consume(ctx, resultVars)}
            """
    -
         } else if (modes.contains(Partial) || modes.contains(PartialMerge)) {
    -      // This should be the last operator in a stage, we should output 
UnsafeRow directly
    -      val joinerTerm = ctx.freshName("unsafeRowJoiner")
    -      ctx.addMutableState(classOf[UnsafeRowJoiner].getName, joinerTerm,
    -        s"$joinerTerm = $plan.createUnsafeJoiner();")
    -      val resultRow = ctx.freshName("resultRow")
    +      // resultExpressions are Attributes of groupingExpressions and 
aggregateBufferAttributes.
    +      assert(resultExpressions.forall(_.isInstanceOf[Attribute]))
    +      assert(resultExpressions.length ==
    +        groupingExpressions.length + aggregateBufferAttributes.length)
    --- End diff --
    
    why we don't have these 2 requirements for the `modes.contains(Final) || 
modes.contains(Complete)` branch?


---

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

Reply via email to