public abstract class SortExchange extends Exchange
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.
RelNode.Context
Modifier and Type | Field and Description |
---|---|
protected RelCollation |
collation |
distribution
digest, id, rowType, traitSet
Modifier | Constructor and Description |
---|---|
|
SortExchange(RelInput input)
Creates a SortExchange by parsing serialized output.
|
protected |
SortExchange(RelOptCluster cluster,
RelTraitSet traitSet,
RelNode input,
RelDistribution distribution,
RelCollation collation)
Creates a SortExchange.
|
Modifier and Type | Method and 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 of
RelFieldCollation s
asked for by the sort specification, from most significant to least
significant. |
computeSelfCost, copy, getDistribution
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInput
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
protected final RelCollation collation
protected SortExchange(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RelDistribution distribution, RelCollation collation)
cluster
- Cluster this relational expression belongs totraitSet
- Trait setinput
- Input relational expressiondistribution
- Distribution specificationpublic SortExchange(RelInput input)
public final SortExchange copy(RelTraitSet traitSet, RelNode newInput, RelDistribution newDistribution)
public abstract SortExchange copy(RelTraitSet traitSet, RelNode newInput, RelDistribution newDistribution, RelCollation newCollation)
public RelCollation getCollation()
RelFieldCollation
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 by
the_year, the_month
because of a known monotonicity
constraint among the columns. getCollation
would return
[time_id]
and collations
would return
[ [time_id], [the_year, the_month] ]
.
public RelWriter explainTerms(RelWriter pw)
AbstractRelNode
super.explainTerms
, then call the
RelWriter.input(String, RelNode)
and
RelWriterImpl.item(String, Object)
methods for each input and attribute.explainTerms
in class Exchange
pw
- Plan writerCopyright © 2012–2019 The Apache Software Foundation. All rights reserved.