java.lang.Object
org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.AbstractRelNode
org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.SingleRel
org.apache.beam.sdk.extensions.sql.zetasql.unnest.ZetaSqlUnnest
All Implemented Interfaces:
Cloneable, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelOptNode, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode
Direct Known Subclasses:
BeamZetaSqlUncollectRel, BeamZetaSqlUnnestRel

public class ZetaSqlUnnest extends org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.SingleRel
This class is a copy of Uncollect.java in Calcite: https://github.com/apache/calcite/blob/calcite-1.20.0/core/src/main/java/org/apache/calcite/rel/core/Uncollect.java except that in deriveUncollectRowType() it does not unwrap array elements of struct type.

Details of why unwrapping structs breaks ZetaSQL UNNEST syntax is in https://issues.apache.org/jira/browse/BEAM-10896.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode

    org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode.Context
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final boolean
     

    Fields inherited from class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.SingleRel

    input

    Fields inherited from class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.AbstractRelNode

    digest, id, rowType, traitSet
  • Constructor Summary

    Constructors
    Constructor
    Description
    ZetaSqlUnnest(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelOptCluster cluster, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet traitSet, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode input, boolean withOrdinality)
    Creates an Uncollect.
    ZetaSqlUnnest(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelInput input)
    Creates an Uncollect by parsing serialized output.
  • Method Summary

    Modifier and Type
    Method
    Description
    final org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode
    copy(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet traitSet, List<org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode> inputs)
     
    org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode
    copy(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet traitSet, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode input)
     
    create(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet traitSet, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode input, boolean withOrdinality)
    Creates an Uncollect.
    protected org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataType
     
    static org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataType
    deriveUncollectRowType(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode rel, boolean withOrdinality)
    Returns the row type returned by applying the 'UNNEST' operation to a relational expression.
    org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelWriter
    explainTerms(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelWriter pw)
     

    Methods inherited from class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.SingleRel

    childrenAccept, estimateRowCount, getInput, getInputs, replaceInput

    Methods inherited from class org.apache.beam.vendor.calcite.v1_28_0.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.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode

    explain, fieldIsNullable
  • Field Details

    • withOrdinality

      public final boolean withOrdinality
  • Constructor Details

  • Method Details

    • create

      public static ZetaSqlUnnest create(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet traitSet, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode input, boolean withOrdinality)
      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
    • explainTerms

      public org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelWriter explainTerms(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelWriter pw)
      Overrides:
      explainTerms in class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.SingleRel
    • copy

      public final org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode copy(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet traitSet, List<org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode> inputs)
      Specified by:
      copy in interface org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode
      Overrides:
      copy in class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.AbstractRelNode
    • copy

      public org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode copy(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelTraitSet traitSet, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode input)
    • deriveRowType

      protected org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataType deriveRowType()
      Overrides:
      deriveRowType in class org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.SingleRel
    • deriveUncollectRowType

      public static org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataType deriveUncollectRowType(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelNode rel, boolean withOrdinality)
      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 type of that column, plus an ORDINALITY column if withOrdinality.