WangGuangxin commented on code in PR #5007:
URL: https://github.com/apache/incubator-gluten/pull/5007#discussion_r1593888422
##########
gluten-core/src/main/scala/io/glutenproject/extension/columnar/RewriteTypedImperativeAggregate.scala:
##########
@@ -67,6 +100,28 @@ object RewriteTypedImperativeAggregate extends
Rule[SparkPlan] with PullOutProje
}
copyBaseAggregateExec(agg)(newResultExpressions = newResultExpressions)
+ case agg: BaseAggregateExec
+ if
agg.aggregateExpressions.exists(shouldRewriteForPercentileLikeExpr) =>
+ val exprMap = agg.aggregateExpressions
+ .filter(shouldRewriteForPercentileLikeExpr)
+ .map(ae => ae.aggregateFunction.inputAggBufferAttributes.head -> ae)
+ .toMap
+ val newResultExpressions = agg.resultExpressions.map {
+ case attr: AttributeReference =>
+ exprMap
+ .get(attr)
+ .map {
+ ae =>
+ attr.copy(dataType =
getPercentileLikeInterminateDataType(ae.aggregateFunction))(
+ exprId = attr.exprId,
+ qualifier = attr.qualifier
+ )
+ }
+ .getOrElse(attr)
+ case other => other
+ }
+ copyBaseAggregateExec(agg)(newResultExpressions = newResultExpressions)
Review Comment:
ok, I'll rebase and refact it
--
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]