Skip to content

ResolveWithCTE Logical Resolution Rule

ResolveWithCTE is a logical resolution rule that the Logical Analyzer uses to resolveWithCTE for CTE query plans.

ResolveWithCTE is a Catalyst rule for transforming logical plans (Rule[LogicalPlan]).

ResolveWithCTE is part of Resolution fixed-point batch of rules.

Executing Rule

apply(
  plan: LogicalPlan): LogicalPlan

apply does nothing and simply returns the given LogicalPlan when applied to a non-CTE query plan. Otherwise, apply resolveWithCTE.

apply is part of the Rule abstraction.

resolveWithCTE

resolveWithCTE(
  plan: LogicalPlan,
  cteDefMap: mutable.HashMap[Long, CTERelationDef]): LogicalPlan

resolveWithCTE requests the given logical operator to resolveOperatorsDownWithPruning for CTE logical operators:

  1. WithCTE
  2. CTERelationRef
  3. Others with CTE and PLAN_EXPRESSION tree patterns

resolveWithCTE is a recursive function.