@Immutable public class ChooseJoinAlgorithm extends Object implements OptimizerRule
optimizer rule
that choose the appropriate join algorithm and sets up any prerequisites, based upon
the JoinCondition
.
There are two static instances that can be used (or the equivalent can be instantiated or subclassed using the constructor):
one that only uses nested-loop
, and another that will attempt to use
merge
where possible. Both instances ignore any existing PlanNode.Property.JOIN_ALGORITHM
property
value set on the JOIN node.
For example, the USE_ONLY_NESTED_JOIN_ALGORITHM
instance will convert this simple tree:
... | JOIN / \ ... ...into this:
... | JOIN (On the other hand, theJOIN_ALGORITHM
=NESTED_LOOP
) / \ ... ...
USE_BEST_JOIN_ALGORITHM
instance will do a couple of different things, depending upon the input
plan.
DescendantNodeJoinCondition
, then the join algorithm will always be
JoinAlgorithm.NESTED_LOOP
.JoinAlgorithm.MERGE
algorithm and will change this structure:
... | JOIN / \ ... ...into this:
... | JOIN (JOIN_ALGORITHM
=MERGE
) / \ / \ DUP_REMOVE DUP_REMOVE | | SORT SORT | | ... ...
Modifier and Type | Field and Description |
---|---|
static ChooseJoinAlgorithm |
USE_BEST_JOIN_ALGORITHM |
static ChooseJoinAlgorithm |
USE_ONLY_NESTED_JOIN_ALGORITHM |
Modifier | Constructor and Description |
---|---|
protected |
ChooseJoinAlgorithm(boolean useOnlyNested) |
Modifier and Type | Method and Description |
---|---|
protected void |
createOrderBysForJoinCondition(JoinCondition condition,
Set<SelectorName> leftSelectors,
List<Object> leftSortBy,
Set<SelectorName> rightSelectors,
List<Object> rightSortBy) |
PlanNode |
execute(QueryContext context,
PlanNode plan,
LinkedList<OptimizerRule> ruleStack)
Optimize the supplied plan using the supplied context, hints, and yet-to-be-run rules.
|
String |
toString() |
public static final ChooseJoinAlgorithm USE_ONLY_NESTED_JOIN_ALGORITHM
public static final ChooseJoinAlgorithm USE_BEST_JOIN_ALGORITHM
public PlanNode execute(QueryContext context, PlanNode plan, LinkedList<OptimizerRule> ruleStack)
OptimizerRule
execute
in interface OptimizerRule
context
- the context in which the query is being optimized; never nullplan
- the plan to be optimized; never nullruleStack
- the stack of rules that will be run after this rule; never nullprotected void createOrderBysForJoinCondition(JoinCondition condition, Set<SelectorName> leftSelectors, List<Object> leftSortBy, Set<SelectorName> rightSelectors, List<Object> rightSortBy)
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.