Class UnaliasSymbolReferences
java.lang.Object
io.trino.sql.planner.optimizations.UnaliasSymbolReferences
- All Implemented Interfaces:
PlanOptimizer
Re-maps symbol references that are just aliases of each other (e.g., due to projections like
$0 := $1)
E.g.,
Output[$0, $1] -> Project[$0 := $2, $1 := $3 * 100] -> Aggregate[$2, $3 := sum($4)] -> ...
gets rewritten as
Output[$2, $1] -> Project[$2, $1 := $3 * 100] -> Aggregate[$2, $3 := sum($4)] -> ...-
Nested Class Summary
Nested classes/interfaces inherited from interface io.trino.sql.planner.optimizations.PlanOptimizer
PlanOptimizer.Context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionoptimize(PlanNode plan, PlanOptimizer.Context context) reallocateSymbols(PlanNode plan, List<Symbol> fields, SymbolAllocator symbolAllocator) Replace all symbols in the plan with new symbols.
-
Constructor Details
-
UnaliasSymbolReferences
-
-
Method Details
-
optimize
- Specified by:
optimizein interfacePlanOptimizer
-
reallocateSymbols
public NodeAndMappings reallocateSymbols(PlanNode plan, List<Symbol> fields, SymbolAllocator symbolAllocator) Replace all symbols in the plan with new symbols. The returned plan has different output than the original plan. Also, the order of symbols might change during symbol replacement. Symbols in the list `fields` are replaced maintaining the order so they might be used to match original symbols with their replacements. Replacing symbols helps avoid collisions when symbols or parts of the plan are reused.
-