Package org.apache.calcite.test
Class MockRelOptPlanner
java.lang.Object
org.apache.calcite.plan.AbstractRelOptPlanner
org.apache.calcite.test.MockRelOptPlanner
- All Implemented Interfaces:
RelOptPlanner
MockRelOptPlanner is a mock implementation of the
RelOptPlanner
interface.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.plan.RelOptPlanner
RelOptPlanner.CannotPlanException, RelOptPlanner.Executor
-
Field Summary
Fields inherited from class org.apache.calcite.plan.AbstractRelOptPlanner
cancelFlag, context, costFactory, mapDescToRule
Fields inherited from interface org.apache.calcite.plan.RelOptPlanner
LOGGER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addRule
(RelOptRule rule) Registers a rule.changeTraits
(RelNode rel, RelTraitSet toTraits) Changes a relational expression to an equivalent one with a different set of traits.void
clear()
Removes all internal state, including all registered rules, materialized views, and lattices.ensureRegistered
(RelNode rel, RelNode equivRel) Registers a relational expression if it is not already registered.Finds the most efficient expression to implement this query.long
Deprecated.@Nullable RelNode
getRoot()
Returns the root node of this query.getRules()
Returns the list of all registered rules.boolean
isRegistered
(RelNode rel) Determines whether a relational expression has been registered.Registers a relational expression in the expression bank.boolean
removeRule
(RelOptRule rule) Removes a rule.void
setRelMetadataTimestamp
(long metadataTimestamp) Deprecated.void
Sets the root node of this query.Methods inherited from class org.apache.calcite.plan.AbstractRelOptPlanner
addLattice, addListener, addMaterialization, addRelTraitDef, checkCancel, chooseDelegate, clearRelTraitDefs, dumpRuleAttemptsInfo, emptyTraitSet, fireRule, getContext, getCost, getCost, getCostFactory, getExecutor, getLattice, getListener, getMaterializations, getRelTraitDefs, getRuleByDescription, isRuleExcluded, notifyChosen, notifyDiscard, notifyEquivalence, notifyTransformation, onCopy, onNewClass, prune, registerClass, registerMetadataProviders, registerSchema, setCancelFlag, setExecutor, setRuleDescExclusionFilter, subClasses
-
Constructor Details
-
MockRelOptPlanner
Creates MockRelOptPlanner.
-
-
Method Details
-
setRoot
Description copied from interface:RelOptPlanner
Sets the root node of this query.- Parameters:
rel
- Relational expression
-
getRoot
Description copied from interface:RelOptPlanner
Returns the root node of this query.- Returns:
- Root node
-
clear
public void clear()Description copied from interface:RelOptPlanner
Removes all internal state, including all registered rules, materialized views, and lattices.- Specified by:
clear
in interfaceRelOptPlanner
- Overrides:
clear
in classAbstractRelOptPlanner
-
getRules
Description copied from interface:RelOptPlanner
Returns the list of all registered rules.- Specified by:
getRules
in interfaceRelOptPlanner
- Overrides:
getRules
in classAbstractRelOptPlanner
-
addRule
Description copied from interface:RelOptPlanner
Registers a rule.If the rule has already been registered, does nothing. This method determines if the given rule is a
ConverterRule
and pass the ConverterRule to allregistered
RelTraitDef instances.- Specified by:
addRule
in interfaceRelOptPlanner
- Overrides:
addRule
in classAbstractRelOptPlanner
- Returns:
- whether the rule was added, as per
Collection.add(E)
-
removeRule
Description copied from interface:RelOptPlanner
Removes a rule.- Specified by:
removeRule
in interfaceRelOptPlanner
- Overrides:
removeRule
in classAbstractRelOptPlanner
- Returns:
- true if the rule was present, as per
Collection.remove(Object)
-
changeTraits
Description copied from interface:RelOptPlanner
Changes a relational expression to an equivalent one with a different set of traits.- Parameters:
rel
- Relational expression (may or may not have been registered; must not have the desired traits)toTraits
- Trait set to convert the relational expression to- Returns:
- Relational expression with desired traits. Never null, but may be abstract
-
findBestExp
Description copied from interface:RelOptPlanner
Finds the most efficient expression to implement this query. -
register
Description copied from interface:RelOptPlanner
Registers a relational expression in the expression bank.After it has been registered, you may not modify it.
The expression must not already have been registered. If you are not sure whether it has been registered, call
RelOptPlanner.ensureRegistered(RelNode, RelNode)
.- Parameters:
rel
- Relational expression to register (must not already be registered)equivRel
- Relational expression it is equivalent to (may be null)- Returns:
- the same expression, or an equivalent existing expression
-
ensureRegistered
Description copied from interface:RelOptPlanner
Registers a relational expression if it is not already registered.If
equivRel
is specified,rel
is placed in the same equivalence set. It is OK ifequivRel
has different traits;rel
will end up in a different subset of the same set.It is OK if
rel
is a subset.- Parameters:
rel
- Relational expression to registerequivRel
- Relational expression it is equivalent to (may be null)- Returns:
- Registered relational expression
-
isRegistered
Description copied from interface:RelOptPlanner
Determines whether a relational expression has been registered.- Parameters:
rel
- expression to test- Returns:
- whether rel has been registered
-
getRelMetadataTimestamp
Deprecated.Description copied from interface:RelOptPlanner
Gets a timestamp for a given rel's metadata. This timestamp is used byCachingRelMetadataProvider
to decide whether cached metadata has gone stale.- Specified by:
getRelMetadataTimestamp
in interfaceRelOptPlanner
- Overrides:
getRelMetadataTimestamp
in classAbstractRelOptPlanner
- Parameters:
rel
- rel of interest- Returns:
- timestamp of last change which might affect metadata derivation
-
setRelMetadataTimestamp
Deprecated.
-