public class HepPlanner extends AbstractRelOptPlanner
RelOptPlanner
interface.RelOptPlanner.CannotPlanException, RelOptPlanner.ExecutorcancelFlag, context, costFactory, mapDescToRuleLOGGER| Constructor and Description |
|---|
HepPlanner(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 org.apache.calcite.linq4j.function.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).
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMaterialization(RelOptMaterialization materialization)
Defines a pair of relational expressions that are equivalent.
|
RelNode |
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.
|
RelNode |
ensureRegistered(RelNode rel,
@Nullable RelNode equivRel)
Registers a relational expression if it is not already registered.
|
RelNode |
findBestExp()
Finds the most efficient expression to implement this query.
|
com.google.common.collect.ImmutableList<RelOptMaterialization> |
getMaterializations()
Returns the materializations that have been registered with the planner.
|
long |
getRelMetadataTimestamp(RelNode rel)
Deprecated.
|
@Nullable RelNode |
getRoot()
Returns the root node of this query.
|
boolean |
isRegistered(RelNode rel)
Determines whether a relational expression has been registered.
|
void |
onCopy(RelNode rel,
RelNode newRel)
Called when a relational expression is copied to a similar expression.
|
RelNode |
register(RelNode rel,
@Nullable RelNode equivRel)
Registers a relational expression in the expression bank.
|
void |
registerMetadataProviders(List<RelMetadataProvider> list)
Deprecated.
|
void |
setRoot(RelNode rel)
Sets the root node of this query.
|
addLattice, addListener, addRelTraitDef, addRule, checkCancel, chooseDelegate, clearRelTraitDefs, dumpRuleAttemptsInfo, emptyTraitSet, fireRule, getContext, getCost, getCost, getCostFactory, getExecutor, getLattice, getListener, getRelTraitDefs, getRuleByDescription, getRules, isRuleExcluded, notifyChosen, notifyDiscard, notifyEquivalence, notifyTransformation, onNewClass, prune, registerClass, registerSchema, removeRule, setCancelFlag, setExecutor, setRuleDescExclusionFilter, subClassespublic HepPlanner(HepProgram program)
program - program controlling rule applicationpublic HepPlanner(HepProgram program, @Nullable Context context)
program - program controlling rule applicationcontext - to carry while planningpublic HepPlanner(HepProgram program, @Nullable Context context, boolean noDag, @Nullable org.apache.calcite.linq4j.function.Function2<RelNode,RelNode,Void> onCopyHook, RelOptCostFactory costFactory)
noDag - If false, create shared nodes if expressions are
identicalprogram - Program controlling rule applicationonCopyHook - Function to call when a node is copiedpublic void setRoot(RelNode rel)
RelOptPlannerrel - Relational expressionpublic @Nullable RelNode getRoot()
RelOptPlannerpublic void clear()
RelOptPlannerclear in interface RelOptPlannerclear in class AbstractRelOptPlannerpublic RelNode changeTraits(RelNode rel, RelTraitSet toTraits)
RelOptPlannerrel - Relational expression (may or may not have been registered; must
not have the desired traits)toTraits - Trait set to convert the relational expression topublic RelNode findBestExp()
RelOptPlannerpublic RelNode register(RelNode rel, @Nullable RelNode equivRel)
RelOptPlannerAfter 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).
rel - Relational expression to register (must not already be
registered)equivRel - Relational expression it is equivalent to (may be null)public void onCopy(RelNode rel, RelNode newRel)
RelOptPlanneronCopy in interface RelOptPlanneronCopy in class AbstractRelOptPlannerpublic RelNode ensureRegistered(RelNode rel, @Nullable RelNode equivRel)
RelOptPlannerIf equivRel is specified, rel is placed in the same
equivalence set. It is OK if equivRel has different traits;
rel will end up in a different subset of the same set.
It is OK if rel is a subset.
rel - Relational expression to registerequivRel - Relational expression it is equivalent to (may be null)public boolean isRegistered(RelNode rel)
RelOptPlannerrel - expression to test@Deprecated public void registerMetadataProviders(List<RelMetadataProvider> list)
RelOptPlannerRelMetadataProviders 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.
registerMetadataProviders in interface RelOptPlannerregisterMetadataProviders in class AbstractRelOptPlannerlist - receives planner's custom providers, if any@Deprecated public long getRelMetadataTimestamp(RelNode rel)
RelOptPlannerCachingRelMetadataProvider to decide whether cached metadata has
gone stale.getRelMetadataTimestamp in interface RelOptPlannergetRelMetadataTimestamp in class AbstractRelOptPlannerrel - rel of interestpublic com.google.common.collect.ImmutableList<RelOptMaterialization> getMaterializations()
RelOptPlannergetMaterializations in interface RelOptPlannergetMaterializations in class AbstractRelOptPlannerpublic void addMaterialization(RelOptMaterialization materialization)
RelOptPlannerTypically tableRel is a
LogicalTableScan representing a
table that is a materialized view and queryRel is the SQL
expression that populates that view. The intention is that
tableRel is cheaper to evaluate and therefore if the query being
optimized uses (or can be rewritten to use) queryRel as a
sub-expression then it can be optimized by using tableRel
instead.
addMaterialization in interface RelOptPlanneraddMaterialization in class AbstractRelOptPlannerCopyright © 2012-2022 Apache Software Foundation. All Rights Reserved.