Class HepPlanner
- All Implemented Interfaces:
RelOptPlanner
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, mapDescToRuleFields inherited from interface org.apache.calcite.plan.RelOptPlanner
LOGGER -
Constructor Summary
ConstructorsConstructorDescriptionHepPlanner(HepProgram program) Creates a new HepPlanner that allows DAG.HepPlanner(HepProgram program, @Nullable Context context) Creates a new HepPlanner that allows DAG.HepPlanner(HepProgram program, @Nullable Context context, boolean noDag, @Nullable Function2<RelNode, RelNode, Void> onCopyHook, RelOptCostFactory costFactory) Creates a new HepPlanner with the option to keep the graph a tree (noDag = true) or allow DAG (noDag = false). -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMaterialization(RelOptMaterialization materialization) Defines a pair of relational expressions that are equivalent.changeTraits(RelNode rel, RelTraitSet toTraits) Changes a relational expression to an equivalent one with a different set of traits.voidclear()Removes all internal state, including all registered rules, materialized views, and lattices.ensureRegistered(RelNode rel, @Nullable RelNode equivRel) Registers a relational expression if it is not already registered.Finds the most efficient expression to implement this query.com.google.common.collect.ImmutableList<RelOptMaterialization>Returns the materializations that have been registered with the planner.longDeprecated.@Nullable RelNodegetRoot()Returns the root node of this query.booleanisRegistered(RelNode rel) Determines whether a relational expression has been registered.voidCalled when a relational expression is copied to a similar expression.Registers a relational expression in the expression bank.voidDeprecated.voidSets the root node of this query.Methods inherited from class org.apache.calcite.plan.AbstractRelOptPlanner
addLattice, addListener, addRelTraitDef, addRule, checkCancel, chooseDelegate, clearRelTraitDefs, dumpRuleAttemptsInfo, emptyTraitSet, fireRule, getContext, getCost, getCost, getCostFactory, getDecorrelator, getExecutor, getLattice, getListener, getRelTraitDefs, getRuleByDescription, getRules, isRuleExcluded, notifyChosen, notifyDiscard, notifyEquivalence, notifyTransformation, onNewClass, prune, registerClass, registerSchema, removeRule, setCancelFlag, setDecorrelator, setExecutor, setRuleDescExclusionFilter, subClasses
-
Constructor Details
-
HepPlanner
Creates a new HepPlanner that allows DAG.- Parameters:
program- program controlling rule application
-
HepPlanner
Creates a new HepPlanner that allows DAG.- Parameters:
program- program controlling rule applicationcontext- to carry while planning
-
HepPlanner
public HepPlanner(HepProgram program, @Nullable Context context, boolean noDag, @Nullable Function2<RelNode, RelNode, Void> onCopyHook, RelOptCostFactory costFactory) Creates a new HepPlanner with the option to keep the graph a tree (noDag = true) or allow DAG (noDag = false).- Parameters:
program- Program controlling rule applicationnoDag- If false, create shared nodes if expressions are identicalonCopyHook- Function to call when a node is copied
-
-
Method Details
-
setRoot
Description copied from interface:RelOptPlannerSets the root node of this query.- Parameters:
rel- Relational expression
-
getRoot
Description copied from interface:RelOptPlannerReturns the root node of this query.- Returns:
- Root node
-
clear
public void clear()Description copied from interface:RelOptPlannerRemoves all internal state, including all registered rules, materialized views, and lattices.- Specified by:
clearin interfaceRelOptPlanner- Overrides:
clearin classAbstractRelOptPlanner
-
changeTraits
Description copied from interface:RelOptPlannerChanges 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:RelOptPlannerFinds the most efficient expression to implement this query. -
register
Description copied from interface:RelOptPlannerRegisters 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
-
onCopy
Description copied from interface:RelOptPlannerCalled when a relational expression is copied to a similar expression.- Specified by:
onCopyin interfaceRelOptPlanner- Overrides:
onCopyin classAbstractRelOptPlanner
-
ensureRegistered
Description copied from interface:RelOptPlannerRegisters a relational expression if it is not already registered.If
equivRelis specified,relis placed in the same equivalence set. It is OK ifequivRelhas different traits;relwill end up in a different subset of the same set.It is OK if
relis 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:RelOptPlannerDetermines whether a relational expression has been registered.- Parameters:
rel- expression to test- Returns:
- whether rel has been registered
-
registerMetadataProviders
Deprecated.Description copied from interface:RelOptPlannerGives this planner a chance to register one or moreRelMetadataProviders in the chain which will be used to answer metadata queries.Planners which use their own relational expressions internally to represent concepts such as equivalence classes will generally need to supply corresponding metadata providers.
- Specified by:
registerMetadataProvidersin interfaceRelOptPlanner- Overrides:
registerMetadataProvidersin classAbstractRelOptPlanner- Parameters:
list- receives planner's custom providers, if any
-
getRelMetadataTimestamp
Deprecated.Description copied from interface:RelOptPlannerGets a timestamp for a given rel's metadata. This timestamp is used byCachingRelMetadataProviderto decide whether cached metadata has gone stale.- Specified by:
getRelMetadataTimestampin interfaceRelOptPlanner- Overrides:
getRelMetadataTimestampin classAbstractRelOptPlanner- Parameters:
rel- rel of interest- Returns:
- timestamp of last change which might affect metadata derivation
-
getMaterializations
Description copied from interface:RelOptPlannerReturns the materializations that have been registered with the planner.- Specified by:
getMaterializationsin interfaceRelOptPlanner- Overrides:
getMaterializationsin classAbstractRelOptPlanner
-
addMaterialization
Description copied from interface:RelOptPlannerDefines a pair of relational expressions that are equivalent.Typically
tableRelis aLogicalTableScanrepresenting a table that is a materialized view andqueryRelis the SQL expression that populates that view. The intention is thattableRelis cheaper to evaluate and therefore if the query being optimized uses (or can be rewritten to use)queryRelas a sub-expression then it can be optimized by usingtableRelinstead.- Specified by:
addMaterializationin interfaceRelOptPlanner- Overrides:
addMaterializationin classAbstractRelOptPlanner
-