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
Modifier and TypeClassDescriptionstatic interface
Configuration for rule that prunes a correlate if its left input is empty.static interface
Configuration for rule that prunes a correlate if its right input is empty.static interface
Configuration for a rule that prunes an Intersect if any of its inputs is empty.static interface
Configuration for rule that prunes a join it its left input is empty.static interface
Configuration for rule that prunes a join it its right input is empty.static interface
Configuration for a rule that prunes empty inputs from a Minus.protected static class
Abstract prune empty rule that implements SubstitutionRule interface.static class
Rule that converts a relation into empty.static interface
Configuration for a rule that prunes a Sort if it has limit 0.static interface
Configuration for a rule that prunes empty inputs from a Minus.static interface
Configuration for rule that transforms an empty relational expression into an empty values. -
Field Summary
Modifier and TypeFieldDescriptionstatic final RelOptRule
Rule that converts anAggregate
to empty if its child is empty.static final RelOptRule
Rule that converts aCorrelate
to empty if its left child is empty.static final RelOptRule
Rule that converts aCorrelate
to empty if its right child is empty.static final RelOptRule
Rule that converts aTableScan
to empty if the table has no rows in it.static final RelOptRule
Rule that converts aFilter
to empty if its child is empty.static final RelOptRule
Rule that converts aIntersect
to empty if any of its children are empty.static final RelOptRule
Rule that converts aJoin
to empty if its left child is empty.static final RelOptRule
Rule that converts aJoin
to empty if its right child is empty.static final RelOptRule
Rule that removes empty children of aMinus
.static final RelOptRule
Rule that converts aProject
to empty if its child is empty.static final RelOptRule
Rule that converts aSort
to empty if it hasLIMIT 0
.static final RelOptRule
Rule that converts aSort
to empty if its child is empty.static final RelOptRule
Rule that removes empty children of aUnion
. -
Constructor Summary
-
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 aIntersect
to 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 aTableScan
to empty if the table has no rows in it.The rule exploits the
RelMdMaxRowCount
to derive if the table is empty or not. -
PROJECT_INSTANCE
-
FILTER_INSTANCE
-
SORT_INSTANCE
-
SORT_FETCH_ZERO_INSTANCE
-
AGGREGATE_INSTANCE
Rule that converts anAggregate
to empty if its child is empty.Examples:
Aggregate(key: [1, 3], Empty)
→Empty
Aggregate(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 aJoin
to 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 aJoin
to 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 aCorrelate
to 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 aCorrelate
to empty if its left child is empty.
-
-
Constructor Details
-
PruneEmptyRules
public PruneEmptyRules()
-