Skip to content

Commit

Permalink
Analyze CTE definition at once.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Sep 19, 2016
1 parent 8f0c35a commit 394495d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ class Analyzer(
)

/**
* Substitute child plan with cte definitions
* Analyze cte definitions and substitute child plan with analyzed cte definitions.
*/
object CTESubstitution extends Rule[LogicalPlan] {
// TODO allow subquery to define CTE
def apply(plan: LogicalPlan): LogicalPlan = plan resolveOperators {
case With(child, relations) =>
substituteCTE(child, relations.foldLeft(Seq.empty[(String, LogicalPlan)]) {
case (resolved, (name, relation)) =>
resolved :+ name -> ResolveRelations(substituteCTE(relation, resolved))
resolved :+ name -> execute(substituteCTE(relation, resolved))
})
case other => other
}
Expand Down

0 comments on commit 394495d

Please sign in to comment.