Class SpoolRelOptTable

java.lang.Object
org.apache.calcite.plan.SpoolRelOptTable
All Implemented Interfaces:
RelOptTable, Wrapper

public class SpoolRelOptTable extends Object implements RelOptTable
Implementation of RelOptTable for temporary spool tables.

This table represents temporary storage used by spool operators during query execution. It's used for planning purposes only and will be converted to appropriate physical operators later.

  • Constructor Details

    • SpoolRelOptTable

      public SpoolRelOptTable(@Nullable RelOptSchema schema, RelDataType rowType, String name, double rowCount)
      Creates a SpoolRelOptTable with explicit row count.
      Parameters:
      schema - the schema this table belongs to (can be null for temporary tables)
      rowType - the row type of the data that will be stored in this spool
      name - optional name for the spool table
      rowCount - the estimated number of rows that will be materialized in this spool
  • Method Details

    • toRel

      public RelNode toRel(RelOptTable.ToRelContext context)
      Description copied from interface: RelOptTable
      Converts this table into a relational expression.

      The planner calls this method to convert a table into an initial relational expression, generally something abstract, such as a LogicalTableScan, then optimizes this expression by applying rules to transform it into more efficient access methods for this table.

      Specified by:
      toRel in interface RelOptTable
    • getQualifiedName

      public List<String> getQualifiedName()
      Description copied from interface: RelOptTable
      Obtains an identifier for this table. The identifier must be unique with respect to the Connection producing this table.
      Specified by:
      getQualifiedName in interface RelOptTable
      Returns:
      qualified name
    • getRowCount

      public double getRowCount()
      Description copied from interface: RelOptTable
      Returns an estimate of the number of rows in the table.
      Specified by:
      getRowCount in interface RelOptTable
    • getRowType

      public RelDataType getRowType()
      Description copied from interface: RelOptTable
      Describes the type of rows returned by this table.
      Specified by:
      getRowType in interface RelOptTable
    • getRelOptSchema

      public @Nullable RelOptSchema getRelOptSchema()
      Description copied from interface: RelOptTable
      Returns the RelOptSchema this table belongs to.
      Specified by:
      getRelOptSchema in interface RelOptTable
    • getDistribution

      public @Nullable RelDistribution getDistribution()
      Description copied from interface: RelOptTable
      Returns a description of the physical distribution of the rows in this table.
      Specified by:
      getDistribution in interface RelOptTable
      See Also:
    • getKeys

      public @Nullable List<ImmutableBitSet> getKeys()
      Description copied from interface: RelOptTable
      Returns a list of unique keys, empty list if no key exist, the result should be consistent with isKey.
      Specified by:
      getKeys in interface RelOptTable
    • getReferentialConstraints

      public @Nullable List<RelReferentialConstraint> getReferentialConstraints()
      Description copied from interface: RelOptTable
      Returns the referential constraints existing for this table. These constraints are represented over other tables using RelReferentialConstraint nodes.
      Specified by:
      getReferentialConstraints in interface RelOptTable
    • getCollationList

      public @Nullable List<RelCollation> getCollationList()
      Description copied from interface: RelOptTable
      Returns a description of the physical ordering (or orderings) of the rows returned from this table.
      Specified by:
      getCollationList in interface RelOptTable
      See Also:
    • isKey

      public boolean isKey(ImmutableBitSet columns)
      Description copied from interface: RelOptTable
      Returns whether the given columns are a key or a superset of a unique key of this table.
      Specified by:
      isKey in interface RelOptTable
      Parameters:
      columns - Ordinals of key columns
      Returns:
      Whether the given columns are a key or a superset of a key
    • getExpression

      public @Nullable Expression getExpression(Class clazz)
      Description copied from interface: RelOptTable
      Generates code for this table.
      Specified by:
      getExpression in interface RelOptTable
      Parameters:
      clazz - The desired collection class; for example Queryable.
      Returns:
      the code for the table, or null if code generation is not supported
    • extend

      public RelOptTable extend(List<RelDataTypeField> extendedFields)
      Description copied from interface: RelOptTable
      Returns a table with the given extra fields.

      The extended table includes the fields of this base table plus the extended fields that do not have the same name as a field in the base table.

      Specified by:
      extend in interface RelOptTable
    • getColumnStrategies

      public List<ColumnStrategy> getColumnStrategies()
      Description copied from interface: RelOptTable
      Returns a list describing how each column is populated. The list has the same number of entries as there are fields, and is immutable.
      Specified by:
      getColumnStrategies in interface RelOptTable
    • unwrap

      public <C> @Nullable C unwrap(Class<C> aClass)
      Description copied from interface: Wrapper
      Finds an instance of an interface implemented by this object, or returns null if this object does not support that interface.
      Specified by:
      unwrap in interface Wrapper