dongjoon-hyun commented on a change in pull request #27562: 
[SPARK-30811][SQL][2.4] CTE should not cause stack overflow when it refers to 
non-existent table with same name
URL: https://github.com/apache/spark/pull/27562#discussion_r379032159
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ##########
 @@ -215,8 +215,8 @@ class Analyzer(
     }
 
     def substituteCTE(plan: LogicalPlan, cteRelations: Seq[(String, 
LogicalPlan)]): LogicalPlan = {
-      plan resolveOperatorsDown {
-        case u: UnresolvedRelation =>
+      plan resolveOperatorsUp {
 
 Review comment:
   Although I know this change is correct, could you make a unit test for this 
change? Actually, for the current test case, line 219 covers it already.
   > CTESubstitution transforms down, this means it will keep replacing t with 
itself, creating an infinite recursion.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to