cloud-fan commented on code in PR #50544:
URL: https://github.com/apache/spark/pull/50544#discussion_r2035599845


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/UnionLoopExec.scala:
##########
@@ -188,7 +188,7 @@ case class UnionLoopExec(
         // This way we support only UNION ALL case. Additional case should be 
added for UNION case.
         // One way of supporting UNION case can be seen at SPARK-24497 PR from 
Peter Toth.
         val newRecursion = recursion.transform {
-          case r: UnionLoopRef =>
+          case r: UnionLoopRef if (r.loopId == loopId) =>

Review Comment:
   ```suggestion
             case r: UnionLoopRef if r.loopId == loopId =>
   ```



##########
sql/core/src/test/resources/sql-tests/inputs/cte-recursion.sql:
##########
@@ -486,4 +486,17 @@ WITH RECURSIVE
         UNION ALL
         SELECT t.id + 1, xid * 10 + x.id FROM t CROSS JOIN x WHERE t.id < 3
     )
-SELECT * FROM t
\ No newline at end of file
+SELECT * FROM t;
+
+-- rCTE referencing other rCTE
+    WITH RECURSIVE t1(a, b) AS (

Review Comment:
   ```suggestion
   WITH RECURSIVE t1(a, b) AS (
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to