This is an automated email from the ASF dual-hosted git repository.
philo 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 b6776b696 [CORE] Rename isTransformable API to maybeTransformable
(#6233)
b6776b696 is described below
commit b6776b6960fe4ea0cc2a524d5c254ad64e87a508
Author: 高阳阳 <[email protected]>
AuthorDate: Fri Jun 28 08:25:28 2024 +0800
[CORE] Rename isTransformable API to maybeTransformable (#6233)
---
.../gluten/extension/columnar/OffloadSingleNode.scala | 11 ++++-------
.../gluten/extension/columnar/TransformHintRule.scala | 16 +++++-----------
.../columnar/rewrite/RewriteSparkPlanRulesManager.scala | 2 +-
3 files changed, 10 insertions(+), 19 deletions(-)
diff --git
a/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/OffloadSingleNode.scala
b/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/OffloadSingleNode.scala
index 8cd2a5fb6..75da28e30 100644
---
a/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/OffloadSingleNode.scala
+++
b/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/OffloadSingleNode.scala
@@ -213,18 +213,15 @@ case class OffloadFilter() extends OffloadSingleNode with
LogLevelUtil {
// Push down the left conditions in Filter into FileSourceScan.
val newChild: SparkPlan = filter.child match {
case scan @ (_: FileSourceScanExec | _: BatchScanExec) =>
- if (TransformHints.isTransformable(scan)) {
+ if (TransformHints.maybeTransformable(scan)) {
val newScan =
FilterHandler.pushFilterToScan(filter.condition, scan)
newScan match {
case ts: TransformSupport if ts.doValidate().isValid => ts
- // TODO remove the call
- case _ => replace.doReplace(scan)
+ case _ => scan
}
- } else {
- replace.doReplace(scan)
- }
- case _ => replace.doReplace(filter.child)
+ } else scan
+ case _ => filter.child
}
logDebug(s"Columnar Processing for ${filter.getClass} is currently
supported.")
BackendsApiManager.getSparkPlanExecApiInstance
diff --git
a/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/TransformHintRule.scala
b/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/TransformHintRule.scala
index d32cf2d22..aa7aab759 100644
---
a/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/TransformHintRule.scala
+++
b/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/TransformHintRule.scala
@@ -79,18 +79,12 @@ object TransformHints {
}
/**
- * NOTE: To be deprecated. Do not create new usages of this method.
- *
- * Since it's usually not safe to consider a plan "transformable" during
validation phase. Another
- * validation rule could turn "transformable" to "non-transformable" before
implementing the plan
- * within Gluten transformers.
+ * If true, it implies the plan maybe transformable during validation phase
but not guaranteed,
+ * since another validation rule could turn it to "non-transformable" before
implementing the plan
+ * within Gluten transformers. If false, the plan node will be guaranteed
fallback to Vanilla plan
+ * node while being implemented.
*/
- def isTransformable(plan: SparkPlan): Boolean = {
- getHintOption(plan) match {
- case None => true
- case _ => false
- }
- }
+ def maybeTransformable(plan: SparkPlan): Boolean = !isNotTransformable(plan)
def tag(plan: SparkPlan, hint: TransformHint): Unit = {
val mergedHint = getHintOption(plan)
diff --git
a/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/rewrite/RewriteSparkPlanRulesManager.scala
b/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/rewrite/RewriteSparkPlanRulesManager.scala
index ac663314b..8706e5618 100644
---
a/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/rewrite/RewriteSparkPlanRulesManager.scala
+++
b/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/rewrite/RewriteSparkPlanRulesManager.scala
@@ -49,7 +49,7 @@ class RewriteSparkPlanRulesManager private (rewriteRules:
Seq[RewriteSingleNode]
extends Rule[SparkPlan] {
private def mayNeedRewrite(plan: SparkPlan): Boolean = {
- TransformHints.isTransformable(plan) && {
+ TransformHints.maybeTransformable(plan) && {
plan match {
case _: SortExec => true
case _: TakeOrderedAndProjectExec => true
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]