From dd44bfedad31ab07fcf884de5e91a2c5d97a1847 Mon Sep 17 00:00:00 2001 From: Liang-Chi Hsieh Date: Sun, 7 Jul 2024 15:25:26 -0700 Subject: [PATCH] More --- .../main/scala/org/apache/spark/sql/comet/operators.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spark/src/main/scala/org/apache/spark/sql/comet/operators.scala b/spark/src/main/scala/org/apache/spark/sql/comet/operators.scala index 8b1ba168f9..ca3f69cdda 100644 --- a/spark/src/main/scala/org/apache/spark/sql/comet/operators.scala +++ b/spark/src/main/scala/org/apache/spark/sql/comet/operators.scala @@ -381,11 +381,13 @@ abstract class CometNativeExec extends CometExec { */ protected def canonicalizePlans(): CometNativeExec = { def transform(arg: Any): AnyRef = arg match { - case sparkPlan: SparkPlan if !sparkPlan.isInstanceOf[CometNativeExec] => + case sparkPlan: SparkPlan + if !sparkPlan.isInstanceOf[CometNativeExec] && + children.forall(_ != sparkPlan) => // Different to Spark, Comet native query node might have a Spark plan as Product element. // We need to canonicalize the Spark plan. But it cannot be another Comet native query node, // otherwise it will cause recursive canonicalization. - sparkPlan.canonicalized + null case other: AnyRef => other case null => null }