ulysses-you commented on code in PR #5575:
URL: https://github.com/apache/incubator-gluten/pull/5575#discussion_r1590633161


##########
gluten-core/src/main/scala/org/apache/gluten/execution/HashAggregateExecBaseTransformer.scala:
##########
@@ -172,12 +172,32 @@ abstract class HashAggregateExecBaseTransformer(
       validation: Boolean = false): RelNode
 }
 
-abstract class HashAggregateExecPullOutBaseHelper(
-    groupingExpressions: Seq[NamedExpression],
-    aggregateExpressions: Seq[AggregateExpression],
-    aggregateAttributes: Seq[Attribute]) {
+object HashAggregateExecBaseTransformer {
+
+  private def getInitialInputBufferOffset(agg: BaseAggregateExec): Int = agg 
match {
+    case a: HashAggregateExec => a.initialInputBufferOffset
+    case a: ObjectHashAggregateExec => a.initialInputBufferOffset
+    case a: SortAggregateExec => a.initialInputBufferOffset
+  }
+
+  def from(agg: BaseAggregateExec)(
+      childConverter: SparkPlan => SparkPlan = p => p): 
HashAggregateExecBaseTransformer = {
+    BackendsApiManager.getSparkPlanExecApiInstance
+      .genHashAggregateExecTransformer(
+        agg.requiredChildDistributionExpressions,
+        agg.groupingExpressions,
+        agg.aggregateExpressions,
+        agg.aggregateAttributes,
+        getInitialInputBufferOffset(agg),
+        agg.resultExpressions,
+        childConverter(agg.child)
+      )
+  }
+}
+
+trait HashAggregateExecPullOutBaseHelper {
   // The direct outputs of Aggregation.
-  lazy val allAggregateResultAttributes: List[Attribute] =
+  def allAggregateResultAttributes(groupingExpressions: Seq[NamedExpression]): 
List[Attribute] =

Review Comment:
   how about define `agg: BaseAggregateExec` in this trait ?



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