Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
cloud-fan committed Apr 27, 2020
1 parent c4d0a69 commit 24a487d
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -70,14 +70,13 @@ object CTESubstitution extends Rule[LogicalPlan] {
"defined in inner CTE takes precedence. If set it to LEGACY, outer CTE " +
"definitions will take precedence. See more details in SPARK-28228.")
}
assertNoNameConflictsInCTE(relation, newNames)
// CTE relation is defined as `SubqueryAlias`. Here we skip it and check the child
// directly, so that `startOfQuery` is set correctly.
assertNoNameConflictsInCTE(relation.child, newNames)
newNames += name
}
assertNoNameConflictsInCTE(child, newNames, startOfQuery = false)

case s: SubqueryAlias if startOfQuery =>
assertNoNameConflictsInCTE(s.child, outerCTERelationNames)

case other =>
other.subqueries.foreach(assertNoNameConflictsInCTE(_, outerCTERelationNames))
other.children.foreach(
Expand Down

0 comments on commit 24a487d

Please sign in to comment.