Package org.apache.calcite.rel.rules
Class PruneEmptyRules
- java.lang.Object
-
- org.apache.calcite.rel.rules.PruneEmptyRules
-
public abstract class PruneEmptyRules extends java.lang.Object
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 Classes Modifier and Type Class Description static class
PruneEmptyRules.RemoveEmptySingleRule
Planner rule that converts a single-rel (e.g.
-
Field Summary
Fields Modifier and Type Field Description static RelOptRule
AGGREGATE_INSTANCE
Rule that converts anAggregate
to empty if its child is empty.static RelOptRule
FILTER_INSTANCE
Rule that converts aLogicalFilter
to empty if its child is empty.static RelOptRule
INTERSECT_INSTANCE
Rule that converts aLogicalIntersect
to empty if any of its children are empty.static RelOptRule
JOIN_LEFT_INSTANCE
Rule that converts aJoin
to empty if its left child is empty.static RelOptRule
JOIN_RIGHT_INSTANCE
Rule that converts aJoin
to empty if its right child is empty.static RelOptRule
MINUS_INSTANCE
Rule that removes empty children of aLogicalMinus
.static RelOptRule
PROJECT_INSTANCE
Rule that converts aLogicalProject
to empty if its child is empty.static RelOptRule
SORT_FETCH_ZERO_INSTANCE
Rule that converts aSort
to empty if it hasLIMIT 0
.static RelOptRule
SORT_INSTANCE
Rule that converts aSort
to empty if its child is empty.static RelOptRule
UNION_INSTANCE
Rule that removes empty children of aLogicalUnion
.
-
Constructor Summary
Constructors Constructor Description PruneEmptyRules()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static boolean
isEmpty(RelNode node)
-
-
-
Field Detail
-
UNION_INSTANCE
public static final RelOptRule UNION_INSTANCE
Rule that removes empty children of aLogicalUnion
.Examples:
- Union(Rel, Empty, Rel2) becomes Union(Rel, Rel2)
- Union(Rel, Empty, Empty) becomes Rel
- Union(Empty, Empty) becomes Empty
-
MINUS_INSTANCE
public static final RelOptRule MINUS_INSTANCE
Rule that removes empty children of aLogicalMinus
.Examples:
- Minus(Rel, Empty, Rel2) becomes Minus(Rel, Rel2)
- Minus(Empty, Rel) becomes Empty
-
INTERSECT_INSTANCE
public static final RelOptRule INTERSECT_INSTANCE
Rule that converts aLogicalIntersect
to empty if any of its children are empty.Examples:
- Intersect(Rel, Empty, Rel2) becomes Empty
- Intersect(Empty, Rel) becomes Empty
-
PROJECT_INSTANCE
public static final RelOptRule PROJECT_INSTANCE
Rule that converts aLogicalProject
to empty if its child is empty.Examples:
- Project(Empty) becomes Empty
-
FILTER_INSTANCE
public static final RelOptRule FILTER_INSTANCE
Rule that converts aLogicalFilter
to empty if its child is empty.Examples:
- Filter(Empty) becomes Empty
-
SORT_INSTANCE
public static final RelOptRule SORT_INSTANCE
-
SORT_FETCH_ZERO_INSTANCE
public static final RelOptRule SORT_FETCH_ZERO_INSTANCE
-
AGGREGATE_INSTANCE
public static final RelOptRule 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:
AggregateValuesRule
-
JOIN_LEFT_INSTANCE
public static final RelOptRule JOIN_LEFT_INSTANCE
Rule that converts aJoin
to empty if its left child is empty.Examples:
- Join(Empty, Scan(Dept), INNER) becomes Empty
-
JOIN_RIGHT_INSTANCE
public static final RelOptRule JOIN_RIGHT_INSTANCE
Rule that converts aJoin
to empty if its right child is empty.Examples:
- Join(Scan(Emp), Empty, INNER) becomes Empty
-
-
Method Detail
-
isEmpty
private static boolean isEmpty(RelNode node)
-
-