Class PruneEmptyRules

java.lang.Object
org.apache.calcite.rel.rules.PruneEmptyRules

public abstract class PruneEmptyRules extends 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.

See Also:
  • Field Details

    • UNION_INSTANCE

      public static final RelOptRule UNION_INSTANCE
      Rule that removes empty children of a Union.

      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 a Minus.

      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 a Intersect to empty if any of its children are empty.

      Examples:

      • Intersect(Rel, Empty, Rel2) becomes Empty
      • Intersect(Empty, Rel) becomes Empty
    • EMPTY_TABLE_INSTANCE

      public static final RelOptRule EMPTY_TABLE_INSTANCE
      Rule that converts a TableScan 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

      public static final RelOptRule PROJECT_INSTANCE
      Rule that converts a Project to empty if its child is empty.

      Examples:

      • Project(Empty) becomes Empty
    • FILTER_INSTANCE

      public static final RelOptRule FILTER_INSTANCE
      Rule that converts a Filter to empty if its child is empty.

      Examples:

      • Filter(Empty) becomes Empty
    • SORT_INSTANCE

      public static final RelOptRule SORT_INSTANCE
      Rule that converts a Sort to empty if its child is empty.

      Examples:

      • Sort(Empty) becomes Empty
    • SORT_FETCH_ZERO_INSTANCE

      public static final RelOptRule SORT_FETCH_ZERO_INSTANCE
      Rule that converts a Sort to empty if it has LIMIT 0.

      Examples:

      • Sort[fetch=0] becomes Empty
    • AGGREGATE_INSTANCE

      public static final RelOptRule AGGREGATE_INSTANCE
      Rule that converts an Aggregate 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

      public static final RelOptRule JOIN_LEFT_INSTANCE
      Rule that converts a Join 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

      public static final RelOptRule JOIN_RIGHT_INSTANCE
      Rule that converts a Join 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

      public static final RelOptRule CORRELATE_RIGHT_INSTANCE
      Rule that converts a Correlate 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

      public static final RelOptRule CORRELATE_LEFT_INSTANCE
      Rule that converts a Correlate to empty if its left child is empty.
  • Constructor Details

    • PruneEmptyRules

      public PruneEmptyRules()