This is an automated email from the ASF dual-hosted git repository.
marong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-gluten.git
The following commit(s) were added to refs/heads/main by this push:
new ad717ef3c5 [GLUTEN-7753][CORE] Do not replace literals of expand's
projects in PullOutPreProject (#7756)
ad717ef3c5 is described below
commit ad717ef3c5cda26b88defcdb1bcb5fef2932c6d1
Author: lgbo <[email protected]>
AuthorDate: Sun Nov 3 19:30:07 2024 +0800
[GLUTEN-7753][CORE] Do not replace literals of expand's projects in
PullOutPreProject (#7756)
---
.../gluten/extension/columnar/rewrite/PullOutPreProject.scala | 8 +++++++-
.../main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala | 4 +++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git
a/gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/rewrite/PullOutPreProject.scala
b/gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/rewrite/PullOutPreProject.scala
index 51cdb76a15..ee81c41244 100644
---
a/gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/rewrite/PullOutPreProject.scala
+++
b/gluten-substrait/src/main/scala/org/apache/gluten/extension/columnar/rewrite/PullOutPreProject.scala
@@ -222,7 +222,13 @@ object PullOutPreProject extends RewriteSingleNode with
PullOutProjectHelper {
case expand: ExpandExec if needsPreProject(expand) =>
val expressionMap = new mutable.HashMap[Expression, NamedExpression]()
val newProjections =
- expand.projections.map(_.map(replaceExpressionWithAttribute(_,
expressionMap)))
+ expand.projections.map(
+ _.map(
+ replaceExpressionWithAttribute(
+ _,
+ expressionMap,
+ replaceBoundReference = false,
+ replaceLiteral = false)))
expand.copy(
projections = newProjections,
child = ProjectExec(
diff --git
a/gluten-substrait/src/main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala
b/gluten-substrait/src/main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala
index 85be57493f..e4fc114410 100644
---
a/gluten-substrait/src/main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala
+++
b/gluten-substrait/src/main/scala/org/apache/gluten/utils/PullOutProjectHelper.scala
@@ -62,7 +62,8 @@ trait PullOutProjectHelper {
protected def replaceExpressionWithAttribute(
expr: Expression,
projectExprsMap: mutable.HashMap[Expression, NamedExpression],
- replaceBoundReference: Boolean = false): Expression =
+ replaceBoundReference: Boolean = false,
+ replaceLiteral: Boolean = true): Expression =
expr match {
case alias: Alias =>
alias.child match {
@@ -73,6 +74,7 @@ trait PullOutProjectHelper {
}
case attr: Attribute => attr
case e: BoundReference if !replaceBoundReference => e
+ case literal: Literal if !replaceLiteral => literal
case other =>
projectExprsMap
.getOrElseUpdate(other.canonicalized, Alias(other,
generatePreAliasName)())
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]