Class Collect

All Implemented Interfaces:
Cloneable, RelOptNode, RelNode
Direct Known Subclasses:
EnumerableCollect

public class Collect extends SingleRel
A relational expression that collapses multiple rows into one.

Rules:

  • Constructor Details

  • Method Details

    • create

      public static Collect create(RelNode input, RelDataType rowType)
      Creates a Collect.
      Parameters:
      input - Input relational expression
      rowType - Row type
    • create

      @Deprecated public static Collect create(RelNode input, SqlTypeName collectionType, String fieldName)
      Deprecated.
      Creates a Collect.
      Parameters:
      input - Input relational expression
      collectionType - ARRAY, MAP or MULTISET
      fieldName - Name of the sole output field
    • create

      public static Collect create(RelNode input, SqlKind sqlKind, String fieldName)
      Creates a Collect.
      Parameters:
      input - Input relational expression
      sqlKind - SqlKind
      fieldName - Name of the sole output field
    • rowType

      protected final RelDataType 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

      public final RelNode 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 RelNode copy(RelTraitSet traitSet, RelNode input)
    • 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
    • getFieldName

      public String getFieldName()
      Returns the name of the sole output field.
      Returns:
      name of the sole output field
    • getCollectionType

      public SqlTypeName getCollectionType()
      Returns the collection type (ARRAY, MAP, or MULTISET).
    • deriveRowType

      protected RelDataType deriveRowType()
      Overrides:
      deriveRowType in class SingleRel
    • deriveCollectRowType

      @Deprecated public static RelDataType deriveCollectRowType(SingleRel rel, String fieldName)
      Deprecated.
      Derives the output row type of a Collect relational expression.
      Parameters:
      rel - relational expression
      fieldName - 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 factory
      collectionType - MULTISET, ARRAY or MAP
      fieldName - Name of sole output field
      elementType - Element type
      Returns:
      output row type of a Collect relational expression