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:
java.lang.Cloneable
,RelOptNode
,RelNode
- Direct Known Subclasses:
LogicalSortExchange
public abstract class SortExchange extends Exchange
Relational expression that performsExchange
andSort
simultaneously.Whereas a Sort produces output with a particular
RelCollation
and an Exchange produces output with a particularRelDistribution
, 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 Modifier and Type Field Description protected RelCollation
collation
-
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
Constructors Modifier Constructor Description protected
SortExchange(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RelDistribution distribution, RelCollation collation)
Creates a SortExchange.SortExchange(RelInput input)
Creates a SortExchange by parsing serialized output.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description SortExchange
copy(RelTraitSet traitSet, RelNode newInput, RelDistribution newDistribution)
abstract SortExchange
copy(RelTraitSet traitSet, RelNode newInput, RelDistribution newDistribution, RelCollation newCollation)
RelWriter
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.RelCollation
getCollation()
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, computeDigest, computeSelfCost, explain, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getQuery, getRelTypeName, getRows, getRowType, getTable, getTraitSet, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, isValid, metadata, onRegister, recomputeDigest, register, sole, toString
-
-
-
-
Field Detail
-
collation
protected final RelCollation collation
-
-
Constructor Detail
-
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
public SortExchange(RelInput input)
Creates a SortExchange by parsing serialized output.
-
-
Method Detail
-
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
public RelCollation 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
public RelWriter explainTerms(RelWriter pw)
Description copied from class:AbstractRelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms
, then call theRelWriterImpl.input(String, RelNode)
andRelWriterImpl.item(String, Object)
methods for each input and attribute.- Overrides:
explainTerms
in classExchange
- Parameters:
pw
- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-
-