Class FlinkPreparingTableBase

java.lang.Object
org.apache.calcite.prepare.Prepare.AbstractPreparingTable
org.apache.flink.table.planner.plan.schema.FlinkPreparingTableBase
All Implemented Interfaces:
org.apache.calcite.plan.RelOptTable, org.apache.calcite.prepare.Prepare.PreparingTable, org.apache.calcite.schema.Wrapper, org.apache.calcite.sql.validate.SqlValidatorTable
Direct Known Subclasses:
CatalogSourceTable, ExpandingPreparingTable

@Internal public abstract class FlinkPreparingTableBase extends org.apache.calcite.prepare.Prepare.AbstractPreparingTable
A Flink Prepare.AbstractPreparingTable implementation for the purposes of the sql-to-rel conversion and planner.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.calcite.plan.RelOptTable

    org.apache.calcite.plan.RelOptTable.ToRelContext, org.apache.calcite.plan.RelOptTable.ViewExpander
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final List<String>
     
    protected final org.apache.calcite.plan.RelOptSchema
     
    protected final org.apache.calcite.rel.type.RelDataType
     
    protected FlinkStatistic
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    FlinkPreparingTableBase(org.apache.calcite.plan.RelOptSchema relOptSchema, org.apache.calcite.rel.type.RelDataType rowType, Iterable<String> names, FlinkStatistic statistic)
    Creates a Prepare.AbstractPreparingTable instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    columnHasDefaultValue(org.apache.calcite.rel.type.RelDataType rowType, int ordinal, org.apache.calcite.sql2rel.InitializerContext initializerContext)
    Obtains whether the ordinal column has a default value, which is not supported now.
    protected List<String>
    explainSourceAsString(org.apache.flink.table.legacy.sources.TableSource<?> ts)
    Returns the digest of the TableSource instance.
    protected org.apache.calcite.plan.RelOptTable
    extend(org.apache.calcite.schema.Table extendedTable)
     
    org.apache.calcite.sql.SqlAccessType
    Obtains the access type of the table.
    List<org.apache.calcite.rel.RelCollation>
    Returns a description of the physical ordering (or orderings) of the rows returned from this table.
    org.apache.calcite.rel.RelDistribution
    Returns a description of the physical distribution of the rows in this table.
    org.apache.calcite.linq4j.tree.Expression
    Generates code for this table, which is not supported now.
    List<org.apache.calcite.util.ImmutableBitSet>
     
    org.apache.calcite.sql.validate.SqlMonotonicity
    getMonotonicity(String columnName)
    Obtains whether a given column is monotonic.
    Returns the table path in the RelOptSchema.
     
    List<org.apache.calcite.rel.RelReferentialConstraint>
    Returns the referential constraints existing for this table.
    org.apache.calcite.plan.RelOptSchema
     
    double
    Returns an estimate of the number of rows in the table.
    org.apache.calcite.rel.type.RelDataType
    Returns the type of rows returned by this table.
    FlinkStatistic
    Returns the statistic of this table.
    boolean
    isKey(org.apache.calcite.util.ImmutableBitSet columns)
    Returns whether the given columns are a key or a superset of a unique key of this table.
    boolean
    We recognize all tables in FLink are temporal as they are changeable.
    boolean
    supportsModality(org.apache.calcite.sql.validate.SqlModality modality)
     
    org.apache.calcite.rel.RelNode
    toRel(org.apache.calcite.plan.RelOptTable.ToRelContext context)
     
    Optional<Set<org.apache.calcite.util.ImmutableBitSet>>
    Returns unique keySets of current table.
    <C> C
    unwrap(Class<C> clazz)
     

    Methods inherited from class org.apache.calcite.prepare.Prepare.AbstractPreparingTable

    extend, getColumnStrategies

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.calcite.sql.validate.SqlValidatorTable

    table

    Methods inherited from interface org.apache.calcite.schema.Wrapper

    maybeUnwrap, unwrapOrThrow
  • Field Details

    • relOptSchema

      @Nullable protected final org.apache.calcite.plan.RelOptSchema relOptSchema
    • rowType

      protected final org.apache.calcite.rel.type.RelDataType rowType
    • names

      protected final List<String> names
    • statistic

      protected FlinkStatistic statistic
  • Constructor Details

    • FlinkPreparingTableBase

      public FlinkPreparingTableBase(@Nullable org.apache.calcite.plan.RelOptSchema relOptSchema, org.apache.calcite.rel.type.RelDataType rowType, Iterable<String> names, FlinkStatistic statistic)
      Creates a Prepare.AbstractPreparingTable instance.
      Parameters:
      relOptSchema - The RelOptSchema that this table comes from
      rowType - The table row type
      names - The table qualified name
      statistic - The table statistics
  • Method Details

    • getStatistic

      public FlinkStatistic getStatistic()
      Returns the statistic of this table.
    • getNames

      public List<String> getNames()
      Returns the table path in the RelOptSchema. Different with getQualifiedName(), the latter is mainly used for table digest.
    • getQualifiedName

      public List<String> getQualifiedName()
    • toRel

      public org.apache.calcite.rel.RelNode toRel(org.apache.calcite.plan.RelOptTable.ToRelContext context)
    • getMonotonicity

      public org.apache.calcite.sql.validate.SqlMonotonicity getMonotonicity(String columnName)
      Obtains whether a given column is monotonic.
      Parameters:
      columnName - Column name
      Returns:
      True if the given column is monotonic
    • getAllowedAccess

      public org.apache.calcite.sql.SqlAccessType getAllowedAccess()
      Obtains the access type of the table.
      Returns:
      all access types including SELECT/UPDATE/INSERT/DELETE
    • supportsModality

      public boolean supportsModality(org.apache.calcite.sql.validate.SqlModality modality)
    • isTemporal

      public boolean isTemporal()
      We recognize all tables in FLink are temporal as they are changeable.
    • getRowCount

      public double getRowCount()
      Returns an estimate of the number of rows in the table.
    • getRowType

      public org.apache.calcite.rel.type.RelDataType getRowType()
      Returns the type of rows returned by this table.
    • getRelOptSchema

      public org.apache.calcite.plan.RelOptSchema getRelOptSchema()
    • getCollationList

      public List<org.apache.calcite.rel.RelCollation> getCollationList()
      Returns a description of the physical ordering (or orderings) of the rows returned from this table.
      See Also:
      • RelMetadataQuery.collations(RelNode)
    • getDistribution

      public org.apache.calcite.rel.RelDistribution getDistribution()
      Returns a description of the physical distribution of the rows in this table.
      See Also:
      • RelMetadataQuery.distribution(org.apache.calcite.rel.RelNode)
    • isKey

      public boolean isKey(org.apache.calcite.util.ImmutableBitSet columns)
      Returns whether the given columns are a key or a superset of a unique key of this table.

      Note: Return true means TRUE. However return false means FALSE or NOT KNOWN. It's better to use RelMetadataQuery.areRowsUnique(org.apache.calcite.rel.RelNode, boolean) to distinguish FALSE with NOT KNOWN.

      Parameters:
      columns - Ordinals of key columns
      Returns:
      If the input columns bits represents a unique column set; false if not (or if no metadata is available)
    • getReferentialConstraints

      public List<org.apache.calcite.rel.RelReferentialConstraint> getReferentialConstraints()
      Returns the referential constraints existing for this table. These constraints are represented over other tables using RelReferentialConstraint nodes.
    • unwrap

      public <C> C unwrap(Class<C> clazz)
    • columnHasDefaultValue

      public boolean columnHasDefaultValue(org.apache.calcite.rel.type.RelDataType rowType, int ordinal, org.apache.calcite.sql2rel.InitializerContext initializerContext)
      Obtains whether the ordinal column has a default value, which is not supported now.
      Specified by:
      columnHasDefaultValue in interface org.apache.calcite.sql.validate.SqlValidatorTable
      Overrides:
      columnHasDefaultValue in class org.apache.calcite.prepare.Prepare.AbstractPreparingTable
      Parameters:
      rowType - Row type of field
      ordinal - Index of the given column
      initializerContext - Context for InitializerExpressionFactory
      Returns:
      true if the column has a default value
    • getExpression

      public org.apache.calcite.linq4j.tree.Expression getExpression(Class clazz)
      Generates code for this table, which is not supported now.
      Parameters:
      clazz - The desired collection class, for example Queryable
    • extend

      protected org.apache.calcite.plan.RelOptTable extend(org.apache.calcite.schema.Table extendedTable)
      Specified by:
      extend in class org.apache.calcite.prepare.Prepare.AbstractPreparingTable
    • explainSourceAsString

      protected List<String> explainSourceAsString(org.apache.flink.table.legacy.sources.TableSource<?> ts)
      Returns the digest of the TableSource instance.
    • getKeys

      public List<org.apache.calcite.util.ImmutableBitSet> getKeys()
    • uniqueKeysSet

      public Optional<Set<org.apache.calcite.util.ImmutableBitSet>> uniqueKeysSet()
      Returns unique keySets of current table.