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 FlinkPrepare.AbstractPreparingTable
implementation for the purposes of the sql-to-rel conversion and planner.
-
-
Constructor Summary
Constructors Constructor Description FlinkPreparingTableBase(org.apache.calcite.plan.RelOptSchema relOptSchema, org.apache.calcite.rel.type.RelDataType rowType, Iterable<String> names, org.apache.flink.table.planner.plan.stats.FlinkStatistic statistic)
Creates aPrepare.AbstractPreparingTable
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods 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(TableSource<?> ts)
Returns the digest of theTableSource
instance.protected org.apache.calcite.plan.RelOptTable
extend(org.apache.calcite.schema.Table extendedTable)
org.apache.calcite.sql.SqlAccessType
getAllowedAccess()
Obtains the access type of the table.List<org.apache.calcite.rel.RelCollation>
getCollationList()
Returns a description of the physical ordering (or orderings) of the rows returned from this table.org.apache.calcite.rel.RelDistribution
getDistribution()
Returns a description of the physical distribution of the rows in this table.org.apache.calcite.linq4j.tree.Expression
getExpression(Class clazz)
Generates code for this table, which is not supported now.List<org.apache.calcite.util.ImmutableBitSet>
getKeys()
org.apache.calcite.sql.validate.SqlMonotonicity
getMonotonicity(String columnName)
Obtains whether a given column is monotonic.List<String>
getNames()
Returns the table path in theRelOptSchema
.List<String>
getQualifiedName()
List<org.apache.calcite.rel.RelReferentialConstraint>
getReferentialConstraints()
Returns the referential constraints existing for this table.org.apache.calcite.plan.RelOptSchema
getRelOptSchema()
double
getRowCount()
Returns an estimate of the number of rows in the table.org.apache.calcite.rel.type.RelDataType
getRowType()
Returns the type of rows returned by this table.org.apache.flink.table.planner.plan.stats.FlinkStatistic
getStatistic()
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
isTemporal()
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>>
uniqueKeysSet()
Returns unique keySets of current table.<C> C
unwrap(Class<C> clazz)
-
Methods inherited from class org.apache.calcite.prepare.Prepare.AbstractPreparingTable
extend, getColumnStrategies
-
-
-
-
Constructor Detail
-
FlinkPreparingTableBase
public FlinkPreparingTableBase(@Nullable org.apache.calcite.plan.RelOptSchema relOptSchema, org.apache.calcite.rel.type.RelDataType rowType, Iterable<String> names, org.apache.flink.table.planner.plan.stats.FlinkStatistic statistic)
Creates aPrepare.AbstractPreparingTable
instance.- Parameters:
relOptSchema
- The RelOptSchema that this table comes fromrowType
- The table row typenames
- The table qualified namestatistic
- The table statistics
-
-
Method Detail
-
getStatistic
public org.apache.flink.table.planner.plan.stats.FlinkStatistic getStatistic()
Returns the statistic of this table.
-
getNames
public List<String> getNames()
Returns the table path in theRelOptSchema
. Different withgetQualifiedName()
, the latter is mainly used for table digest.
-
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 usingRelReferentialConstraint
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 interfaceorg.apache.calcite.sql.validate.SqlValidatorTable
- Overrides:
columnHasDefaultValue
in classorg.apache.calcite.prepare.Prepare.AbstractPreparingTable
- Parameters:
rowType
- Row type of fieldordinal
- Index of the given columninitializerContext
- Context forInitializerExpressionFactory
- 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 exampleQueryable
-
extend
protected org.apache.calcite.plan.RelOptTable extend(org.apache.calcite.schema.Table extendedTable)
- Specified by:
extend
in classorg.apache.calcite.prepare.Prepare.AbstractPreparingTable
-
explainSourceAsString
protected List<String> explainSourceAsString(TableSource<?> ts)
Returns the digest of theTableSource
instance.
-
getKeys
public List<org.apache.calcite.util.ImmutableBitSet> getKeys()
-
-