Package org.apache.calcite.rel.rules
Class FilterJoinRule
- java.lang.Object
-
- org.apache.calcite.plan.RelOptRule
-
- org.apache.calcite.rel.rules.FilterJoinRule
-
- Direct Known Subclasses:
FilterJoinRule.FilterIntoJoinRule
,FilterJoinRule.JoinConditionPushRule
public abstract class FilterJoinRule extends RelOptRule
Planner rule that pushes filters above and within a join node into the join node and/or its children nodes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FilterJoinRule.FilterIntoJoinRule
Rule that tries to push filter expressions into a join condition and into the inputs of the join.static class
FilterJoinRule.JoinConditionPushRule
Rule that pushes parts of the join condition to its inputs.static interface
FilterJoinRule.Predicate
Predicate that returns whether a filter is valid in the ON clause of a join for this particular kind of join.
-
Field Summary
Fields Modifier and Type Field Description static FilterJoinRule
DUMB_FILTER_ON_JOIN
Dumber version ofFILTER_ON_JOIN
.static FilterJoinRule
FILTER_ON_JOIN
Rule that pushes predicates from a Filter into the Join below them.static FilterJoinRule
JOIN
Rule that pushes predicates in a Join into the inputs to the join.private FilterJoinRule.Predicate
predicate
Predicate that returns whether a filter is valid in the ON clause of a join for this particular kind of join.private boolean
smart
Whether to try to strengthen join-type.static FilterJoinRule.Predicate
TRUE_PREDICATE
Predicate that always returns true.-
Fields inherited from class org.apache.calcite.plan.RelOptRule
description, operands, relBuilderFactory
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FilterJoinRule(RelOptRuleOperand operand, java.lang.String id, boolean smart, RelFactories.FilterFactory filterFactory, RelFactories.ProjectFactory projectFactory)
Deprecated.protected
FilterJoinRule(RelOptRuleOperand operand, java.lang.String id, boolean smart, RelFactories.FilterFactory filterFactory, RelFactories.ProjectFactory projectFactory, FilterJoinRule.Predicate predicate)
Deprecated.protected
FilterJoinRule(RelOptRuleOperand operand, java.lang.String id, boolean smart, RelBuilderFactory relBuilderFactory, FilterJoinRule.Predicate predicate)
Creates a FilterProjectTransposeRule with an explicit root operand and factories.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
perform(RelOptRuleCall call, Filter filter, Join join)
protected void
validateJoinFilters(java.util.List<RexNode> aboveFilters, java.util.List<RexNode> joinFilters, Join join, 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
-
-
-
-
Field Detail
-
TRUE_PREDICATE
public static final FilterJoinRule.Predicate TRUE_PREDICATE
Predicate that always returns true. With this predicate, every filter will be pushed into the ON clause.
-
FILTER_ON_JOIN
public static final FilterJoinRule FILTER_ON_JOIN
Rule that pushes predicates from a Filter into the Join below them.
-
DUMB_FILTER_ON_JOIN
public static final FilterJoinRule DUMB_FILTER_ON_JOIN
Dumber version ofFILTER_ON_JOIN
. Not intended for production use, but keeps some tests working for whichFILTER_ON_JOIN
is too smart.
-
JOIN
public static final FilterJoinRule JOIN
Rule that pushes predicates in a Join into the inputs to the join.
-
smart
private final boolean smart
Whether to try to strengthen join-type.
-
predicate
private final FilterJoinRule.Predicate predicate
Predicate that returns whether a filter is valid in the ON clause of a join for this particular kind of join. If not, Calcite will push it back to above the join.
-
-
Constructor Detail
-
FilterJoinRule
protected FilterJoinRule(RelOptRuleOperand operand, java.lang.String id, boolean smart, RelBuilderFactory relBuilderFactory, FilterJoinRule.Predicate predicate)
Creates a FilterProjectTransposeRule with an explicit root operand and factories.
-
FilterJoinRule
@Deprecated protected FilterJoinRule(RelOptRuleOperand operand, java.lang.String id, boolean smart, RelFactories.FilterFactory filterFactory, RelFactories.ProjectFactory projectFactory)
Deprecated.Creates a FilterJoinRule with an explicit root operand and factories.
-
FilterJoinRule
@Deprecated protected FilterJoinRule(RelOptRuleOperand operand, java.lang.String id, boolean smart, RelFactories.FilterFactory filterFactory, RelFactories.ProjectFactory projectFactory, FilterJoinRule.Predicate predicate)
Deprecated.Creates a FilterProjectTransposeRule with an explicit root operand and factories.
-
-
Method Detail
-
perform
protected void perform(RelOptRuleCall call, Filter filter, Join join)
-
validateJoinFilters
protected void validateJoinFilters(java.util.List<RexNode> aboveFilters, java.util.List<RexNode> joinFilters, Join join, 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 fromjoinFilters
and adds it toaboveFilters
.The default implementation does nothing; i.e. the join can handle all conditions.
- Parameters:
aboveFilters
- Filter above JoinjoinFilters
- Filters in join conditionjoin
- JoinjoinType
- JoinRelType could be different from type in Join due to outer join simplification.
-
-