Package org.apache.flink.table.utils
Class TableSchemaUtils
java.lang.Object
org.apache.flink.table.utils.TableSchemaUtils
Utilities to
TableSchema.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TableSchema.BuilderbuilderWithGivenSchema(TableSchema oriSchema) Creates a builder with given table schema.static TableSchemacheckOnlyPhysicalColumns(TableSchema schema) Throws an exception if the givenTableSchemacontains any non-physical columns.static booleanReturns true if there are only physical columns in the givenTableSchema.static TableSchemadropConstraint(TableSchema oriSchema, String constraintName) Creates a new schema but drop the constraint with given name.static TableSchemagetPersistedSchema(TableSchema tableSchema) ReturnTableSchemawhich consists of all persisted columns.static TableSchemagetPhysicalSchema(TableSchema tableSchema) ReturnTableSchemawhich consists of all physical columns.static int[]getPrimaryKeyIndices(TableSchema schema) Returns the field indices of primary key in the physical columns of this schema (not include computed columns or metadata columns).static ResolvedSchemaremoveTimeAttributeFromResolvedSchema(ResolvedSchema resolvedSchema) Removes time attributes from theResolvedSchema.
-
Constructor Details
-
TableSchemaUtils
public TableSchemaUtils()
-
-
Method Details
-
getPhysicalSchema
ReturnTableSchemawhich consists of all physical columns. That means, the computed columns and metadata columns are filtered out.Readers(or writers) such as
TableSourceandTableSinkshould use this physical schema to generateTableSource.getProducedDataType()andTableSource.getTableSchema()rather than using the raw TableSchema which may contains additional columns. -
getPersistedSchema
ReturnTableSchemawhich consists of all persisted columns. That means, the virtual computed columns and metadata columns are filtered out.Its difference from
getPhysicalSchema(TableSchema)is that it includes of all physical columns and metadata columns without virtual keyword. -
containsPhysicalColumnsOnly
Returns true if there are only physical columns in the givenTableSchema. -
checkOnlyPhysicalColumns
Throws an exception if the givenTableSchemacontains any non-physical columns. -
getPrimaryKeyIndices
Returns the field indices of primary key in the physical columns of this schema (not include computed columns or metadata columns). -
removeTimeAttributeFromResolvedSchema
Removes time attributes from theResolvedSchema. -
builderWithGivenSchema
Creates a builder with given table schema.- Parameters:
oriSchema- Original schema- Returns:
- the builder with all the information from the given schema
-
dropConstraint
Creates a new schema but drop the constraint with given name.
-