zml1206 commented on code in PR #10494:
URL: 
https://github.com/apache/incubator-gluten/pull/10494#discussion_r2289717070


##########
backends-velox/src/main/scala/org/apache/gluten/execution/HashAggregateExecTransformer.scala:
##########
@@ -207,55 +207,33 @@ abstract class HashAggregateExecTransformer(
       aggregateNodeList: JList[AggregateFunctionNode]): Unit = {
     val modeKeyWord = modeToKeyWord(aggregateMode)
 
-    def generateMergeCompanionNode(): Unit = {
-      aggregateMode match {
-        case Partial | PartialMerge =>
-          val aggFunctionNode = ExpressionBuilder.makeAggregateFunction(
-            VeloxAggregateFunctionsBuilder.create(context, aggregateFunction, 
aggregateMode),
-            childrenNodeList,
-            modeKeyWord,
-            VeloxIntermediateData.getIntermediateTypeNode(aggregateFunction)
-          )
-          aggregateNodeList.add(aggFunctionNode)
-        case Final | Complete =>
-          val aggFunctionNode = ExpressionBuilder.makeAggregateFunction(
-            VeloxAggregateFunctionsBuilder.create(context, aggregateFunction, 
aggregateMode),
-            childrenNodeList,
-            modeKeyWord,
-            ConverterUtils.getTypeNode(aggregateFunction.dataType, 
aggregateFunction.nullable)
-          )
-          aggregateNodeList.add(aggFunctionNode)
-        case other =>
-          throw new GlutenNotSupportException(s"$other is not supported.")
-      }
-    }
-
-    aggregateFunction match {
-      case _ if aggregateFunction.aggBufferAttributes.size > 1 =>
-        generateMergeCompanionNode()
-      case _ =>
-        aggregateMode match {
-          case Partial | PartialMerge =>
-            val partialNode = ExpressionBuilder.makeAggregateFunction(
-              VeloxAggregateFunctionsBuilder.create(context, 
aggregateFunction, aggregateMode),
-              childrenNodeList,
-              modeKeyWord,
-              ConverterUtils.getTypeNode(
-                aggregateFunction.inputAggBufferAttributes.head.dataType,
-                aggregateFunction.inputAggBufferAttributes.head.nullable)
-            )
-            aggregateNodeList.add(partialNode)
-          case Final | Complete =>
-            val aggFunctionNode = ExpressionBuilder.makeAggregateFunction(
-              VeloxAggregateFunctionsBuilder.create(context, 
aggregateFunction, aggregateMode),
-              childrenNodeList,
-              modeKeyWord,
-              ConverterUtils.getTypeNode(aggregateFunction.dataType, 
aggregateFunction.nullable)
-            )
-            aggregateNodeList.add(aggFunctionNode)
-          case other =>
-            throw new GlutenNotSupportException(s"$other is not supported.")
-        }
+    aggregateMode match {

Review Comment:
   nit, remove duplicate code `aggregateNodeList.add(aggFunctionNode)`
   ```
   val aggFunctionNode = aggregateMode match {
   ...
   }
   aggregateNodeList.add(aggFunctionNode)
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to