java.lang.Object
org.apache.calcite.plan.RelOptRule
org.apache.calcite.plan.RelRule<C>
org.apache.flink.table.planner.plan.rules.logical.FlinkFilterJoinRule<C>
All Implemented Interfaces:
org.apache.calcite.rel.rules.TransformationRule
Direct Known Subclasses:
FlinkFilterJoinRule.FlinkFilterIntoJoinRule, FlinkFilterJoinRule.FlinkJoinConditionPushRule

public abstract class FlinkFilterJoinRule<C extends FlinkFilterJoinRule.Config> extends org.apache.calcite.plan.RelRule<C> implements org.apache.calcite.rel.rules.TransformationRule
Planner rule that pushes filters above and within a join node into the join node and/or its children nodes.

This rule is copied from FilterJoinRule.

Different from FilterJoinRule, this rule can handle more cases: for the above filter of inner/left/right join or the join condition of inner join, the predicate which field references are all from one side join condition can be pushed into another join side. Such as:

  • SELECT * FROM MyTable1 join MyTable2 ON a1 = a2 AND a1 = 2
  • SELECT * FROM MyTable1, MyTable2 WHERE a1 = a2 AND a1 = 2
    • Nested Class Summary

      Nested Classes
      Modifier and Type
      Class
      Description
      static interface 
      Rule configuration.
      static class 
      Rule that tries to push filter expressions into a join condition and into the inputs of the join.
      static class 
      Rule that pushes parts of the join condition to its inputs.
      static interface 
      Predicate that returns whether a filter is valid in the ON clause of a join for this particular kind of join.

      Nested classes/interfaces inherited from class org.apache.calcite.plan.RelRule

      org.apache.calcite.plan.RelRule.Done, org.apache.calcite.plan.RelRule.MatchHandler<R extends org.apache.calcite.plan.RelOptRule>, org.apache.calcite.plan.RelRule.OperandBuilder, org.apache.calcite.plan.RelRule.OperandDetailBuilder<R extends org.apache.calcite.rel.RelNode>, org.apache.calcite.plan.RelRule.OperandTransform

      Nested classes/interfaces inherited from class org.apache.calcite.plan.RelOptRule

      org.apache.calcite.plan.RelOptRule.ConverterRelOptRuleOperand
    • Field Summary

      Fields
      Modifier and Type
      Field
      Description
       
       
      static final Set<org.apache.calcite.sql.SqlKind>
       

      Fields inherited from class org.apache.calcite.plan.RelRule

      config

      Fields inherited from class org.apache.calcite.plan.RelOptRule

      description, operands, relBuilderFactory
    • Constructor Summary

      Constructors
      Modifier
      Constructor
      Description
      protected
      Creates a FilterJoinRule.
    • Method Summary

      Modifier and Type
      Method
      Description
      protected boolean
      isEventTimeTemporalJoin(org.apache.calcite.rex.RexNode joinCondition)
       
      protected void
      perform(org.apache.calcite.plan.RelOptRuleCall call, org.apache.calcite.rel.core.Filter filter, org.apache.calcite.rel.core.Join join)
       
      protected void
      validateJoinFilters(List<org.apache.calcite.rex.RexNode> aboveFilters, List<org.apache.calcite.rex.RexNode> joinFilters, org.apache.calcite.rel.core.Join join, org.apache.calcite.rel.core.JoinRelType joinType)
      Validates that target execution framework can satisfy join filters.

      Methods inherited from class org.apache.calcite.plan.RelOptRule

      any, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, onMatch, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered

      Methods inherited from class java.lang.Object

      clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Details

    • Constructor Details

      • FlinkFilterJoinRule

        protected FlinkFilterJoinRule(C config)
        Creates a FilterJoinRule.
    • Method Details

      • perform

        protected void perform(org.apache.calcite.plan.RelOptRuleCall call, org.apache.calcite.rel.core.Filter filter, org.apache.calcite.rel.core.Join join)
      • validateJoinFilters

        protected void validateJoinFilters(List<org.apache.calcite.rex.RexNode> aboveFilters, List<org.apache.calcite.rex.RexNode> joinFilters, org.apache.calcite.rel.core.Join join, org.apache.calcite.rel.core.JoinRelType joinType)
        Validates that target execution framework can satisfy join filters.

        If the join filter cannot be satisfied (for example, if it is l.c1 > r.c2 and the join only supports equi-join), removes the filter from joinFilters and adds it to aboveFilters.

        The default implementation does nothing; i.e. the join can handle all conditions.

        Parameters:
        aboveFilters - Filter above Join
        joinFilters - Filters in join condition
        join - Join
        joinType - JoinRelType could be different from type in Join due to outer join simplification.
      • isEventTimeTemporalJoin

        protected boolean isEventTimeTemporalJoin(org.apache.calcite.rex.RexNode joinCondition)