Package org.apache.calcite.rel.core
Class SortExchange
java.lang.Object
org.apache.calcite.rel.AbstractRelNode
org.apache.calcite.rel.SingleRel
org.apache.calcite.rel.core.Exchange
org.apache.calcite.rel.core.SortExchange
- All Implemented Interfaces:
Cloneable
,RelOptNode
,RelNode
- Direct Known Subclasses:
LogicalSortExchange
Relational expression that performs
Exchange
and Sort
simultaneously.
Whereas a Sort produces output with a particular
RelCollation
and an Exchange produces output
with a particular RelDistribution
, the output
of a SortExchange has both the required collation and distribution.
Several implementations of SortExchange are possible; the purpose of this base class allows rules to be written that apply to all of those implementations.
-
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.core.Exchange
distribution
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
Constructor Summary
ModifierConstructorDescriptionprotected
SortExchange
(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RelDistribution distribution, RelCollation collation) Creates a SortExchange.protected
SortExchange
(RelInput input) Creates a SortExchange by parsing serialized output. -
Method Summary
Modifier and TypeMethodDescriptionfinal SortExchange
copy
(RelTraitSet traitSet, RelNode newInput, RelDistribution newDistribution) abstract SortExchange
copy
(RelTraitSet traitSet, RelNode newInput, RelDistribution newDistribution, RelCollation newCollation) Describes the inputs and attributes of this relational expression.Returns the array ofRelFieldCollation
s asked for by the sort specification, from most significant to least significant.Methods inherited from class org.apache.calcite.rel.core.Exchange
computeSelfCost, copy, getDistribution
Methods inherited from class org.apache.calcite.rel.SingleRel
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInput
Methods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, accept, collectVariablesSet, collectVariablesUsed, deepEquals, deepHashCode, equals, explain, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getRelDigest, getRelTypeName, getRowType, getTable, getTraitSet, getVariablesSet, hashCode, isEnforcer, isValid, metadata, onRegister, recomputeDigest, register, 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, stripped
-
Field Details
-
collation
-
-
Constructor Details
-
SortExchange
protected SortExchange(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RelDistribution distribution, RelCollation collation) Creates a SortExchange.- Parameters:
cluster
- Cluster this relational expression belongs totraitSet
- Trait setinput
- Input relational expressiondistribution
- Distribution specification
-
SortExchange
Creates a SortExchange by parsing serialized output.
-
-
Method Details
-
copy
public final SortExchange copy(RelTraitSet traitSet, RelNode newInput, RelDistribution newDistribution) -
copy
public abstract SortExchange copy(RelTraitSet traitSet, RelNode newInput, RelDistribution newDistribution, RelCollation newCollation) -
getCollation
Returns the array ofRelFieldCollation
s asked for by the sort specification, from most significant to least significant.See also
RelMetadataQuery.collations(RelNode)
, which lists all known collations. For example,ORDER BY time_id
might also be sorted bythe_year, the_month
because of a known monotonicity constraint among the columns.getCollation
would return[time_id]
andcollations
would return[ [time_id], [the_year, the_month] ]
. -
explainTerms
Description copied from class:AbstractRelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms
, then call theRelWriter.input(String, RelNode)
andRelWriter.item(String, Object)
methods for each input and attribute.- Overrides:
explainTerms
in classExchange
- Parameters:
pw
- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-