Class Values
- java.lang.Object
-
- org.apache.calcite.rel.AbstractRelNode
-
- org.apache.calcite.rel.core.Values
-
- All Implemented Interfaces:
java.lang.Cloneable
,RelOptNode
,RelNode
- Direct Known Subclasses:
Bindables.BindableValues
,EnumerableValues
,JdbcRules.JdbcValues
,LogicalValues
,SparkRules.SparkValues
public abstract class Values extends AbstractRelNode
Relational expression whose value is a sequence of zero or more literal row values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.base.Predicate<? super Values>
IS_EMPTY
Deprecated.static java.util.function.Predicate<? super Values>
IS_EMPTY_J
static com.google.common.base.Predicate<? super Values>
IS_NOT_EMPTY
Deprecated.com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>>
tuples
-
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Values(RelOptCluster cluster, RelDataType rowType, com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>> tuples, RelTraitSet traits)
Creates a new Values.Values(RelInput input)
Creates a Values by parsing serialized output.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.Object
apply(com.google.common.collect.ImmutableList<RexLiteral> tuple)
Helps render tuples as strings.private boolean
assertRowType()
Returns true if all tuples match rowType; otherwise, assert on mismatch.RelOptCost
computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
Returns the cost of this plan (not including children).protected RelDataType
deriveRowType()
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.com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>>
getTuples()
Returns the rows of literals represented by this Values relational expression.com.google.common.collect.ImmutableList<com.google.common.collect.ImmutableList<RexLiteral>>
getTuples(RelInput input)
static boolean
isEmpty(Values values)
Predicate, to be used when defining an operand of aRelOptRule
, that returns true if a Values contains zero tuples.static boolean
isNotEmpty(Values values)
Predicate, to be used when defining an operand of aRelOptRule
, that returns true if a Values contains one or more tuples.-
Methods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, accept, childrenAccept, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, copy, explain, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getInputs, getQuery, getRelTypeName, getRows, getRowType, getTable, getTraitSet, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, isValid, metadata, onRegister, recomputeDigest, register, replaceInput, sole, toString
-
-
-
-
Field Detail
-
IS_EMPTY_J
public static final java.util.function.Predicate<? super Values> IS_EMPTY_J
-
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 Detail
-
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 torowType
- Row type for tuples produced by this reltuples
- 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
public Values(RelInput input)
Creates a Values by parsing serialized output.
-
-
Method Detail
-
apply
private static java.lang.Object apply(com.google.common.collect.ImmutableList<RexLiteral> tuple)
Helps render tuples as strings.
-
isEmpty
public static boolean isEmpty(Values values)
Predicate, to be used when defining an operand of aRelOptRule
, 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 aRelOptRule
, 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.
-
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.
-
assertRowType
private boolean assertRowType()
Returns true if all tuples match rowType; otherwise, assert on mismatch.
-
deriveRowType
protected RelDataType deriveRowType()
- Overrides:
deriveRowType
in classAbstractRelNode
-
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)
-
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 classAbstractRelNode
- 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 callsuper.explainTerms
, then call theRelWriterImpl.input(String, RelNode)
andRelWriterImpl.item(String, Object)
methods for each input and attribute.- Overrides:
explainTerms
in classAbstractRelNode
- Parameters:
pw
- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-
-