public abstract class Project extends SingleRel
LogicalProject
Modifier and Type | Class and Description |
---|---|
static class |
Project.Flags
Deprecated.
|
RelNode.Context
Modifier and Type | Field and Description |
---|---|
protected com.google.common.collect.ImmutableList<RexNode> |
exps |
digest, id, rowType, traitSet
Modifier | Constructor and Description |
---|---|
protected |
Project(RelInput input)
Creates a Project by parsing serialized output.
|
protected |
Project(RelOptCluster cluster,
RelTraitSet traits,
RelNode input,
java.util.List<? extends RexNode> projects,
RelDataType rowType)
Creates a Project.
|
protected |
Project(RelOptCluster cluster,
RelTraitSet traitSet,
RelNode input,
java.util.List<? extends RexNode> projects,
RelDataType rowType,
int flags)
Deprecated.
|
Modifier and Type | Method and 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).
|
RelNode |
copy(RelTraitSet traitSet,
java.util.List<RelNode> inputs)
Creates a copy of this relational expression, perhaps changing traits and
inputs.
|
abstract Project |
copy(RelTraitSet traitSet,
RelNode input,
java.util.List<RexNode> projects,
RelDataType rowType)
Copies a project.
|
Project |
copy(RelTraitSet traitSet,
RelNode input,
java.util.List<RexNode> projects,
RelDataType rowType,
int flags)
Deprecated.
|
RelWriter |
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.
|
java.util.List<RexNode> |
getChildExps()
Returns a list of this relational expression's child expressions.
|
int |
getFlags()
Deprecated.
|
Mappings.TargetMapping |
getMapping()
Returns a mapping, or null if this projection is not a mapping.
|
static Mappings.TargetMapping |
getMapping(int inputFieldCount,
java.util.List<? extends RexNode> projects)
Returns a mapping of a set of project expressions.
|
java.util.List<Pair<RexNode,java.lang.String>> |
getNamedProjects()
Returns a list of (expression, name) pairs.
|
static Mappings.TargetMapping |
getPartialMapping(int inputFieldCount,
java.util.List<? extends RexNode> projects)
Returns a partial mapping of a set of project expressions.
|
Permutation |
getPermutation()
Returns a permutation, if this projection is merely a permutation of its
input fields; otherwise null.
|
static Permutation |
getPermutation(int inputFieldCount,
java.util.List<? extends RexNode> projects)
Returns a permutation, if this projection is merely a permutation of its
input fields; otherwise null.
|
java.util.List<RexNode> |
getProjects()
Returns the project expressions.
|
boolean |
isBoxed()
Deprecated.
|
boolean |
isMapping()
Checks whether this is a functional mapping.
|
boolean |
isValid(Litmus litmus,
RelNode.Context context)
Returns whether this relational expression is valid.
|
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInput
accept, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, explain, 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
protected final com.google.common.collect.ImmutableList<RexNode> exps
protected Project(RelOptCluster cluster, RelTraitSet traits, RelNode input, java.util.List<? extends RexNode> projects, RelDataType rowType)
cluster
- Cluster that this relational expression belongs totraits
- Traits of this relational expressioninput
- Input relational expressionprojects
- List of expressions for the input columnsrowType
- Output row type@Deprecated protected Project(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, java.util.List<? extends RexNode> projects, RelDataType rowType, int flags)
protected Project(RelInput input)
public final RelNode copy(RelTraitSet traitSet, java.util.List<RelNode> inputs)
RelNode
Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.
copy
in interface RelNode
copy
in class AbstractRelNode
traitSet
- Trait setinputs
- Inputspublic abstract Project copy(RelTraitSet traitSet, RelNode input, java.util.List<RexNode> projects, RelDataType rowType)
traitSet
- Traitsinput
- Inputprojects
- Project expressionsrowType
- Output row typeProject
if any parameter differs from the value of this
Project
, or just this
if all the parameters are
the samecopy(RelTraitSet, List)
@Deprecated public Project copy(RelTraitSet traitSet, RelNode input, java.util.List<RexNode> projects, RelDataType rowType, int flags)
@Deprecated public boolean isBoxed()
public java.util.List<RexNode> getChildExps()
RelNode
RelNode.getInputs()
.
The caller should treat the list as unmodifiable; typical
implementations will return an immutable list. If there are no
child expressions, returns an empty list, not null
.
getChildExps
in interface RelNode
getChildExps
in class AbstractRelNode
RelNode.accept(org.apache.calcite.rex.RexShuttle)
public RelNode accept(RexShuttle shuttle)
RelNode
accept
in interface RelNode
accept
in class AbstractRelNode
shuttle
- Shuttlepublic java.util.List<RexNode> getProjects()
public final java.util.List<Pair<RexNode,java.lang.String>> getNamedProjects()
@Deprecated public int getFlags()
public boolean isValid(Litmus litmus, RelNode.Context context)
RelNode
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.
isValid
in interface RelNode
isValid
in class AbstractRelNode
litmus
- What to do if invalidcontext
- Context for validity checkingpublic RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
RelNode
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.
computeSelfCost
in interface RelNode
computeSelfCost
in class AbstractRelNode
planner
- Planner for cost calculationmq
- Metadata querypublic RelWriter explainTerms(RelWriter pw)
AbstractRelNode
super.explainTerms
, then call the
RelWriter.input(String, RelNode)
and
RelWriterImpl.item(String, Object)
methods for each input and attribute.explainTerms
in class SingleRel
pw
- Plan writerpublic Mappings.TargetMapping getMapping()
public static Mappings.TargetMapping getMapping(int inputFieldCount, java.util.List<? extends RexNode> projects)
The mapping is an inverse surjection.
Every target has a source field, but
a source field may appear as zero, one, or more target fields.
Thus you can safely call
Mappings.TargetMapping.getTarget(int)
.
inputFieldCount
- Number of input fieldsprojects
- Project expressionspublic static Mappings.TargetMapping getPartialMapping(int inputFieldCount, java.util.List<? extends RexNode> projects)
The mapping is an inverse function. Every target has a source field, but a source might have 0, 1 or more targets. Project expressions that do not consist of a mapping are ignored.
inputFieldCount
- Number of input fieldsprojects
- Project expressionspublic Permutation getPermutation()
public static Permutation getPermutation(int inputFieldCount, java.util.List<? extends RexNode> projects)
public boolean isMapping()
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.