Package org.apache.calcite.plan
Interface RelOptCost
- All Known Implementing Classes:
- RelOptCostImpl
public interface RelOptCost
RelOptCost defines an interface for optimizer cost in terms of number of rows
 processed, CPU cost, and I/O cost. Optimizer implementations may use all of
 this information, or selectively ignore portions of it. The specific units
 for all of these quantities are rather vague; most relational expressions
 provide a default cost calculation, but optimizers can override this by
 plugging in their own cost models with well-defined meanings for each unit.
 Optimizers which supply their own cost models may also extend this interface
 with additional cost metrics such as memory usage.
- 
Method SummaryModifier and TypeMethodDescriptiondoubledivideBy(RelOptCost cost) Computes the ratio between this cost and another cost.booleanequals(RelOptCost cost) Compares this to another cost.doublegetCpu()Returns usage of CPU resources.doublegetIo()Returns usage of I/O resources.doublegetRows()Returns the number of rows processed; this should not be confused with the row count produced by a relational expression (RelNode.estimateRowCount(org.apache.calcite.rel.metadata.RelMetadataQuery)).booleanisEqWithEpsilon(RelOptCost cost) Compares this to another cost, allowing for slight roundoff errors.booleanReturns whether this cost represents an expression that hasn't actually been implemented (e.g.booleanisLe(RelOptCost cost) Compares this to another cost.booleanisLt(RelOptCost cost) Compares this to another cost.minus(RelOptCost cost) Subtracts another cost from this.multiplyBy(double factor) Multiplies this cost by a scalar factor.plus(RelOptCost cost) Adds another cost to this.toString()Forces implementations to overrideObject.toString()and provide a good cost rendering to use during tracing.static StringtoString(double value) 
- 
Method Details- 
getRowsdouble getRows()Returns the number of rows processed; this should not be confused with the row count produced by a relational expression (RelNode.estimateRowCount(org.apache.calcite.rel.metadata.RelMetadataQuery)).
- 
getCpudouble getCpu()Returns usage of CPU resources.
- 
getIodouble getIo()Returns usage of I/O resources.
- 
isInfiniteboolean isInfinite()Returns whether this cost represents an expression that hasn't actually been implemented (e.g. a pure relational algebra expression) or can't actually be implemented, e.g. a transfer of data between two disconnected sites.
- 
equalsCompares this to another cost.- Parameters:
- cost- another cost
- Returns:
- true iff this is exactly equal to other cost
 
- 
isEqWithEpsilonCompares this to another cost, allowing for slight roundoff errors.- Parameters:
- cost- another cost
- Returns:
- true iff this is the same as the other cost within a roundoff margin of error
 
- 
isLeCompares this to another cost.- Parameters:
- cost- another cost
- Returns:
- true iff this is less than or equal to other cost
 
- 
isLtCompares this to another cost.- Parameters:
- cost- another cost
- Returns:
- true iff this is strictly less than other cost
 
- 
plusAdds another cost to this.- Parameters:
- cost- another cost
- Returns:
- sum of this and other cost
 
- 
minusSubtracts another cost from this.- Parameters:
- cost- another cost
- Returns:
- difference between this and other cost
 
- 
multiplyByMultiplies this cost by a scalar factor.- Parameters:
- factor- scalar factor
- Returns:
- scalar product of this and factor
 
- 
divideByComputes the ratio between this cost and another cost.divideBy is the inverse of multiplyBy(double). For any finite, non-zero cost and factor f,cost.divideBy(cost.multiplyBy(f))yields1 / f.- Parameters:
- cost- Other cost
- Returns:
- Ratio between costs
 
- 
toStringString toString()Forces implementations to overrideObject.toString()and provide a good cost rendering to use during tracing.
- 
toString
 
-