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
FieldsFields inherited from class org.apache.calcite.rel.core.Exchange
distributionFields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSortExchange(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RelDistribution distribution, RelCollation collation) Creates a SortExchange.protectedSortExchange(RelInput input) Creates a SortExchange by parsing serialized output. -
Method Summary
Modifier and TypeMethodDescriptionfinal SortExchangecopy(RelTraitSet traitSet, RelNode newInput, RelDistribution newDistribution) abstract SortExchangecopy(RelTraitSet traitSet, RelNode newInput, RelDistribution newDistribution, RelCollation newCollation) Describes the inputs and attributes of this relational expression.Returns the array ofRelFieldCollations asked for by the sort specification, from most significant to least significant.Methods inherited from class org.apache.calcite.rel.core.Exchange
computeSelfCost, copy, getDistributionMethods inherited from class org.apache.calcite.rel.SingleRel
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInputMethods 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, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 ofRelFieldCollations 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_idmight also be sorted bythe_year, the_monthbecause of a known monotonicity constraint among the columns.getCollationwould return[time_id]andcollationswould return[ [time_id], [the_year, the_month] ]. -
explainTerms
Description copied from class:AbstractRelNodeDescribes 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:
explainTermsin classExchange- Parameters:
pw- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-