Package org.apache.calcite.rel.core
Class Collect
java.lang.Object
org.apache.calcite.rel.AbstractRelNode
org.apache.calcite.rel.SingleRel
org.apache.calcite.rel.core.Collect
- All Implemented Interfaces:
Cloneable
,RelOptNode
,RelNode
- Direct Known Subclasses:
EnumerableCollect
A relational expression that collapses multiple rows into one.
Rules:
SubQueryRemoveRule
creates a Collect from a call toSqlArrayQueryConstructor
,SqlMapQueryConstructor
, orSqlMultisetQueryConstructor
.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context
-
Field Summary
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
Constructor Summary
ModifierConstructorDescriptionCollect
(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, String fieldName) Deprecated.protected
Collect
(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RelDataType rowType) Creates a Collect.Creates a Collect by parsing serialized output. -
Method Summary
Modifier and TypeMethodDescriptionfinal RelNode
copy
(RelTraitSet traitSet, List<RelNode> inputs) Creates a copy of this relational expression, perhaps changing traits and inputs.copy
(RelTraitSet traitSet, RelNode input) static Collect
create
(RelNode input, RelDataType rowType) Creates a Collect.static Collect
Creates a Collect.static Collect
create
(RelNode input, SqlTypeName collectionType, String fieldName) Deprecated.static RelDataType
deriveCollectRowType
(SingleRel rel, String fieldName) Deprecated.protected RelDataType
static RelDataType
deriveRowType
(RelDataTypeFactory typeFactory, SqlTypeName collectionType, String fieldName, RelDataType elementType) Derives the output row type of a Collect relational expression.Describes the inputs and attributes of this relational expression.Returns the collection type (ARRAY, MAP, or MULTISET).Returns the name of the sole output field.protected final RelDataType
rowType()
Returns the row type, guaranteed not null.Methods inherited from class org.apache.calcite.rel.SingleRel
childrenAccept, estimateRowCount, getInput, getInputs, replaceInput
Methods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, accept, collectVariablesSet, collectVariablesUsed, computeSelfCost, deepEquals, deepHashCode, equals, explain, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getRelDigest, getRelTypeName, getRowType, getTable, getTraitSet, getVariablesSet, hashCode, isEnforcer, isValid, metadata, onRegister, recomputeDigest, register, sole, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.calcite.rel.RelNode
explain, fieldIsNullable, stripped
-
Constructor Details
-
Collect
Creates a Collect.Use
create(org.apache.calcite.rel.RelNode, org.apache.calcite.rel.type.RelDataType)
unless you know what you're doing.- Parameters:
cluster
- ClustertraitSet
- Trait setinput
- Input relational expressionrowType
- Row type
-
Collect
@Deprecated public Collect(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, String fieldName) Deprecated. -
Collect
Creates a Collect by parsing serialized output.
-
-
Method Details
-
create
Creates a Collect.- Parameters:
input
- Input relational expressionrowType
- Row type
-
create
@Deprecated public static Collect create(RelNode input, SqlTypeName collectionType, String fieldName) Deprecated.Creates a Collect.- Parameters:
input
- Input relational expressioncollectionType
- ARRAY, MAP or MULTISETfieldName
- Name of the sole output field
-
create
Creates a Collect.- Parameters:
input
- Input relational expressionsqlKind
- SqlKindfieldName
- Name of the sole output field
-
rowType
Returns the row type, guaranteed not null. (The row type is never null after initialization, but CheckerFramework can't deduce that references are safe.) -
copy
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
-
explainTerms
Description copied from class:AbstractRelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms
, then call theRelWriter.input(String, RelNode)
andRelWriter.item(String, Object)
methods for each input and attribute.- Overrides:
explainTerms
in classSingleRel
- Parameters:
pw
- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-
getFieldName
Returns the name of the sole output field.- Returns:
- name of the sole output field
-
getCollectionType
Returns the collection type (ARRAY, MAP, or MULTISET). -
deriveRowType
- Overrides:
deriveRowType
in classSingleRel
-
deriveCollectRowType
Deprecated.Derives the output row type of a Collect relational expression.- Parameters:
rel
- relational expressionfieldName
- name of sole output field- Returns:
- output row type of a Collect relational expression
-
deriveRowType
public static RelDataType deriveRowType(RelDataTypeFactory typeFactory, SqlTypeName collectionType, String fieldName, RelDataType elementType) Derives the output row type of a Collect relational expression.- Parameters:
typeFactory
- Type factorycollectionType
- MULTISET, ARRAY or MAPfieldName
- Name of sole output fieldelementType
- Element type- Returns:
- output row type of a Collect relational expression
-