Package org.apache.calcite.rel.rules
Class FilterJoinRule<C extends FilterJoinRule.Config>
java.lang.Object
org.apache.calcite.plan.RelOptRule
org.apache.calcite.plan.RelRule<C>
org.apache.calcite.rel.rules.FilterJoinRule<C>
- Type Parameters:
C
- Configuration type
- All Implemented Interfaces:
TransformationRule
- Direct Known Subclasses:
FilterJoinRule.FilterIntoJoinRule
,FilterJoinRule.JoinConditionPushRule
public abstract class FilterJoinRule<C extends FilterJoinRule.Config>
extends RelRule<C>
implements TransformationRule
Planner rule that pushes filters above and
within a join node into the join node and/or its children nodes.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic 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
RelRule.Done, RelRule.MatchHandler<R extends RelOptRule>, RelRule.OperandBuilder, RelRule.OperandDetailBuilder<R extends RelNode>, RelRule.OperandTransform
Nested classes/interfaces inherited from class org.apache.calcite.plan.RelOptRule
RelOptRule.ConverterRelOptRuleOperand
-
Field Summary
Fields inherited from class org.apache.calcite.plan.RelOptRule
description, operands, relBuilderFactory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioninferJoinEqualConditions
(List<RexNode> rexNodes, Join join) Infers more equal conditions for the join condition.protected void
perform
(RelOptRuleCall call, @Nullable Filter filter, Join join) protected void
validateJoinFilters
(List<RexNode> aboveFilters, 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, 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 Details
-
TRUE_PREDICATE
Deprecated.Predicate that always returns true. With this predicate, every filter will be pushed into the ON clause.
-
-
Constructor Details
-
FilterJoinRule
Creates a FilterJoinRule.
-
-
Method Details
-
perform
-
inferJoinEqualConditions
Infers more equal conditions for the join condition.For example, in
SELECT * FROM T1, T2, T3 WHERE T1.id = T3.id AND T2.id = T3.id
, we can inferT1.id = T2.id
for the first Join node from second Join node's condition:T1.id = T3.id AND T2.id = T3.id
.For the above SQL, the second Join's condition is
T1.id = T3.id AND T2.id = T3.id
. After inference, the final condition would be:T1.id = T2.id AND T1.id = T3.id
, theT1.id = T2.id
can be further pushed into LHS.- Parameters:
rexNodes
- the Join conditionjoin
- the Join node- Returns:
- the newly inferred conditions
-
validateJoinFilters
protected void validateJoinFilters(List<RexNode> aboveFilters, 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.
-