Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Jul 1, 2024
1 parent c6eaae5 commit 07ca195
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ class CometSparkSessionExtensions
private val execRule = CometExecRule(session)

def apply(plan: SparkPlan): SparkPlan = {
var needToReplan = false
val cometPlan = execRule.apply(plan)
if (CometConf.COMET_CBO_ENABLED.get()) {
// simple heuristic to avoid moving from Spark execution to Comet execution just
Expand All @@ -211,17 +210,13 @@ class CometSparkSessionExtensions
cometPlan match {
case CometSortExec(_, _, _, e: CometShuffleExchangeExec, _)
if !e.child.supportsColumnar =>
needToReplan = true
// fall back for sort
plan.setTagValue(CometExplainInfo.CBO_FALLBACK, "avoid move to Comet just for sort")
// fall back for exchange as well
plan.children.head
.setTagValue(CometExplainInfo.CBO_FALLBACK, "avoid move to Comet just for sort")
// fall back for sort amd exchange operators
val fallbackReason = "avoid move to Comet just for sort"
plan.setTagValue(CometExplainInfo.CBO_FALLBACK, fallbackReason)
plan.children.head.setTagValue(CometExplainInfo.CBO_FALLBACK, fallbackReason)
return execRule.apply(plan)
case _ =>
}
if (needToReplan) {
return execRule.apply(plan)
}
}
cometPlan
}
Expand Down

0 comments on commit 07ca195

Please sign in to comment.