Class RelSubset
- All Implemented Interfaces:
Cloneable
,RelOptNode
,RelNode
Physical properties are instances of the RelTraitSet
, and consist
of traits such as calling convention and collation (sort-order).
For some traits, a relational expression can have more than one instance. For example, R can be sorted on both [X] and [Y, Z]. In which case, R would belong to the sub-sets for [X] and [Y, Z]; and also the leading edges [Y] and [].
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context
-
Field Summary
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
Method Summary
Modifier and TypeMethodDescriptionvoid
collectVariablesSet
(Set<CorrelationId> variableSet) Collects variables set by this expression.void
collectVariablesUsed
(Set<CorrelationId> variableSet) Collects variables known to be used by this expression or its descendants.@Nullable RelOptCost
computeSelfCost
(RelOptPlanner planner, RelMetadataQuery mq) Returns the cost of this plan (not including children).boolean
Returns whether this subset contains the specified relational expression.copy
(RelTraitSet traitSet, List<RelNode> inputs) Creates a copy of this relational expression, perhaps changing traits and inputs.boolean
deepEquals
(@Nullable Object obj) Equality check for RelNode digest.int
Compute hash code for RelNode digest.protected RelDataType
double
Returns an estimate of the number of rows this relational expression will return.void
Describes the inputs and attributes of this relational expression.@Nullable RelNode
getBest()
Returns a digest string of thisRelNode
.@Nullable RelNode
Returns a list of relational expressions one of whose children is this subset.AsgetRels()
but returns a list.getRels()
Returns the rel nodes in this rel subset.Returns stream of subsets whose traitset is satisfied by current subset's traitset.Returns stream of subsets whose traitset satisfies current subset's traitset.@Nullable RelOptCost
Returns the best cost if this subset is fully optimized or null if the subset is not fully optimized.boolean
boolean
stripped()
Returns this node without any wrapper added by the planner.Methods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, accept, childrenAccept, equals, explainTerms, getCluster, getConvention, getCorrelVariable, getDescription, getExpectedInputRowType, getId, getInput, getInputs, getRelDigest, getRelTypeName, getRowType, getTable, getTraitSet, getVariablesSet, hashCode, isEnforcer, isValid, metadata, onRegister, recomputeDigest, register, replaceInput, sole, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.calcite.rel.RelNode
explain, fieldIsNullable
-
Method Details
-
isDelivered
@API(since="1.23", status=EXPERIMENTAL) public boolean isDelivered() -
isRequired
@API(since="1.23", status=EXPERIMENTAL) public boolean isRequired() -
getBest
-
getOriginal
-
getBestOrOriginal
-
stripped
Description copied from interface:RelNode
Returns this node without any wrapper added by the planner. -
copy
Description copied from interface:RelNode
Creates a copy of this relational expression, perhaps changing traits and inputs.Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.
- Specified by:
copy
in interfaceRelNode
- Overrides:
copy
in classAbstractRelNode
- Parameters:
traitSet
- Trait setinputs
- Inputs- Returns:
- Copy of this relational expression, substituting traits and inputs
-
computeSelfCost
Description copied from interface:RelNode
Returns the cost of this plan (not including children). The base implementation throws an error; derived classes should override.NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use
RelMetadataQuery.getNonCumulativeCost(org.apache.calcite.rel.RelNode)
, which gives plugins a chance to override the rel's default ideas about cost.- Specified by:
computeSelfCost
in interfaceRelNode
- Overrides:
computeSelfCost
in classAbstractRelNode
- Parameters:
planner
- Planner for cost calculationmq
- Metadata query- Returns:
- Cost of this plan (not including children)
-
estimateRowCount
Description copied from interface:RelNode
Returns an estimate of the number of rows this relational expression will return.NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use
RelMetadataQuery.getRowCount(org.apache.calcite.rel.RelNode)
, which gives plugins a chance to override the rel's default ideas about row count.- Specified by:
estimateRowCount
in interfaceRelNode
- Overrides:
estimateRowCount
in classAbstractRelNode
- Parameters:
mq
- Metadata query- Returns:
- Estimate of the number of rows this relational expression will return
-
explain
Description copied from interface:RelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explain
, then call theRelWriter.input(String, RelNode)
andRelWriter.item(String, Object)
methods for each input and attribute.- Specified by:
explain
in interfaceRelNode
- Overrides:
explain
in classAbstractRelNode
- Parameters:
pw
- Plan writer
-
deepEquals
Description copied from class:AbstractRelNode
Equality check for RelNode digest.By default this method collects digest attributes from
AbstractRelNode.explainTerms(RelWriter)
, then compares each attribute pair. This should work well for most cases. If this method is a performance bottleneck for your project, or the default behavior can't handle your scenario properly, you can choose to override this method andAbstractRelNode.deepHashCode()
. SeeLogicalJoin
as an example.- Specified by:
deepEquals
in interfaceRelNode
- Overrides:
deepEquals
in classAbstractRelNode
- Returns:
- Whether the 2 RelNodes are equivalent or have the same digest.
- See Also:
-
deepHashCode
public int deepHashCode()Description copied from class:AbstractRelNode
Compute hash code for RelNode digest.- Specified by:
deepHashCode
in interfaceRelNode
- Overrides:
deepHashCode
in classAbstractRelNode
- See Also:
-
deriveRowType
- Overrides:
deriveRowType
in classAbstractRelNode
-
getParentRels
Returns a list of relational expressions one of whose children is this subset. The elements of the list are distinct. -
collectVariablesUsed
Description copied from interface:RelNode
Collects variables known to be used by this expression or its descendants. By default, no such information is available and must be derived by analyzing sub-expressions, but some optimizer implementations may insert special expressions which remember such information.- Specified by:
collectVariablesUsed
in interfaceRelNode
- Overrides:
collectVariablesUsed
in classAbstractRelNode
- Parameters:
variableSet
- receives variables used
-
collectVariablesSet
Description copied from interface:RelNode
Collects variables set by this expression. TODO: is this required?- Specified by:
collectVariablesSet
in interfaceRelNode
- Overrides:
collectVariablesSet
in classAbstractRelNode
- Parameters:
variableSet
- receives variables known to be set by
-
getRels
Returns the rel nodes in this rel subset. All rels must have the same traits and are logically equivalent.- Returns:
- all the rels in the subset
-
getRelList
AsgetRels()
but returns a list. -
contains
Returns whether this subset contains the specified relational expression. -
getSubsetsSatisfyingThis
Returns stream of subsets whose traitset satisfies current subset's traitset. -
getSatisfyingSubsets
Returns stream of subsets whose traitset is satisfied by current subset's traitset. -
getWinnerCost
Returns the best cost if this subset is fully optimized or null if the subset is not fully optimized. -
getDigest
Description copied from interface:RelNode
Returns a digest string of thisRelNode
.Each call creates a new digest string, so don't forget to cache the result if necessary.
- Specified by:
getDigest
in interfaceRelNode
- Specified by:
getDigest
in interfaceRelOptNode
- Overrides:
getDigest
in classAbstractRelNode
- Returns:
- Digest string of this
RelNode
- See Also:
-