RelNode.Contextdigest, id, rowType, traitSet| Constructor and Description |
|---|
JdbcSort(RelOptCluster cluster,
RelTraitSet traitSet,
RelNode input,
RelCollation collation,
@Nullable RexNode offset,
@Nullable RexNode fetch) |
| Modifier and Type | Method and Description |
|---|---|
@Nullable RelOptCost |
computeSelfCost(RelOptPlanner planner,
RelMetadataQuery mq)
Returns the cost of this plan (not including children).
|
JdbcRules.JdbcSort |
copy(RelTraitSet traitSet,
RelNode newInput,
RelCollation newCollation,
@Nullable RexNode offset,
@Nullable RexNode fetch) |
SqlImplementor.Result |
implement(JdbcImplementor implementor) |
accept, copy, copy, explainTerms, getCollation, getHints, getSortExps, isEnforcerchildrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInputaccept, collectVariablesSet, collectVariablesUsed, deepEquals, deepHashCode, equals, explain, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getRelDigest, getRelTypeName, getRowType, getTable, getTraitSet, getVariablesSet, hashCode, isValid, metadata, onRegister, recomputeDigest, register, sole, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaccept, accept, childrenAccept, collectVariablesSet, collectVariablesUsed, copy, deepEquals, deepHashCode, estimateRowCount, explain, explain, fieldIsNullable, getConvention, getCorrelVariable, getDigest, getExpectedInputRowType, getInput, getInputs, getRelDigest, getRelTypeName, getRowType, getTable, getVariablesSet, isEnforcer, isValid, metadata, onRegister, recomputeDigest, register, replaceInputgetCluster, getDescription, getId, getTraitSetattachHints, withHintspublic JdbcSort(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RelCollation collation, @Nullable RexNode offset, @Nullable RexNode fetch)
public JdbcRules.JdbcSort copy(RelTraitSet traitSet, RelNode newInput, RelCollation newCollation, @Nullable RexNode offset, @Nullable RexNode fetch)
public @Nullable RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
SortNOTE 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.
The CPU cost of a Sort has three main cases:
fetch is zero, CPU cost is zero; otherwise,
min(fetch + offset, inputRowCount) * bytesPerRow; otherwise
inputRowCount rows, with at most
min(fetch + offset, inputRowCount) of them in the sort data
structure at a time, giving a CPU cost of inputRowCount *
log(min(fetch + offset, inputRowCount)) * bytesPerRow.
The cost model factors in row width via bytesPerRow, because
sorts need to move rows around, not just compare them; by making the cost
higher if rows are wider, we discourage pushing a Project through a Sort.
We assume that each field is 4 bytes, and we add 3 'virtual fields' to
represent the per-row overhead. Thus a 1-field row is (3 + 1) * 4 = 16
bytes; a 5-field row is (3 + 5) * 4 = 32 bytes.
The cost model does not consider a 5-field sort to be more expensive than, say, a 2-field sort, because both sorts will compare just one field most of the time.
computeSelfCost in interface RelNodecomputeSelfCost in class Sortplanner - Planner for cost calculationmq - Metadata querypublic SqlImplementor.Result implement(JdbcImplementor implementor)
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.