Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyangxiaozhu committed Jun 27, 2024
1 parent 46ed904 commit d7bad0d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ 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.isNotTransformable(scan)) {
if (TransformHints.maybeTransformable(scan)) {
val newScan =
FilterHandler.pushFilterToScan(filter.condition, scan)
newScan match {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ object TransformHints {
}
}

/**
* 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 maybeTransformable(plan: SparkPlan): Boolean = !isNotTransformable(plan)

def tag(plan: SparkPlan, hint: TransformHint): Unit = {
val mergedHint = getHintOption(plan)
.map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class RewriteSparkPlanRulesManager private (rewriteRules: Seq[RewriteSingleNode]
extends Rule[SparkPlan] {

private def mayNeedRewrite(plan: SparkPlan): Boolean = {
!TransformHints.isNotTransformable(plan) && {
TransformHints.maybeTransformable(plan) && {
plan match {
case _: SortExec => true
case _: TakeOrderedAndProjectExec => true
Expand Down

0 comments on commit d7bad0d

Please sign in to comment.