Interface CatalogTable
-
- All Superinterfaces:
CatalogBaseTable
- All Known Implementing Classes:
AbstractCatalogTable
,CatalogTableImpl
,ConnectorCatalogTable
,DefaultCatalogTable
,ExternalCatalogTable
,ResolvedCatalogTable
@PublicEvolving public interface CatalogTable extends CatalogBaseTable
Represents the unresolved metadata of a table in aCatalog
.It contains all characteristics that can be expressed in a SQL
CREATE TABLE
statement. The framework will resolve instances of this interface to aResolvedCatalogTable
before passing it to aDynamicTableFactory
for creating a connector to an external system.A catalog implementer can either use
of(Schema, String, List, Map)
for a basic implementation of this interface or create a custom class that allows passing catalog-specific objects all the way down to the connector creation (if necessary).Note: The default implementation that is available via
of(Schema, String, List, Map)
is always serializable. For example, it can be used for implementing a catalog that usesResolvedCatalogTable.toProperties()
or for persisting compiled plans. An implementation of this interface determines whether a catalog table can be serialized by providing a properCatalogBaseTable.getOptions()
method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
CatalogTable.Builder
Builder for configuring and creating instances ofCatalogTable
.-
Nested classes/interfaces inherited from interface org.apache.flink.table.catalog.CatalogBaseTable
CatalogBaseTable.TableKind
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description CatalogTable
copy(Map<String,String> options)
Returns a copy of thisCatalogTable
with given table optionsoptions
.static CatalogTable
fromProperties(Map<String,String> properties)
Creates an instance ofCatalogTable
from a map of string properties that were previously created withResolvedCatalogTable.toProperties()
.default Optional<TableDistribution>
getDistribution()
Returns the distribution of the table if theDISTRIBUTED
clause is defined.List<String>
getPartitionKeys()
Get the partition keys of the table.default Optional<Long>
getSnapshot()
Return the snapshot specified for the table.default CatalogBaseTable.TableKind
getTableKind()
The kind of table thisCatalogBaseTable
describes.boolean
isPartitioned()
Check if the table is partitioned or not.static CatalogTable.Builder
newBuilder()
Builder for configuring and creating instances ofCatalogTable
.static CatalogTable
of(Schema schema, String comment, List<String> partitionKeys, Map<String,String> options)
Deprecated.Use the buildernewBuilder()
instead.static CatalogTable
of(Schema schema, String comment, List<String> partitionKeys, Map<String,String> options, Long snapshot)
Deprecated.Use the buildernewBuilder()
instead.default Map<String,String>
toProperties()
Deprecated.Only aResolvedCatalogTable
is serializable to properties.-
Methods inherited from interface org.apache.flink.table.catalog.CatalogBaseTable
copy, getComment, getDescription, getDetailedDescription, getOptions, getSchema, getUnresolvedSchema
-
-
-
-
Method Detail
-
newBuilder
@PublicEvolving static CatalogTable.Builder newBuilder()
Builder for configuring and creating instances ofCatalogTable
.
-
of
@Deprecated static CatalogTable of(Schema schema, @Nullable String comment, List<String> partitionKeys, Map<String,String> options)
Deprecated.Use the buildernewBuilder()
instead.Creates a basic implementation of this interface.The signature is similar to a SQL
CREATE TABLE
statement.- Parameters:
schema
- unresolved schemacomment
- optional commentpartitionKeys
- list of partition keys or an empty list if not partitionedoptions
- options to configure the connector
-
of
@Deprecated static CatalogTable of(Schema schema, @Nullable String comment, List<String> partitionKeys, Map<String,String> options, @Nullable Long snapshot)
Deprecated.Use the buildernewBuilder()
instead.Creates an instance ofCatalogTable
with a specific snapshot.- Parameters:
schema
- unresolved schemacomment
- optional commentpartitionKeys
- list of partition keys or an empty list if not partitionedoptions
- options to configure the connectorsnapshot
- table snapshot of the table
-
fromProperties
static CatalogTable fromProperties(Map<String,String> properties)
Creates an instance ofCatalogTable
from a map of string properties that were previously created withResolvedCatalogTable.toProperties()
.Note that the serialization and deserialization of catalog tables are not symmetric. The framework will resolve functions and perform other validation tasks. A catalog implementation must not deal with this during a read operation.
- Parameters:
properties
- serialized version of aCatalogTable
that includes schema, partition keys, and connector options
-
getTableKind
default CatalogBaseTable.TableKind getTableKind()
Description copied from interface:CatalogBaseTable
The kind of table thisCatalogBaseTable
describes.- Specified by:
getTableKind
in interfaceCatalogBaseTable
-
isPartitioned
boolean isPartitioned()
Check if the table is partitioned or not.- Returns:
- true if the table is partitioned; otherwise, false
-
getPartitionKeys
List<String> getPartitionKeys()
Get the partition keys of the table. This will be an empty set if the table is not partitioned.- Returns:
- partition keys of the table
-
copy
CatalogTable copy(Map<String,String> options)
Returns a copy of thisCatalogTable
with given table optionsoptions
.- Returns:
- a new copy of this table with replaced table options
-
toProperties
@Deprecated default Map<String,String> toProperties()
Deprecated.Only aResolvedCatalogTable
is serializable to properties.Serializes this instance into a map of string-based properties.Compared to the pure table options in
CatalogBaseTable.getOptions()
, the map includes schema, partitioning, and other characteristics in a serialized form.
-
getSnapshot
default Optional<Long> getSnapshot()
Return the snapshot specified for the table. Return Optional.empty() if not specified.
-
getDistribution
default Optional<TableDistribution> getDistribution()
Returns the distribution of the table if theDISTRIBUTED
clause is defined.
-
-