Class TableFunctionScan

java.lang.Object
org.apache.calcite.rel.AbstractRelNode
org.apache.calcite.rel.core.TableFunctionScan
All Implemented Interfaces:
Cloneable, RelOptNode, Hintable, RelNode
Direct Known Subclasses:
EnumerableTableFunctionScan, LogicalTableFunctionScan

public abstract class TableFunctionScan extends AbstractRelNode implements Hintable
Relational expression that calls a table-valued function.

The function returns a result set. It can appear as a leaf in a query tree, or can be applied to relational inputs.

See Also:
  • Field Details

    • columnMappings

      protected final @Nullable com.google.common.collect.ImmutableSet<RelColumnMapping> columnMappings
    • hints

      protected final com.google.common.collect.ImmutableList<RelHint> hints
  • Constructor Details

    • TableFunctionScan

      protected TableFunctionScan(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, List<RelNode> inputs, RexNode rexCall, @Nullable Type elementType, RelDataType rowType, @Nullable Set<RelColumnMapping> columnMappings)
      Creates a TableFunctionScan.
      Parameters:
      cluster - Cluster that this relational expression belongs to
      traitSet - Trait set
      hints - hints of this node.
      inputs - 0 or more relational inputs
      rexCall - Function invocation expression
      elementType - Element type of the collection that will implement this table
      rowType - Row type produced by function
      columnMappings - Column mappings associated with this function
    • TableFunctionScan

      protected TableFunctionScan(RelOptCluster cluster, RelTraitSet traitSet, List<RelNode> inputs, RexNode rexCall, @Nullable Type elementType, RelDataType rowType, @Nullable Set<RelColumnMapping> columnMappings)
      Creates a TableFunctionScan.
      Parameters:
      cluster - Cluster that this relational expression belongs to
      traitSet - Trait set
      inputs - 0 or more relational inputs
      rexCall - Function invocation expression
      elementType - Element type of the collection that will implement this table
      rowType - Row type produced by function
      columnMappings - Column mappings associated with this function
    • TableFunctionScan

      protected TableFunctionScan(RelInput input)
      Creates a TableFunctionScan by parsing serialized output.
  • Method Details

    • copy

      public final TableFunctionScan 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 abstract TableFunctionScan copy(RelTraitSet traitSet, List<RelNode> inputs, RexNode rexCall, @Nullable Type elementType, RelDataType rowType, @Nullable Set<RelColumnMapping> columnMappings)
      Copies this relational expression, substituting traits and inputs.
      Parameters:
      traitSet - Traits
      inputs - 0 or more relational inputs
      rexCall - Function invocation expression
      elementType - Element type of the collection that will implement this table
      rowType - Row type produced by function
      columnMappings - Column mappings associated with this function
      Returns:
      Copy of this relational expression, substituting traits and inputs
    • getInputs

      public List<RelNode> getInputs()
      Description copied from interface: RelNode
      Returns an array of this relational expression's inputs. If there are no inputs, returns an empty list, not null.
      Specified by:
      getInputs in interface RelNode
      Specified by:
      getInputs in interface RelOptNode
      Overrides:
      getInputs in class AbstractRelNode
      Returns:
      Array of this relational expression's inputs
    • accept

      public RelNode accept(RexShuttle shuttle)
      Description copied from interface: RelNode
      Accepts a visit from a shuttle. If the shuttle updates expression, then a copy of the relation should be created. This new relation might have a different row-type.
      Specified by:
      accept in interface RelNode
      Overrides:
      accept in class AbstractRelNode
      Parameters:
      shuttle - Shuttle
      Returns:
      A copy of this node incorporating changes made by the shuttle to this node's children
    • replaceInput

      public void replaceInput(int ordinalInParent, RelNode p)
      Description copied from interface: RelNode
      Replaces the ordinalInParentth input. You must override this method if you override RelNode.getInputs().
      Specified by:
      replaceInput in interface RelNode
      Overrides:
      replaceInput in class AbstractRelNode
      Parameters:
      ordinalInParent - Position of the child input, 0 is the first
      p - New node that should be put at position ordinalInParent
    • estimateRowCount

      public double estimateRowCount(RelMetadataQuery mq)
      Description copied from interface: RelNode
      Returns an estimate of the number of rows this relational expression will return.

      NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use RelMetadataQuery.getRowCount(org.apache.calcite.rel.RelNode), which gives plugins a chance to override the rel's default ideas about row count.

      Specified by:
      estimateRowCount in interface RelNode
      Overrides:
      estimateRowCount in class AbstractRelNode
      Parameters:
      mq - Metadata query
      Returns:
      Estimate of the number of rows this relational expression will return
    • getCall

      public RexNode getCall()
      Returns function invocation expression.

      Within this rexCall, instances of RexInputRef refer to entire input RelNodes rather than their fields.

      Returns:
      function invocation expression
    • 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 AbstractRelNode
      Parameters:
      pw - Plan writer
      Returns:
      Plan writer for fluent-explain pattern
    • getColumnMappings

      public @Nullable Set<RelColumnMapping> getColumnMappings()
      Returns set of mappings known for this table function, or null if unknown (not the same as empty!).
      Returns:
      set of mappings known for this table function, or null if unknown (not the same as empty!)
    • getElementType

      public @Nullable Type getElementType()
      Returns element type of the collection that will implement this table.
      Returns:
      element type of the collection that will implement this table
    • getHints

      public com.google.common.collect.ImmutableList<RelHint> getHints()
      Description copied from interface: Hintable
      Returns the hints of this relational expressions as an immutable list.
      Specified by:
      getHints in interface Hintable