Package org.apache.calcite.plan
Class RelOptCostImpl
java.lang.Object
org.apache.calcite.plan.RelOptCostImpl
- All Implemented Interfaces:
RelOptCost
RelOptCostImpl provides a default implementation for the
RelOptCost
interface. It it defined in terms of a single scalar quantity; somewhat
arbitrarily, it returns this scalar for rows processed and zero for both CPU
and I/O.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
divideBy
(RelOptCost cost) Computes the ratio between this cost and another cost.boolean
boolean
equals
(RelOptCost other) 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)
).int
hashCode()
boolean
isEqWithEpsilon
(RelOptCost other) 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 other) Compares this to another cost.boolean
isLt
(RelOptCost other) Compares this to another cost.minus
(RelOptCost other) Subtracts another cost from this.multiplyBy
(double factor) Multiplies this cost by a scalar factor.plus
(RelOptCost other) Adds another cost to this.toString()
Forces implementations to overrideObject.toString()
and provide a good cost rendering to use during tracing.
-
Field Details
-
FACTORY
-
-
Constructor Details
-
RelOptCostImpl
public RelOptCostImpl(double value)
-
-
Method Details
-
getRows
public double getRows()Description copied from interface:RelOptCost
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)
).- Specified by:
getRows
in interfaceRelOptCost
-
getIo
public double getIo()Description copied from interface:RelOptCost
Returns usage of I/O resources.- Specified by:
getIo
in interfaceRelOptCost
-
getCpu
public double getCpu()Description copied from interface:RelOptCost
Returns usage of CPU resources.- Specified by:
getCpu
in interfaceRelOptCost
-
isInfinite
public boolean isInfinite()Description copied from interface:RelOptCost
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.- Specified by:
isInfinite
in interfaceRelOptCost
-
isLe
Description copied from interface:RelOptCost
Compares this to another cost.- Specified by:
isLe
in interfaceRelOptCost
- Parameters:
other
- another cost- Returns:
- true iff this is less than or equal to other cost
-
isLt
Description copied from interface:RelOptCost
Compares this to another cost.- Specified by:
isLt
in interfaceRelOptCost
- Parameters:
other
- another cost- Returns:
- true iff this is strictly less than other cost
-
hashCode
public int hashCode() -
equals
Description copied from interface:RelOptCost
Compares this to another cost.- Specified by:
equals
in interfaceRelOptCost
- Parameters:
other
- another cost- Returns:
- true iff this is exactly equal to other cost
-
equals
-
isEqWithEpsilon
Description copied from interface:RelOptCost
Compares this to another cost, allowing for slight roundoff errors.- Specified by:
isEqWithEpsilon
in interfaceRelOptCost
- Parameters:
other
- another cost- Returns:
- true iff this is the same as the other cost within a roundoff margin of error
-
minus
Description copied from interface:RelOptCost
Subtracts another cost from this.- Specified by:
minus
in interfaceRelOptCost
- Parameters:
other
- another cost- Returns:
- difference between this and other cost
-
plus
Description copied from interface:RelOptCost
Adds another cost to this.- Specified by:
plus
in interfaceRelOptCost
- Parameters:
other
- another cost- Returns:
- sum of this and other cost
-
multiplyBy
Description copied from interface:RelOptCost
Multiplies this cost by a scalar factor.- Specified by:
multiplyBy
in interfaceRelOptCost
- Parameters:
factor
- scalar factor- Returns:
- scalar product of this and factor
-
divideBy
Description copied from interface:RelOptCost
Computes the ratio between this cost and another cost.divideBy is the inverse of
RelOptCost.multiplyBy(double)
. For any finite, non-zero cost and factor f,cost.divideBy(cost.multiplyBy(f))
yields1 / f
.- Specified by:
divideBy
in interfaceRelOptCost
- Parameters:
cost
- Other cost- Returns:
- Ratio between costs
-
toString
Description copied from interface:RelOptCost
Forces implementations to overrideObject.toString()
and provide a good cost rendering to use during tracing.- Specified by:
toString
in interfaceRelOptCost
- Overrides:
toString
in classObject
-