WangGuangxin commented on code in PR #5626:
URL: https://github.com/apache/incubator-gluten/pull/5626#discussion_r1627175448
##########
gluten-core/src/main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala:
##########
@@ -143,8 +144,39 @@ trait PullOutProjectHelper {
ae.copy(aggregateFunction = newAggFunc, filter = newFilter)
}
+ private def needPreComputeRangeFrameBoundary(bound: Expression): Boolean = {
+ bound match {
+ case _: PreComputeRangeFrameBound => false
+ case _ if !bound.foldable => false
+ case _ => true
+ }
+ }
+
+ private def preComputeRangeFrameBoundary(
+ bound: Expression,
+ orderSpec: SortOrder,
+ expressionMap: mutable.HashMap[Expression, NamedExpression]): Expression
= {
+ bound match {
+ case _: PreComputeRangeFrameBound => bound
+ case _ if !bound.foldable => bound
+ case _ if bound.foldable =>
+ val a = expressionMap
+ .getOrElseUpdate(
+ bound.canonicalized,
+ Alias(Add(orderSpec.child, bound), generatePreAliasName)())
Review Comment:
The frame bouding is a reference, which will be pre-project before window
operator. And the sort/partition are calculated in window operator. So it's ok
to reuse it.
I add a UT for this.
--
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]