This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git


The following commit(s) were added to refs/heads/main by this push:
     new 741d00c5 fix: Avoid recursive call to `canonicalizePlans` (#582)
741d00c5 is described below

commit 741d00c51da635eb7fd861c54c408ce97b04425e
Author: Liang-Chi Hsieh <[email protected]>
AuthorDate: Mon Jun 17 11:44:29 2024 -0700

    fix: Avoid recursive call to `canonicalizePlans` (#582)
    
    * fix: Avoid resursive call to canonicalizePlans
    
    * Add comment
    
    * fix
---
 spark/src/main/scala/org/apache/spark/sql/comet/operators.scala | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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 394e4b15..8b1ba168 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,7 +381,11 @@ abstract class CometNativeExec extends CometExec {
    */
   protected def canonicalizePlans(): CometNativeExec = {
     def transform(arg: Any): AnyRef = arg match {
-      case sparkPlan: SparkPlan => sparkPlan.canonicalized
+      case sparkPlan: SparkPlan if !sparkPlan.isInstanceOf[CometNativeExec] =>
+        // 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
       case other: AnyRef => other
       case null => null
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to