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 welldefined 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 Summary
Modifier and TypeMethodDescriptiondouble
divideBy
(RelOptCost cost) Computes the ratio between this cost and another cost.boolean
equals
(RelOptCost cost) Compares this to another cost.double
getCpu()
Returns usage of CPU resources.double
getIo()
Returns usage of I/O resources.double
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)
).boolean
isEqWithEpsilon
(RelOptCost cost) Compares this to another cost, allowing for slight roundoff errors.boolean
Returns whether this cost represents an expression that hasn't actually been implemented (e.g.boolean
isLe
(RelOptCost cost) Compares this to another cost.boolean
isLt
(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.

Method Details

getRows
double 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)
). 
getCpu
double getCpu()Returns usage of CPU resources. 
getIo
double getIo()Returns usage of I/O resources. 
isInfinite
boolean 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. 
equals
Compares this to another cost. Parameters:
cost
 another cost Returns:
 true iff this is exactly equal to other cost

isEqWithEpsilon
Compares 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

isLe
Compares this to another cost. Parameters:
cost
 another cost Returns:
 true iff this is less than or equal to other cost

isLt
Compares this to another cost. Parameters:
cost
 another cost Returns:
 true iff this is strictly less than other cost

plus
Adds another cost to this. Parameters:
cost
 another cost Returns:
 sum of this and other cost

minus
Subtracts another cost from this. Parameters:
cost
 another cost Returns:
 difference between this and other cost

multiplyBy
Multiplies this cost by a scalar factor. Parameters:
factor
 scalar factor Returns:
 scalar product of this and factor

divideBy
Computes the ratio between this cost and another cost.divideBy is the inverse of
multiplyBy(double)
. For any finite, nonzero cost and factor f,cost.divideBy(cost.multiplyBy(f))
yields1 / f
. Parameters:
cost
 Other cost Returns:
 Ratio between costs

toString
String toString()Forces implementations to overrideObject.toString()
and provide a good cost rendering to use during tracing.
