public abstract class Sort extends SingleRel
RelNode.Context
Modifier and Type | Field and Description |
---|---|
RelCollation |
collation |
RexNode |
fetch |
protected com.google.common.collect.ImmutableList<RexNode> |
fieldExps |
RexNode |
offset |
digest, id, rowType, traitSet
Constructor and Description |
---|
Sort(RelInput input)
Creates a Sort by parsing serialized output.
|
Sort(RelOptCluster cluster,
RelTraitSet traits,
RelNode child,
RelCollation collation)
Creates a Sort.
|
Sort(RelOptCluster cluster,
RelTraitSet traits,
RelNode child,
RelCollation collation,
RexNode offset,
RexNode fetch)
Creates a Sort.
|
Modifier and Type | Method and Description |
---|---|
RelNode |
accept(RexShuttle shuttle)
Accepts a visit from a shuttle.
|
RelOptCost |
computeSelfCost(RelOptPlanner planner,
RelMetadataQuery mq)
Returns the cost of this plan (not including children).
|
Sort |
copy(RelTraitSet traitSet,
java.util.List<RelNode> inputs)
Creates a copy of this relational expression, perhaps changing traits and
inputs.
|
Sort |
copy(RelTraitSet traitSet,
RelNode newInput,
RelCollation newCollation) |
abstract Sort |
copy(RelTraitSet traitSet,
RelNode newInput,
RelCollation newCollation,
RexNode offset,
RexNode fetch) |
RelWriter |
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.
|
java.util.List<RexNode> |
getChildExps()
Returns a list of this relational expression's child expressions.
|
RelCollation |
getCollation()
Returns the array of
RelFieldCollation s asked for by the sort
specification, from most significant to least significant. |
java.util.List<RelCollation> |
getCollationList()
Returns a description of the physical ordering (or orderings) of this
relational expression.
|
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInput
accept, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, explain, getCluster, 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
public final RelCollation collation
protected final com.google.common.collect.ImmutableList<RexNode> fieldExps
public final RexNode offset
public final RexNode fetch
public Sort(RelOptCluster cluster, RelTraitSet traits, RelNode child, RelCollation collation)
cluster
- Cluster this relational expression belongs totraits
- Traitschild
- input relational expressioncollation
- array of sort specificationspublic Sort(RelOptCluster cluster, RelTraitSet traits, RelNode child, RelCollation collation, RexNode offset, RexNode fetch)
cluster
- Cluster this relational expression belongs totraits
- Traitschild
- input relational expressioncollation
- array of sort specificationsoffset
- Expression for number of rows to discard before returning
first rowfetch
- Expression for number of rows to fetchpublic Sort(RelInput input)
public final Sort copy(RelTraitSet traitSet, java.util.List<RelNode> inputs)
RelNode
Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.
copy
in interface RelNode
copy
in class AbstractRelNode
traitSet
- Trait setinputs
- Inputspublic final Sort copy(RelTraitSet traitSet, RelNode newInput, RelCollation newCollation)
public abstract Sort copy(RelTraitSet traitSet, RelNode newInput, RelCollation newCollation, RexNode offset, RexNode fetch)
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
RelNode
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.
computeSelfCost
in interface RelNode
computeSelfCost
in class AbstractRelNode
planner
- Planner for cost calculationmq
- Metadata querypublic java.util.List<RexNode> getChildExps()
RelNode
RelNode.getInputs()
.
The caller should treat the list as unmodifiable; typical
implementations will return an immutable list. If there are no
child expressions, returns an empty list, not null
.
getChildExps
in interface RelNode
getChildExps
in class AbstractRelNode
RelNode.accept(org.apache.calcite.rex.RexShuttle)
public RelNode accept(RexShuttle shuttle)
RelNode
accept
in interface RelNode
accept
in class AbstractRelNode
shuttle
- Shuttlepublic 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 java.util.List<RelCollation> getCollationList()
RelNode
getCollationList
in interface RelNode
getCollationList
in class AbstractRelNode
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 SingleRel
pw
- Plan writerCopyright © 2012–2019 The Apache Software Foundation. All rights reserved.