Package org.apache.calcite.rel.core
Class Calc
- java.lang.Object
-
- org.apache.calcite.rel.AbstractRelNode
-
- org.apache.calcite.rel.SingleRel
-
- org.apache.calcite.rel.core.Calc
-
- All Implemented Interfaces:
java.lang.Cloneable
,RelOptNode
,RelNode
- Direct Known Subclasses:
EnumerableCalc
,LogicalCalc
public abstract class Calc extends SingleRel
Calc
is an abstract base class for implementations ofLogicalCalc
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context
-
-
Field Summary
Fields Modifier and Type Field Description protected RexProgram
program
-
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Calc(RelOptCluster cluster, RelTraitSet traits, RelNode child, RexProgram program)
Creates a Calc.protected
Calc(RelOptCluster cluster, RelTraitSet traits, RelNode child, RexProgram program, java.util.List<RelCollation> collationList)
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RelNode
accept(RexShuttle shuttle)
Accepts a visit from a shuttle.RelOptCost
computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
Returns the cost of this plan (not including children).Calc
copy(RelTraitSet traitSet, java.util.List<RelNode> inputs)
Creates a copy of this relational expression, perhaps changing traits and inputs.abstract Calc
copy(RelTraitSet traitSet, RelNode child, RexProgram program)
Creates a copy of thisCalc
.Calc
copy(RelTraitSet traitSet, RelNode child, RexProgram program, java.util.List<RelCollation> collationList)
Deprecated.double
estimateRowCount(RelMetadataQuery mq)
Returns an estimate of the number of rows this relational expression will return.RelWriter
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.RexProgram
getProgram()
boolean
isValid(Litmus litmus, RelNode.Context context)
Returns whether this relational expression is valid.-
Methods inherited from class org.apache.calcite.rel.SingleRel
childrenAccept, deriveRowType, getInput, getInputs, replaceInput
-
Methods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, explain, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getQuery, getRelTypeName, getRows, getRowType, getTable, getTraitSet, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, metadata, onRegister, recomputeDigest, register, sole, toString
-
-
-
-
Field Detail
-
program
protected final RexProgram program
-
-
Constructor Detail
-
Calc
protected Calc(RelOptCluster cluster, RelTraitSet traits, RelNode child, RexProgram program)
Creates a Calc.- Parameters:
cluster
- Clustertraits
- Traitschild
- Input relationprogram
- Calc program
-
Calc
@Deprecated protected Calc(RelOptCluster cluster, RelTraitSet traits, RelNode child, RexProgram program, java.util.List<RelCollation> collationList)
Deprecated.
-
-
Method Detail
-
copy
public final Calc copy(RelTraitSet traitSet, java.util.List<RelNode> inputs)
Description copied from interface:RelNode
Creates a copy of this relational expression, perhaps changing traits and inputs.Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.
- Specified by:
copy
in interfaceRelNode
- Overrides:
copy
in classAbstractRelNode
- Parameters:
traitSet
- Trait setinputs
- Inputs- Returns:
- Copy of this relational expression, substituting traits and inputs
-
copy
public abstract Calc copy(RelTraitSet traitSet, RelNode child, RexProgram program)
Creates a copy of thisCalc
.- Parameters:
traitSet
- Traitschild
- Input relationprogram
- Calc program- Returns:
- New
Calc
if any parameter differs from the value of thisCalc
, or justthis
if all the parameters are the same - See Also:
copy(org.apache.calcite.plan.RelTraitSet, java.util.List)
-
copy
@Deprecated public Calc copy(RelTraitSet traitSet, RelNode child, RexProgram program, java.util.List<RelCollation> collationList)
Deprecated.
-
isValid
public boolean isValid(Litmus litmus, RelNode.Context context)
Description copied from interface:RelNode
Returns whether this relational expression is valid.If assertions are enabled, this method is typically called with
litmus
=THROW
, as follows:assert rel.isValid(Litmus.THROW)
This signals that the method can throw an
AssertionError
if it is not valid.- Specified by:
isValid
in interfaceRelNode
- Overrides:
isValid
in classAbstractRelNode
- Parameters:
litmus
- What to do if invalidcontext
- Context for validity checking- Returns:
- Whether relational expression is valid
-
getProgram
public RexProgram getProgram()
-
estimateRowCount
public double estimateRowCount(RelMetadataQuery mq)
Description copied from interface:RelNode
Returns an estimate of the number of rows this relational expression will return.NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use
RelMetadataQuery.getRowCount(org.apache.calcite.rel.RelNode)
, which gives plugins a chance to override the rel's default ideas about row count.- Specified by:
estimateRowCount
in interfaceRelNode
- Overrides:
estimateRowCount
in classSingleRel
- Parameters:
mq
- Metadata query- Returns:
- Estimate of the number of rows this relational expression will return
-
computeSelfCost
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
Description copied from interface:RelNode
Returns the cost of this plan (not including children). The base implementation throws an error; derived classes should override.NOTE 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.- Specified by:
computeSelfCost
in interfaceRelNode
- Overrides:
computeSelfCost
in classAbstractRelNode
- Parameters:
planner
- Planner for cost calculationmq
- Metadata query- Returns:
- Cost of this plan (not including children)
-
explainTerms
public RelWriter explainTerms(RelWriter pw)
Description copied from class:AbstractRelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms
, then call theRelWriterImpl.input(String, RelNode)
andRelWriterImpl.item(String, Object)
methods for each input and attribute.- Overrides:
explainTerms
in classSingleRel
- Parameters:
pw
- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-
accept
public RelNode accept(RexShuttle shuttle)
Description copied from interface:RelNode
Accepts a visit from a shuttle. If the shuttle updates expression, then a copy of the relation should be created.- Specified by:
accept
in interfaceRelNode
- Overrides:
accept
in classAbstractRelNode
- Parameters:
shuttle
- Shuttle- Returns:
- A copy of this node incorporating changes made by the shuttle to this node's children
-
-