Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix CometNativeExec.doCanonicalize for ReusedExchangeExec #447

Merged
merged 1 commit into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion spark/src/main/scala/org/apache/spark/sql/comet/operators.scala
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,32 @@ abstract class CometNativeExec extends CometExec {
}

override protected def doCanonicalize(): SparkPlan = {
val canonicalizedPlan = super.doCanonicalize().asInstanceOf[CometNativeExec]
val canonicalizedPlan = super
.doCanonicalize()
.asInstanceOf[CometNativeExec]
.canonicalizePlans()

if (serializedPlanOpt.isDefined) {
// If the plan is a boundary node, we should remove the serialized plan.
canonicalizedPlan.cleanBlock()
} else {
canonicalizedPlan
}
}

/**
* Canonicalizes the plans of Product parameters in Comet native operators.
*/
protected def canonicalizePlans(): CometNativeExec = {
def transform(arg: Any): AnyRef = arg match {
case sparkPlan: SparkPlan => sparkPlan.canonicalized
case other: AnyRef => other
case null => null
}

val newArgs = mapProductIterator(transform)
makeCopy(newArgs).asInstanceOf[CometNativeExec]
}
}

abstract class CometUnaryExec extends CometNativeExec with UnaryExecNode
Expand Down
Loading
Loading