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)] -> ...-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionoptimize(PlanNode plan, Session session, TypeProvider types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector, PlanOptimizersStatsCollector planOptimizersStatsCollector, TableStatsProvider tableStatsProvider) reallocateSymbols(PlanNode plan, List<Symbol> fields, SymbolAllocator symbolAllocator) Replace all symbols in the plan with new symbols.
-
Constructor Details
-
UnaliasSymbolReferences
-
-
Method Details
-
optimize
public PlanNode optimize(PlanNode plan, Session session, TypeProvider types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector, PlanOptimizersStatsCollector planOptimizersStatsCollector, TableStatsProvider tableStatsProvider) - 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.
-