Class UnaliasSymbolReferences
- java.lang.Object
-
- io.prestosql.sql.planner.optimizations.UnaliasSymbolReferences
-
- All Implemented Interfaces:
PlanOptimizer
public class UnaliasSymbolReferences extends Object implements 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 asOutput[$2, $1] -> Project[$2, $1 := $3 * 100] -> Aggregate[$2, $3 := sum($4)] -> ...
-
-
Constructor Summary
Constructors Constructor Description UnaliasSymbolReferences(Metadata metadata)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PlanNode
optimize(PlanNode plan, Session session, TypeProvider types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector)
NodeAndMappings
reallocateSymbols(PlanNode plan, List<Symbol> fields, SymbolAllocator symbolAllocator)
Replace all symbols in the plan with new symbols.
-
-
-
Constructor Detail
-
UnaliasSymbolReferences
public UnaliasSymbolReferences(Metadata metadata)
-
-
Method Detail
-
optimize
public PlanNode optimize(PlanNode plan, Session session, TypeProvider types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector)
- Specified by:
optimize
in 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.
-
-