Class Values

java.lang.Object
org.apache.calcite.rel.AbstractRelNode
org.apache.calcite.rel.core.Values
All Implemented Interfaces:
Cloneable, RelOptNode, Hintable, RelNode
Direct Known Subclasses:
Bindables.BindableValues, EnumerableValues, JdbcRules.JdbcValues, LogicalValues, SparkRules.SparkValues

public abstract class Values extends AbstractRelNode implements Hintable
Relational expression whose value is a sequence of zero or more literal row values.
  • Field Details

    • IS_EMPTY_J

      public static final Predicate<? super Values> IS_EMPTY_J
    • hints

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

      @Deprecated public static final com.google.common.base.Predicate<? super Values> IS_EMPTY
      Deprecated.
    • IS_NOT_EMPTY

      @Deprecated public static final com.google.common.base.Predicate<? super Values> IS_NOT_EMPTY
      Deprecated.
    • tuples

      public final com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>> tuples
  • Constructor Details

    • Values

      protected Values(RelOptCluster cluster, List<RelHint> hints, RelDataType rowType, com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>> tuples, RelTraitSet traits)
      Creates a new Values.

      Note that tuples passed in become owned by this rel (without a deep copy), so caller must not modify them after this call, otherwise bad things will happen.

      Parameters:
      cluster - Cluster that this relational expression belongs to
      hints - Hints for this node
      rowType - Row type for tuples produced by this rel
      tuples - 2-dimensional array of tuple values to be produced; outer list contains tuples; each inner list is one tuple; all tuples must be of same length, conforming to rowType
    • Values

      protected Values(RelOptCluster cluster, RelDataType rowType, com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>> tuples, RelTraitSet traits)
      Creates a new Values.

      Note that tuples passed in become owned by this rel (without a deep copy), so caller must not modify them after this call, otherwise bad things will happen.

      Parameters:
      cluster - Cluster that this relational expression belongs to
      rowType - Row type for tuples produced by this rel
      tuples - 2-dimensional array of tuple values to be produced; outer list contains tuples; each inner list is one tuple; all tuples must be of same length, conforming to rowType
    • Values

      protected Values(RelInput input)
      Creates a Values by parsing serialized output.
  • Method Details

    • isEmpty

      public static boolean isEmpty(Values values)
      Predicate, to be used when defining an operand of a RelOptRule, that returns true if a Values contains zero tuples.

      This is the conventional way to represent an empty relational expression. There are several rules that recognize empty relational expressions and prune away that section of the tree.

    • isNotEmpty

      public static boolean isNotEmpty(Values values)
      Predicate, to be used when defining an operand of a RelOptRule, that returns true if a Values contains one or more tuples.

      This is the conventional way to represent an empty relational expression. There are several rules that recognize empty relational expressions and prune away that section of the tree.

    • isSingleValue

      public static boolean isSingleValue(Values values)
    • getTuples

      public com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>> getTuples(RelInput input)
    • getTuples

      public com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>> getTuples()
      Returns the rows of literals represented by this Values relational expression.
    • deriveRowType

      protected RelDataType deriveRowType()
      Overrides:
      deriveRowType in class AbstractRelNode
    • 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)
    • 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 AbstractRelNode
      Parameters:
      mq - Metadata query
      Returns:
      Estimate of the number of rows this relational expression will return
    • 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 AbstractRelNode
      Parameters:
      pw - Plan writer
      Returns:
      Plan writer for fluent-explain pattern
    • 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