Class Uncollect

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

public class Uncollect extends SingleRel
Relational expression that unnests its input's columns into a relation.

The input may have multiple columns, but each must be a multiset or array. If withOrdinality, the output contains an extra ORDINALITY column.

Like its inverse operation Collect, Uncollect is generally invoked in a nested loop, driven by LogicalCorrelate or similar.

  • Field Details

    • withOrdinality

      public final boolean withOrdinality
  • Constructor Details

  • Method Details

    • create

      public static Uncollect create(RelTraitSet traitSet, RelNode input, boolean withOrdinality, List<String> itemAliases)
      Creates an Uncollect.

      Each field of the input relational expression must be an array or multiset.

      Parameters:
      traitSet - Trait set
      input - Input relational expression
      withOrdinality - Whether output should contain an ORDINALITY column
      itemAliases - Aliases for the operand items
    • 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
    • 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)
    • deriveRowType

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

      public static RelDataType deriveUncollectRowType(RelNode rel, boolean withOrdinality, List<String> itemAliases)
      Returns the row type returned by applying the 'UNNEST' operation to a relational expression.

      Each column in the relational expression must be a multiset of structs or an array. The return type is the combination of expanding element types from each column, plus an ORDINALITY column if withOrdinality. If itemAliases is not empty, the element types would not expand, each column element outputs as a whole (the return type has same column types as input type).