Package org.apache.calcite.plan.volcano
Class VolcanoCost
- java.lang.Object
-
- org.apache.calcite.plan.volcano.VolcanoCost
-
- All Implemented Interfaces:
RelOptCost
class VolcanoCost extends java.lang.Object implements RelOptCost
VolcanoCost
represents the cost of a plan node.This class is immutable: none of the methods modify any member variables.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
VolcanoCost.Factory
Implementation ofRelOptCostFactory
that createsVolcanoCost
s.
-
Field Summary
Fields Modifier and Type Field Description (package private) double
cpu
static RelOptCostFactory
FACTORY
(package private) static VolcanoCost
HUGE
(package private) static VolcanoCost
INFINITY
(package private) double
io
(package private) double
rowCount
(package private) static VolcanoCost
TINY
(package private) static VolcanoCost
ZERO
-
Constructor Summary
Constructors Constructor Description VolcanoCost(double rowCount, double cpu, double io)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
divideBy(RelOptCost cost)
Computes the ratio between this cost and another cost.boolean
equals(java.lang.Object obj)
boolean
equals(RelOptCost other)
Compares this to another cost.double
getCpu()
double
getIo()
double
getRows()
int
hashCode()
boolean
isEqWithEpsilon(RelOptCost other)
Compares this to another cost, allowing for slight roundoff errors.boolean
isInfinite()
boolean
isLe(RelOptCost other)
Compares this to another cost.boolean
isLt(RelOptCost other)
Compares this to another cost.RelOptCost
minus(RelOptCost other)
Subtracts another cost from this.RelOptCost
multiplyBy(double factor)
Multiplies this cost by a scalar factor.RelOptCost
plus(RelOptCost other)
Adds another cost to this.java.lang.String
toString()
Forces implementations to overrideObject.toString()
and provide a good cost rendering to use during tracing.
-
-
-
Field Detail
-
INFINITY
static final VolcanoCost INFINITY
-
HUGE
static final VolcanoCost HUGE
-
ZERO
static final VolcanoCost ZERO
-
TINY
static final VolcanoCost TINY
-
FACTORY
public static final RelOptCostFactory FACTORY
-
cpu
final double cpu
-
io
final double io
-
rowCount
final double rowCount
-
-
Method Detail
-
getCpu
public double getCpu()
- Specified by:
getCpu
in interfaceRelOptCost
- Returns:
- usage of CPU resources
-
isInfinite
public boolean isInfinite()
- Specified by:
isInfinite
in interfaceRelOptCost
- Returns:
- true iff 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
-
getIo
public double getIo()
- Specified by:
getIo
in interfaceRelOptCost
- Returns:
- usage of I/O resources
-
isLe
public boolean isLe(RelOptCost other)
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
public boolean isLt(RelOptCost other)
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
-
getRows
public double getRows()
- Specified by:
getRows
in interfaceRelOptCost
- Returns:
- 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)
)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(RelOptCost other)
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
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
isEqWithEpsilon
public boolean isEqWithEpsilon(RelOptCost other)
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
public RelOptCost minus(RelOptCost other)
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
-
multiplyBy
public RelOptCost multiplyBy(double factor)
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
public double divideBy(RelOptCost cost)
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
-
plus
public RelOptCost plus(RelOptCost other)
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
-
toString
public java.lang.String 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 classjava.lang.Object
-
-