File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -152,10 +152,12 @@ object CTESubstitution extends Rule[LogicalPlan] {
152152 val resolvedCTERelations = new mutable.ArrayBuffer [(String , LogicalPlan )](relations.size)
153153 for ((name, relation) <- relations) {
154154 val innerCTEResolved = if (isLegacy) {
155- // In legacy mode, outer CTE relations take precedence, so substitute relations later.
155+ // In legacy mode, outer CTE relations take precedence. Here we don't resolve the inner
156+ // `With` nodes, later we will substitute `UnresolvedRelation`s with outer CTE relations.
157+ // Analyzer will run this rule multiple times until all `With` nodes are resolved.
156158 relation
157159 } else {
158- // A CTE definition might contain an inner CTE that has priority, so traverse and
160+ // A CTE definition might contain an inner CTE that has a higher priority, so traverse and
159161 // substitute CTE defined in `relation` first.
160162 traverseAndSubstituteCTE(relation)
161163 }
You can’t perform that action at this time.
0 commit comments