Class ResolvedSchema
This class is the result of resolving a Schema into a final validated representation.
- Data types and functions have been expanded to fully qualified identifiers.
- Time attributes are represented in the column's data type.
Expressions have been translated toResolvedExpression.AbstractDataTypes have been translated toDataType.
This class should not be passed into a connector. It is therefore also not serializable.
Instead, the toPhysicalRowDataType() can be passed around where necessary.
-
Constructor Summary
ConstructorsConstructorDescriptionResolvedSchema(List<org.apache.flink.table.catalog.Column> columns, List<org.apache.flink.table.catalog.WatermarkSpec> watermarkSpecs, org.apache.flink.table.catalog.UniqueConstraint primaryKey) Deprecated.ResolvedSchema(List<org.apache.flink.table.catalog.Column> columns, List<org.apache.flink.table.catalog.WatermarkSpec> watermarkSpecs, org.apache.flink.table.catalog.UniqueConstraint primaryKey, List<org.apache.flink.table.catalog.Index> indexes) ResolvedSchema(List<org.apache.flink.table.catalog.Column> columns, List<org.apache.flink.table.catalog.WatermarkSpec> watermarkSpecs, org.apache.flink.table.catalog.UniqueConstraint primaryKey, List<org.apache.flink.table.catalog.Index> indexes, org.apache.flink.table.catalog.ImmutableColumnsConstraint immutableColumns) -
Method Summary
Modifier and TypeMethodDescriptionbooleanOptional<org.apache.flink.table.catalog.Column>getColumn(int columnIndex) Returns theColumninstance for the given column index.Optional<org.apache.flink.table.catalog.Column>Returns theColumninstance for the given column name.intReturns the number ofColumns of this schema.Returns all column data types.Returns all column names.List<org.apache.flink.table.catalog.Column>Returns allColumns of this schema.int[]Returns the indexes of columns about the immutable constraint in thetoPhysicalRowDataType(), if any, otherwise returns an empty array.Optional<org.apache.flink.table.catalog.ImmutableColumnsConstraint>Returns the constraint about immutable columns if it has been defined.List<org.apache.flink.table.catalog.Index>Returns all table indexes.Optional<org.apache.flink.table.catalog.UniqueConstraint>Returns the primary key if it has been defined.int[]Returns the primary key indexes in thetoPhysicalRowDataType(), if any, otherwise returns an empty array.List<org.apache.flink.table.catalog.WatermarkSpec>Returns a list of watermark specifications each consisting of a rowtime attribute and watermark strategy expression.inthashCode()static ResolvedSchemaShortcut for a resolved schema of only columns.static ResolvedSchemaof(org.apache.flink.table.catalog.Column... columns) Shortcut for a resolved schema of only columns.static ResolvedSchemaShortcut for a resolved schema of only physical columns.static ResolvedSchemaShortcut for a resolved schema of only physical columns.Converts all physical columns of this schema into a (possibly nested) row data type.Converts all persisted columns of this schema into a (possibly nested) row data type.Converts all columns of this schema into a (possibly nested) row data type.toString()
-
Constructor Details
-
ResolvedSchema
@Deprecated public ResolvedSchema(List<org.apache.flink.table.catalog.Column> columns, List<org.apache.flink.table.catalog.WatermarkSpec> watermarkSpecs, @Nullable org.apache.flink.table.catalog.UniqueConstraint primaryKey) Deprecated.Please useResolvedSchema(List, List, UniqueConstraint, List, ImmutableColumnsConstraint)instead. -
ResolvedSchema
-
ResolvedSchema
public ResolvedSchema(List<org.apache.flink.table.catalog.Column> columns, List<org.apache.flink.table.catalog.WatermarkSpec> watermarkSpecs, @Nullable org.apache.flink.table.catalog.UniqueConstraint primaryKey, List<org.apache.flink.table.catalog.Index> indexes, @Nullable org.apache.flink.table.catalog.ImmutableColumnsConstraint immutableColumns)
-
-
Method Details
-
of
Shortcut for a resolved schema of only columns. -
of
Shortcut for a resolved schema of only columns. -
physical
Shortcut for a resolved schema of only physical columns. -
physical
Shortcut for a resolved schema of only physical columns. -
getColumnCount
public int getColumnCount()Returns the number ofColumns of this schema. -
getColumns
Returns allColumns of this schema. -
getColumnNames
Returns all column names. It does not distinguish between different kinds of columns. -
getColumnDataTypes
Returns all column data types. It does not distinguish between different kinds of columns. -
getColumn
Returns theColumninstance for the given column index.- Parameters:
columnIndex- the index of the column
-
getColumn
Returns theColumninstance for the given column name.- Parameters:
columnName- the name of the column
-
getWatermarkSpecs
Returns a list of watermark specifications each consisting of a rowtime attribute and watermark strategy expression.Note: Currently, there is at most one
WatermarkSpecin the list, because we don't support multiple watermark definitions yet. -
getPrimaryKey
Returns the primary key if it has been defined. -
getIndexes
Returns all table indexes. -
getImmutableColumns
Returns the constraint about immutable columns if it has been defined. -
getPrimaryKeyIndexes
public int[] getPrimaryKeyIndexes()Returns the primary key indexes in thetoPhysicalRowDataType(), if any, otherwise returns an empty array. -
getImmutableColumnIndexes
public int[] getImmutableColumnIndexes()Returns the indexes of columns about the immutable constraint in thetoPhysicalRowDataType(), if any, otherwise returns an empty array. -
toSourceRowDataType
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
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.
-
toSinkRowDataType
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. -
toString
-
equals
-
hashCode
public int hashCode()
-