Package org.apache.calcite.plan.volcano
Class RelSet
- java.lang.Object
-
- org.apache.calcite.plan.volcano.RelSet
-
class RelSet extends java.lang.Object
ARelSet
is an equivalence-set of expressions; that is, a set of expressions which have identical semantics. We are generally interested in using the expression which has the lowest cost.All of the expressions in an
RelSet
have the same calling convention.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.List<AbstractConverter>
abstractConverters
List ofAbstractConverter
objects which have not yet been satisfied.(package private) RelSet
equivalentSet
Set to the superseding set when this is found to be equivalent to another set.(package private) int
id
(package private) boolean
inMetadataQuery
Reentrancy flag.private static org.slf4j.Logger
LOGGER
(package private) java.util.List<RelNode>
parents
Relational expressions that have a subset in this set as a child.(package private) RelNode
rel
(package private) java.util.List<RelNode>
rels
(package private) java.util.List<RelSubset>
subsets
(package private) java.util.Set<CorrelationId>
variablesPropagated
Variables that are set by relational expressions in this set and available for use by parent and child expressions.(package private) java.util.Set<CorrelationId>
variablesUsed
Variables that are used by relational expressions in this set.
-
Constructor Summary
Constructors Constructor Description RelSet(int id, java.util.Set<CorrelationId> variablesPropagated, java.util.Set<CorrelationId> variablesUsed)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RelSubset
add(RelNode rel)
Adds a relational expression to a set, with its results available under a particular calling convention.private void
addAbstractConverters(VolcanoPlanner planner, RelOptCluster cluster, RelSubset subset, boolean subsetToOthers)
(package private) void
addInternal(RelNode rel)
Adds an expressionrel
to this set, without creating aRelSubset
.(package private) RelSubset
getOrCreateSubset(RelOptCluster cluster, RelTraitSet traits)
java.util.List<RelNode>
getParentRels()
java.util.List<RelNode>
getRelsFromAllSubsets()
RelSubset
getSubset(RelTraitSet traits)
(package private) void
mergeWith(VolcanoPlanner planner, RelSet otherSet)
MergesotherSet
into this RelSet.(package private) void
obliterateRelNode(RelNode rel)
Removes all references to a specificRelNode
in both the subsets and their parent relationships.private void
postEquivalenceEvent(VolcanoPlanner planner, RelNode rel)
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
rels
final java.util.List<RelNode> rels
-
parents
final java.util.List<RelNode> parents
Relational expressions that have a subset in this set as a child. This is a multi-set. If multiple relational expressions in this set have the same parent, there will be multiple entries.
-
subsets
final java.util.List<RelSubset> subsets
-
abstractConverters
final java.util.List<AbstractConverter> abstractConverters
List ofAbstractConverter
objects which have not yet been satisfied.
-
equivalentSet
RelSet equivalentSet
Set to the superseding set when this is found to be equivalent to another set.
-
rel
RelNode rel
-
variablesPropagated
final java.util.Set<CorrelationId> variablesPropagated
Variables that are set by relational expressions in this set and available for use by parent and child expressions.
-
variablesUsed
final java.util.Set<CorrelationId> variablesUsed
Variables that are used by relational expressions in this set.
-
id
final int id
-
inMetadataQuery
boolean inMetadataQuery
Reentrancy flag.
-
-
Constructor Detail
-
RelSet
RelSet(int id, java.util.Set<CorrelationId> variablesPropagated, java.util.Set<CorrelationId> variablesUsed)
-
-
Method Detail
-
getParentRels
public java.util.List<RelNode> getParentRels()
-
getRelsFromAllSubsets
public java.util.List<RelNode> getRelsFromAllSubsets()
- Returns:
- all of the
RelNode
s contained by any subset of this set (does not include the subset objects themselves)
-
getSubset
public RelSubset getSubset(RelTraitSet traits)
-
obliterateRelNode
void obliterateRelNode(RelNode rel)
Removes all references to a specificRelNode
in both the subsets and their parent relationships.
-
add
public RelSubset add(RelNode rel)
Adds a relational expression to a set, with its results available under a particular calling convention. An expression may be in the set several times with different calling conventions (and hence different costs).
-
addAbstractConverters
private void addAbstractConverters(VolcanoPlanner planner, RelOptCluster cluster, RelSubset subset, boolean subsetToOthers)
-
getOrCreateSubset
RelSubset getOrCreateSubset(RelOptCluster cluster, RelTraitSet traits)
-
postEquivalenceEvent
private void postEquivalenceEvent(VolcanoPlanner planner, RelNode rel)
-
addInternal
void addInternal(RelNode rel)
Adds an expressionrel
to this set, without creating aRelSubset
. (Called only fromRelSubset.add(org.apache.calcite.rel.RelNode)
.- Parameters:
rel
- Relational expression
-
mergeWith
void mergeWith(VolcanoPlanner planner, RelSet otherSet)
MergesotherSet
into this RelSet.One generally calls this method after discovering that two relational expressions are equivalent, and hence the
RelSet
s they belong to are equivalent also.After this method completes,
otherSet
is obsolete, itsequivalentSet
member points to this RelSet, and this RelSet is still alive.- Parameters:
planner
- PlannerotherSet
- RelSet which is equivalent to this one
-
-