Package org.apache.calcite.rel.rules
Class PruneEmptyRules
java.lang.Object
org.apache.calcite.rel.rules.PruneEmptyRules
Collection of rules which remove sections of a query plan known never to
produce any rows.
Conventionally, the way to represent an empty relational expression is
with a Values that has no tuples.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceConfiguration for rule that prunes a correlate if its left input is empty.static interfaceConfiguration for rule that prunes a correlate if its right input is empty.static interfaceConfiguration for a rule that prunes an Intersect if any of its inputs is empty.static interfaceConfiguration for rule that prunes a join it its left input is empty.static interfaceConfiguration for rule that prunes a join it its right input is empty.static interfaceConfiguration for a rule that prunes empty inputs from a Minus.protected static classAbstract prune empty rule that implements SubstitutionRule interface.static classRule that converts a relation into empty.static interfaceConfiguration for a rule that prunes a Sort if it has limit 0.static interfaceConfiguration for a rule that prunes empty inputs from a Minus.static interfaceConfiguration for rule that transforms an empty relational expression into an empty values. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RelOptRuleRule that converts anAggregateto empty if its child is empty.static final RelOptRuleRule that converts aCorrelateto empty if its left child is empty.static final RelOptRuleRule that converts aCorrelateto empty if its right child is empty.static final RelOptRuleRule that converts aTableScanto empty if the table has no rows in it.static final RelOptRuleRule that converts aFilterto empty if its child is empty.static final RelOptRuleRule that converts aIntersectto empty if any of its children are empty.static final RelOptRuleRule that converts aJointo empty if its left child is empty.static final RelOptRuleRule that converts aJointo empty if its right child is empty.static final RelOptRuleRule that removes empty children of aMinus.static final RelOptRuleRule that converts aProjectto empty if its child is empty.static final RelOptRuleRule that converts aSortto empty if it hasLIMIT 0.static final RelOptRuleRule that converts aSortto empty if its child is empty.static final RelOptRuleRule that removes empty children of aUnion. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
UNION_INSTANCE
Rule that removes empty children of aUnion.Examples:
- Union(Rel, Empty, Rel2) becomes Union(Rel, Rel2)
- Union(Rel, Empty, Empty) becomes Rel
- Union(Empty, Empty) becomes Empty
-
MINUS_INSTANCE
Rule that removes empty children of aMinus.Examples:
- Minus(Rel, Empty, Rel2) becomes Minus(Rel, Rel2)
- Minus(Empty, Rel) becomes Empty
-
INTERSECT_INSTANCE
Rule that converts aIntersectto empty if any of its children are empty.Examples:
- Intersect(Rel, Empty, Rel2) becomes Empty
- Intersect(Empty, Rel) becomes Empty
-
EMPTY_TABLE_INSTANCE
Rule that converts aTableScanto empty if the table has no rows in it.The rule exploits the
RelMdMaxRowCountto derive if the table is empty or not. -
PROJECT_INSTANCE
-
FILTER_INSTANCE
-
SORT_INSTANCE
-
SORT_FETCH_ZERO_INSTANCE
-
AGGREGATE_INSTANCE
Rule that converts anAggregateto empty if its child is empty.Examples:
Aggregate(key: [1, 3], Empty)→EmptyAggregate(key: [], Empty)is unchanged, because an aggregate without a GROUP BY key always returns 1 row, even over empty input
- See Also:
-
JOIN_LEFT_INSTANCE
Rule that converts aJointo empty if its left child is empty.Examples:
- Join(Empty, Scan(Dept), INNER) becomes Empty
- Join(Empty, Scan(Dept), LEFT) becomes Empty
- Join(Empty, Scan(Dept), SEMI) becomes Empty
- Join(Empty, Scan(Dept), ANTI) becomes Empty
-
JOIN_RIGHT_INSTANCE
Rule that converts aJointo empty if its right child is empty.Examples:
- Join(Scan(Emp), Empty, INNER) becomes Empty
- Join(Scan(Emp), Empty, RIGHT) becomes Empty
- Join(Scan(Emp), Empty, SEMI) becomes Empty
- Join(Scan(Emp), Empty, ANTI) becomes Scan(Emp)
-
CORRELATE_RIGHT_INSTANCE
Rule that converts aCorrelateto empty if its right child is empty.Examples:
- Correlate(Scan(Emp), Empty, INNER) becomes Empty
- Correlate(Scan(Emp), Empty, SEMI) becomes Empty
- Correlate(Scan(Emp), Empty, ANTI) becomes Scan(Emp)
- Correlate(Scan(Emp), Empty, LEFT) becomes Project(Scan(Emp)) where the Project adds additional typed null columns to match the join type output.
-
CORRELATE_LEFT_INSTANCE
Rule that converts aCorrelateto empty if its left child is empty.
-
-
Constructor Details
-
PruneEmptyRules
public PruneEmptyRules()
-