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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CTESubstitution.scala:
##########
@@ -255,6 +273,21 @@ object CTESubstitution extends Rule[LogicalPlan] {
       outerCTEDefs
     }
     for ((name, relation) <- relations) {
+      // If recursion is allowed (RECURSIVE keyword specified)
+      // then it has higher priority than outer or previous relations.

Review Comment:
   I have a question about semantics here. Let's see an example
   ```
   WITH RECURSIVE t AS ...
     WITH t AS ...
       SELECT ... FROM t
   ```
   
   The `t` references to the non-recursive CTE def `t` or the recursive one? It 
looks more reasonable to reference the non-recursive one as it's closer in the 
scope. It's weird to make recursive CTE def to have higher priority.



-- 
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