Class TableSchema
- java.lang.Object
-
- org.apache.flink.table.legacy.api.TableSchema
-
@Deprecated @Internal public class TableSchema extends Object
Deprecated.This class has been deprecated as part of FLIP-164. It has been replaced by two more dedicated classesSchema
andResolvedSchema
. UseSchema
for declaration in APIs.ResolvedSchema
is offered by the framework after resolution and validation.A table schema that represents a table's structure with field names and data types.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TableSchema.Builder
Deprecated.Builder for creating aTableSchema
.
-
Constructor Summary
Constructors Constructor Description TableSchema(String[] fieldNames, org.apache.flink.api.common.typeinfo.TypeInformation<?>[] fieldTypes)
Deprecated.Use theTableSchema.Builder
instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static TableSchema.Builder
builder()
Deprecated.TableSchema
copy()
Deprecated.Returns a deep copy of the table schema.boolean
equals(Object o)
Deprecated.static TableSchema
fromResolvedSchema(ResolvedSchema resolvedSchema)
Deprecated.Helps to migrate to the newResolvedSchema
to old API methods.static TableSchema
fromTypeInfo(org.apache.flink.api.common.typeinfo.TypeInformation<?> typeInfo)
Deprecated.This method will be removed soon.int
getFieldCount()
Deprecated.Returns the number of fields.Optional<DataType>
getFieldDataType(int fieldIndex)
Deprecated.Returns the specified data type for the given field index.Optional<DataType>
getFieldDataType(String fieldName)
Deprecated.Returns the specified data type for the given field name.DataType[]
getFieldDataTypes()
Deprecated.Returns all field data types as an array.Optional<String>
getFieldName(int fieldIndex)
Deprecated.Returns the specified name for the given field index.String[]
getFieldNames()
Deprecated.Returns all field names as an array.Optional<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
getFieldType(int fieldIndex)
Deprecated.This method will be removed in future versions as it uses the old type system.Optional<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
getFieldType(String fieldName)
Deprecated.This method will be removed in future versions as it uses the old type system.org.apache.flink.api.common.typeinfo.TypeInformation<?>[]
getFieldTypes()
Deprecated.This method will be removed in future versions as it uses the old type system.Optional<UniqueConstraint>
getPrimaryKey()
Deprecated.Optional<TableColumn>
getTableColumn(int fieldIndex)
Deprecated.Returns theTableColumn
instance for the given field index.Optional<TableColumn>
getTableColumn(String fieldName)
Deprecated.Returns theTableColumn
instance for the given field name.List<TableColumn>
getTableColumns()
Deprecated.Returns all theTableColumn
s for this table schema.List<WatermarkSpec>
getWatermarkSpecs()
Deprecated.Returns a list of the watermark specification which contains rowtime attribute and watermark strategy expression.int
hashCode()
Deprecated.DataType
toPersistedRowDataType()
Deprecated.Converts all persisted columns of this schema into a (possibly nested) row data type.DataType
toPhysicalRowDataType()
Deprecated.Converts all physical columns of this schema into a (possibly nested) row data type.DataType
toRowDataType()
Deprecated.Converts all columns of this schema into a (possibly nested) row data type.org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row>
toRowType()
Deprecated.UsetoRowDataType()
instead.Schema
toSchema()
Deprecated.Helps to migrate to the newSchema
class.Schema
toSchema(Map<String,String> comments)
Deprecated.Helps to migrate to the newSchema
class, retain comments when needed.String
toString()
Deprecated.
-
-
-
Constructor Detail
-
TableSchema
@Deprecated public TableSchema(String[] fieldNames, org.apache.flink.api.common.typeinfo.TypeInformation<?>[] fieldTypes)
Deprecated.Use theTableSchema.Builder
instead.
-
-
Method Detail
-
copy
public TableSchema copy()
Deprecated.Returns a deep copy of the table schema.
-
getFieldDataTypes
public DataType[] getFieldDataTypes()
Deprecated.Returns all field data types as an array.
-
getFieldTypes
@Deprecated public org.apache.flink.api.common.typeinfo.TypeInformation<?>[] getFieldTypes()
Deprecated.This method will be removed in future versions as it uses the old type system. It is recommended to usegetFieldDataTypes()
instead which uses the new type system based onDataTypes
. Please make sure to use either the old or the new type system consistently to avoid unintended behavior. See the website documentation for more information.
-
getFieldDataType
public Optional<DataType> getFieldDataType(int fieldIndex)
Deprecated.Returns the specified data type for the given field index.- Parameters:
fieldIndex
- the index of the field
-
getFieldType
@Deprecated public Optional<org.apache.flink.api.common.typeinfo.TypeInformation<?>> getFieldType(int fieldIndex)
Deprecated.This method will be removed in future versions as it uses the old type system. It is recommended to usegetFieldDataType(int)
instead which uses the new type system based onDataTypes
. Please make sure to use either the old or the new type system consistently to avoid unintended behavior. See the website documentation for more information.
-
getFieldDataType
public Optional<DataType> getFieldDataType(String fieldName)
Deprecated.Returns the specified data type for the given field name.- Parameters:
fieldName
- the name of the field
-
getFieldType
@Deprecated public Optional<org.apache.flink.api.common.typeinfo.TypeInformation<?>> getFieldType(String fieldName)
Deprecated.This method will be removed in future versions as it uses the old type system. It is recommended to usegetFieldDataType(String)
instead which uses the new type system based onDataTypes
. Please make sure to use either the old or the new type system consistently to avoid unintended behavior. See the website documentation for more information.
-
getFieldCount
public int getFieldCount()
Deprecated.Returns the number of fields.
-
getFieldNames
public String[] getFieldNames()
Deprecated.Returns all field names as an array.
-
getFieldName
public Optional<String> getFieldName(int fieldIndex)
Deprecated.Returns the specified name for the given field index.- Parameters:
fieldIndex
- the index of the field
-
getTableColumn
public Optional<TableColumn> getTableColumn(int fieldIndex)
Deprecated.Returns theTableColumn
instance for the given field index.- Parameters:
fieldIndex
- the index of the field
-
getTableColumn
public Optional<TableColumn> getTableColumn(String fieldName)
Deprecated.Returns theTableColumn
instance for the given field name.- Parameters:
fieldName
- the name of the field
-
getTableColumns
public List<TableColumn> getTableColumns()
Deprecated.Returns all theTableColumn
s for this table schema.
-
toRowDataType
public DataType toRowDataType()
Deprecated.Converts all columns of this schema into a (possibly nested) row data type.This method returns the source-to-query schema.
Note: The returned row data type contains physical, computed, and metadata columns. Be careful when using this method in a table source or table sink. In many cases,
toPhysicalRowDataType()
might be more appropriate.
-
toPhysicalRowDataType
public DataType toPhysicalRowDataType()
Deprecated.Converts all physical columns of this schema into a (possibly nested) row data type.Note: The returned row data type contains only physical columns. It does not include computed or metadata columns.
-
toPersistedRowDataType
public DataType toPersistedRowDataType()
Deprecated.Converts all persisted columns of this schema into a (possibly nested) row data type.This method returns the query-to-sink schema.
Note: Computed columns and virtual columns are excluded in the returned row data type. The data type contains the columns of
toPhysicalRowDataType()
plus persisted metadata columns.
-
toRowType
@Deprecated public org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> toRowType()
Deprecated.UsetoRowDataType()
instead.
-
getWatermarkSpecs
public List<WatermarkSpec> getWatermarkSpecs()
Deprecated.Returns a list of the watermark specification which contains rowtime attribute and watermark strategy expression.NOTE: Currently, there is at most one
WatermarkSpec
in the list, because we don't support multiple watermarks definition yet. But in the future, we may support multiple watermarks.
-
getPrimaryKey
public Optional<UniqueConstraint> getPrimaryKey()
Deprecated.
-
toSchema
public Schema toSchema(Map<String,String> comments)
Deprecated.Helps to migrate to the newSchema
class, retain comments when needed.
-
fromTypeInfo
@Deprecated public static TableSchema fromTypeInfo(org.apache.flink.api.common.typeinfo.TypeInformation<?> typeInfo)
Deprecated.This method will be removed soon. UseDataTypes
to declare types.Creates a table schema from aTypeInformation
instance. If the type information is aCompositeType
, the field names and types for the composite type are used to construct theTableSchema
instance. Otherwise, a table schema with a single field is created. The field name is "f0" and the field type the provided type.- Parameters:
typeInfo
- TheTypeInformation
from which the table schema is generated.- Returns:
- The table schema that was generated from the given
TypeInformation
.
-
fromResolvedSchema
public static TableSchema fromResolvedSchema(ResolvedSchema resolvedSchema)
Deprecated.Helps to migrate to the newResolvedSchema
to old API methods.
-
builder
public static TableSchema.Builder builder()
Deprecated.
-
-