Class RemoveEmptyUnionBranches
- java.lang.Object
-
- io.trino.sql.planner.iterative.rule.RemoveEmptyUnionBranches
-
public class RemoveEmptyUnionBranches extends Object implements Rule<UnionNode>
Removes branches from a UnionNode that are guaranteed to produce 0 rows. If there's only one branch left, it replaces the UnionNode with a projection to preserve the outputs of the union. If all branches are empty, it replaces the UnionNode with an empty ValuesNode
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.trino.sql.planner.iterative.Rule
Rule.Context, Rule.Result
-
-
Constructor Summary
Constructors Constructor Description RemoveEmptyUnionBranches()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rule.Resultapply(UnionNode node, Captures captures, Rule.Context context)Pattern<UnionNode>getPattern()Returns a pattern to which plan nodes this rule applies.
-
-
-
Method Detail
-
getPattern
public Pattern<UnionNode> getPattern()
Description copied from interface:RuleReturns a pattern to which plan nodes this rule applies.- Specified by:
getPatternin interfaceRule<UnionNode>
-
apply
public Rule.Result apply(UnionNode node, Captures captures, Rule.Context context)
-
-