@Value.Enclosing public class FlinkBushyJoinReorderRule extends org.apache.calcite.plan.RelRule<FlinkBushyJoinReorderRule.Config> implements org.apache.calcite.rel.rules.TransformationRule
MultiJoin
to a bushy join tree.
In this bushy join reorder strategy, the join reorder step is as follows:
First step, we will reorder all the inner join type inputs in the multiJoin. We adopt the
concept of level in dynamic programming, and the latter layer will use the results stored in the
previous levels. First, we put all input factor (each input factor in MultiJoin
) into
level 0, then we build all two-inputs join at level 1 based on the FlinkCost
of level 0,
then we will build three-inputs join based on the previous two levels, then four-inputs joins ...
etc, util we reorder all the inner join type input factors in the multiJoin. When building
m-inputs join, we only keep the best plan (have the lowest FlinkCost
) for the same set of
m inputs. E.g., for three-inputs join, we keep only the best plan for inputs {A, B, C} among
plans (A J B) J C, (A J C) J B, (B J C) J A.
Second step, we will add all outer join factors to the top of reordered join tree generated by the first step. E.g., for the example (((A LJ B) IJ C) IJ D). we will first reorder A, C and D using the first step strategy, get ((A IJ C) IJ D). Then, we will add B to the top, get (((A IJ C) IJ D) LJ B).
Third step, we will add all cross join factors whose join condition is true to the top in the final step.
Modifier and Type | Class and Description |
---|---|
static interface |
FlinkBushyJoinReorderRule.Config
Rule configuration.
|
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
Modifier | Constructor and Description |
---|---|
protected |
FlinkBushyJoinReorderRule(FlinkBushyJoinReorderRule.Config config)
Creates a FlinkBushyJoinReorderRule.
|
|
FlinkBushyJoinReorderRule(org.apache.calcite.tools.RelBuilderFactory relBuilderFactory)
Deprecated.
|
|
FlinkBushyJoinReorderRule(org.apache.calcite.rel.core.RelFactories.JoinFactory joinFactory,
org.apache.calcite.rel.core.RelFactories.ProjectFactory projectFactory,
org.apache.calcite.rel.core.RelFactories.FilterFactory filterFactory)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
onMatch(org.apache.calcite.plan.RelOptRuleCall call) |
any, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered
protected FlinkBushyJoinReorderRule(FlinkBushyJoinReorderRule.Config config)
@Deprecated public FlinkBushyJoinReorderRule(org.apache.calcite.tools.RelBuilderFactory relBuilderFactory)
@Deprecated public FlinkBushyJoinReorderRule(org.apache.calcite.rel.core.RelFactories.JoinFactory joinFactory, org.apache.calcite.rel.core.RelFactories.ProjectFactory projectFactory, org.apache.calcite.rel.core.RelFactories.FilterFactory filterFactory)
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.