Skip to content

InlineCTE Logical Optimization

InlineCTE is a base logical optimization that...FIXME

InlineCTE is part of the Finish Analysis once-executed batch in the standard batches of the Logical Optimizer.

InlineCTE is a Catalyst Rule for transforming LogicalPlans (Rule[LogicalPlan]).

Executing Rule

apply(
  plan: LogicalPlan): LogicalPlan

apply does nothing and simply returns the given LogicalPlan when applied to a Subquery or a non-CTE query plan. Otherwise, apply buildCTEMap followed by inlineCTE (with forceInline off).

apply is part of the Rule abstraction.

buildCTEMap

buildCTEMap(
  plan: LogicalPlan,
  cteMap: mutable.HashMap[Long, (CTERelationDef, Int)]): Unit

For a WithCTE logical operator buildCTEMap...FIXME

For a CTERelationRef logical operator buildCTEMap...FIXME

inlineCTE

inlineCTE(
  plan: LogicalPlan,
  cteMap: mutable.HashMap[Long, (CTERelationDef, Int)],
  forceInline: Boolean): LogicalPlan

inlineCTE...FIXME