Class Calc

All Implemented Interfaces:
Cloneable, RelOptNode, Hintable, RelNode
Direct Known Subclasses:
EnumerableCalc, LogicalCalc

public abstract class Calc extends SingleRel implements Hintable
Calc is an abstract base class for implementations of LogicalCalc.
  • Field Details

    • hints

      protected final com.google.common.collect.ImmutableList<RelHint> hints
    • program

      protected final RexProgram program
  • Constructor Details

  • Method Details

    • copy

      public final Calc copy(RelTraitSet traitSet, 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 interface RelNode
      Overrides:
      copy in class AbstractRelNode
      Parameters:
      traitSet - Trait set
      inputs - 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 this Calc.
      Parameters:
      traitSet - Traits
      child - Input relation
      program - Calc program
      Returns:
      New Calc if any parameter differs from the value of this Calc, or just this if all the parameters are the same
      See Also:
    • copy

      @Deprecated public Calc copy(RelTraitSet traitSet, RelNode child, RexProgram program, List<RelCollation> collationList)
      Deprecated.
    • containsOver

      public final boolean containsOver()
      Returns whether this Calc contains any windowed-aggregate functions.
    • isValid

      public boolean isValid(Litmus litmus, @Nullable 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 interface RelNode
      Overrides:
      isValid in class AbstractRelNode
      Parameters:
      litmus - What to do if invalid
      context - Context for validity checking
      Returns:
      Whether relational expression is valid
    • getProgram

      public RexProgram getProgram()
    • getHints

      public com.google.common.collect.ImmutableList<RelHint> getHints()
      Description copied from interface: Hintable
      Returns the hints of this relational expressions as an immutable list.
      Specified by:
      getHints in interface Hintable
    • 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 interface RelNode
      Overrides:
      estimateRowCount in class SingleRel
      Parameters:
      mq - Metadata query
      Returns:
      Estimate of the number of rows this relational expression will return
    • computeSelfCost

      public @Nullable 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 interface RelNode
      Overrides:
      computeSelfCost in class AbstractRelNode
      Parameters:
      planner - Planner for cost calculation
      mq - 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 call super.explainTerms, then call the RelWriter.input(String, RelNode) and RelWriter.item(String, Object) methods for each input and attribute.
      Overrides:
      explainTerms in class SingleRel
      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. This new relation might have a different row-type.
      Specified by:
      accept in interface RelNode
      Overrides:
      accept in class AbstractRelNode
      Parameters:
      shuttle - Shuttle
      Returns:
      A copy of this node incorporating changes made by the shuttle to this node's children