Interface TableChange
- All Known Subinterfaces:
TableChange.CatalogTableChange,TableChange.MaterializedTableChange
- All Known Implementing Classes:
TableChange.AddColumn,TableChange.AddDistribution,TableChange.AddUniqueConstraint,TableChange.AddWatermark,TableChange.DropColumn,TableChange.DropConstraint,TableChange.DropDistribution,TableChange.DropWatermark,TableChange.ModifyColumn,TableChange.ModifyColumnComment,TableChange.ModifyColumnName,TableChange.ModifyColumnPosition,TableChange.ModifyDefinitionQuery,TableChange.ModifyDistribution,TableChange.ModifyPhysicalColumnType,TableChange.ModifyRefreshHandler,TableChange.ModifyRefreshStatus,TableChange.ModifyUniqueConstraint,TableChange.ModifyWatermark,TableChange.ResetOption,TableChange.SetOption
TableChange represents the modification of the CatalogBaseTable.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA table change to add a column.static classA table change to add a distribution.static classA table change to add a unique constraint.static classA table change to add a watermark.static final classColumn position AFTER means the specified column should be put after the given `column`.static interfaceTableChange.CatalogTableChangerepresents the modification of the CatalogTable.static interfaceThe position of the modified or added column.static classA table change to drop the column.static classA table change to drop the constraints.static classA table change to drop a table's distribution.static classA table change to drop the watermark.static final classColumn position FIRST means the specified column should be the first column.static interfaceTableChange.MaterializedTableChangerepresents the modification of the materialized table.static classA base schema change to modify a column.static classA table change to modify the column comment.static classA table change to modify the column name.static classA table change to modify the column position.static classA table change to modify the definition query.static classA table change to modify a distribution.static classA table change that modify the physical column data type.static classA table change to modify materialized table refresh handler.static classA table change to modify materialized table refresh status.static classA table change to modify a unique constraint.static classA table change to modify the watermark.static classA table change to reset the table option.static classA table change to set the table option. -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic TableChange.AddColumnA table change to add the column at last.static TableChange.AddColumnadd(Column column, TableChange.ColumnPosition position) A table change to add the column with specified position.static TableChange.AddDistributionadd(TableDistribution distribution) A table change to add a distribution.add(UniqueConstraint constraint) A table change to add a unique constraint.static TableChange.AddWatermarkadd(WatermarkSpec watermarkSpec) A table change to add a watermark.static TableChange.DropColumndropColumn(String columnName) A table change to drop column.static TableChange.DropConstraintdropConstraint(String constraintName) A table change to drop constraint.static TableChange.DropDistributionA table change to drop a table's distribution.static TableChange.DropWatermarkA table change to drop watermark.static TableChange.ModifyColumnmodify(Column oldColumn, Column newColumn, TableChange.ColumnPosition columnPosition) A table change to modify a column.modify(TableDistribution distribution) A table change to modify a distribution.modify(UniqueConstraint newConstraint) A table change to modify a unique constraint.static TableChange.ModifyWatermarkmodify(WatermarkSpec newWatermarkSpec) A table change to modify a watermark.modifyColumnComment(Column oldColumn, String newComment) A table change to modify the column comment.static TableChange.ModifyColumnNamemodifyColumnName(Column oldColumn, String newName) A table change to modify the column name.modifyColumnPosition(Column oldColumn, TableChange.ColumnPosition columnPosition) A table change to modify the column position.modifyDefinitionQuery(String definitionQuery) A table change to modify materialized table definition query.modifyPhysicalColumnType(Column oldColumn, DataType newType) A table change that modify the physical column data type.modifyRefreshHandler(String refreshHandlerDesc, byte[] refreshHandlerBytes) A table change to modify materialized table refresh handler.modifyRefreshStatus(CatalogMaterializedTable.RefreshStatus refreshStatus) A table change to modify materialized table refresh status.static TableChange.ResetOptionA table change to reset the table option.static TableChange.SetOptionA table change to set the table option.
-
Method Details
-
add
A table change to add the column at last.It is equal to the following statement:
ALTER TABLE <table_name> ADD <column_definition>- Parameters:
column- the added column definition.- Returns:
- a TableChange represents the modification.
-
add
A table change to add the column with specified position.It is equal to the following statement:
ALTER TABLE <table_name> ADD <column_definition> <column_position>- Parameters:
column- the added column definition.position- added column position.- Returns:
- a TableChange represents the modification.
-
add
A table change to add a unique constraint.It is equal to the following statement:
ALTER TABLE <table_name> ADD PRIMARY KEY (<column_name>...) NOT ENFORCED- Parameters:
constraint- the added constraint definition.- Returns:
- a TableChange represents the modification.
-
add
A table change to add a distribution.It is equal to the following statement:
ALTER TABLE <table_name> ADD DISTRIBUTION ...- Parameters:
distribution- the added distribution- Returns:
- a TableChange represents the modification.
-
add
A table change to add a watermark.It is equal to the following statement:
ALTER TABLE <table_name> ADD WATERMARK FOR <row_time> AS <row_time_expression>- Parameters:
watermarkSpec- the added watermark definition.- Returns:
- a TableChange represents the modification.
-
modify
static TableChange.ModifyColumn modify(Column oldColumn, Column newColumn, @Nullable TableChange.ColumnPosition columnPosition) A table change to modify a column. The modification includes:- change column data type
- reorder column position
- modify column comment
- rename column name
- change the computed expression
- change the metadata column expression
Some fine-grained column changes are represented by the
modifyPhysicalColumnType(org.apache.flink.table.catalog.Column, org.apache.flink.table.types.DataType),modifyColumnName(org.apache.flink.table.catalog.Column, java.lang.String),modifyColumnComment(org.apache.flink.table.catalog.Column, java.lang.String)andmodifyColumnPosition(org.apache.flink.table.catalog.Column, org.apache.flink.table.catalog.TableChange.ColumnPosition).It is equal to the following statement:
ALTER TABLE <table_name> MODIFY <column_definition> COMMENT '<column_comment>' <column_position>- Parameters:
oldColumn- the definition of the old column.newColumn- the definition of the new column.columnPosition- the new position of the column.- Returns:
- a TableChange represents the modification.
-
modifyPhysicalColumnType
static TableChange.ModifyPhysicalColumnType modifyPhysicalColumnType(Column oldColumn, DataType newType) A table change that modify the physical column data type.It is equal to the following statement:
ALTER TABLE <table_name> MODIFY <column_name> <new_column_type>- Parameters:
oldColumn- the definition of the old column.newType- the type of the new column.- Returns:
- a TableChange represents the modification.
-
modifyColumnName
A table change to modify the column name.It is equal to the following statement:
ALTER TABLE <table_name> RENAME <old_column_name> TO <new_column_name>- Parameters:
oldColumn- the definition of the old column.newName- the name of the new column.- Returns:
- a TableChange represents the modification.
-
modifyColumnComment
A table change to modify the column comment.It is equal to the following statement:
ALTER TABLE <table_name> MODIFY <column_name> <original_column_type> COMMENT '<new_column_comment>'- Parameters:
oldColumn- the definition of the old column.newComment- the modified comment.- Returns:
- a TableChange represents the modification.
-
modifyColumnPosition
static TableChange.ModifyColumnPosition modifyColumnPosition(Column oldColumn, TableChange.ColumnPosition columnPosition) A table change to modify the column position.It is equal to the following statement:
ALTER TABLE <table_name> MODIFY <column_name> <original_column_type> <column_position>- Parameters:
oldColumn- the definition of the old column.columnPosition- the new position of the column.- Returns:
- a TableChange represents the modification.
-
modify
A table change to modify a unique constraint.It is equal to the following statement:
ALTER TABLE <table_name> MODIFY PRIMARY KEY (<column_name>...) NOT ENFORCED;- Parameters:
newConstraint- the modified constraint definition.- Returns:
- a TableChange represents the modification.
-
modify
A table change to modify a distribution.It is equal to the following statement:
ALTER TABLE <table_name> MODIFY DISTRIBUTION ...;- Parameters:
distribution- the modified distribution.- Returns:
- a TableChange represents the modification.
-
modify
A table change to modify a watermark.It is equal to the following statement:
ALTER TABLE <table_name> MODIFY WATERMARK FOR <row_time> AS <row_time_expression>- Parameters:
newWatermarkSpec- the modified watermark definition.- Returns:
- a TableChange represents the modification.
-
dropColumn
A table change to drop column.It is equal to the following statement:
ALTER TABLE <table_name> DROP COLUMN <column_name>- Parameters:
columnName- the column to drop.- Returns:
- a TableChange represents the modification.
-
dropWatermark
A table change to drop watermark.It is equal to the following statement:
ALTER TABLE <table_name> DROP WATERMARK- Returns:
- a TableChange represents the modification.
-
dropConstraint
A table change to drop constraint.It is equal to the following statement:
ALTER TABLE <table_name> DROP CONSTRAINT <constraint_name>- Parameters:
constraintName- the constraint to drop.- Returns:
- a TableChange represents the modification.
-
dropDistribution
A table change to drop a table's distribution.It is equal to the following statement:
ALTER TABLE <table_name> DROP DISTRIBUTION- Returns:
- a TableChange represents the modification.
-
set
A table change to set the table option.It is equal to the following statement:
ALTER TABLE <table_name> SET '<key>' = '<value>';- Parameters:
key- the option name to set.value- the option value to set.- Returns:
- a TableChange represents the modification.
-
reset
A table change to reset the table option.It is equal to the following statement:
ALTER TABLE <table_name> RESET '<key>'- Parameters:
key- the option name to reset.- Returns:
- a TableChange represents the modification.
-
modifyRefreshStatus
static TableChange.ModifyRefreshStatus modifyRefreshStatus(CatalogMaterializedTable.RefreshStatus refreshStatus) A table change to modify materialized table refresh status.- Parameters:
refreshStatus- the modified refresh status.- Returns:
- a TableChange represents the modification.
-
modifyRefreshHandler
static TableChange.ModifyRefreshHandler modifyRefreshHandler(String refreshHandlerDesc, byte[] refreshHandlerBytes) A table change to modify materialized table refresh handler.- Parameters:
refreshHandlerDesc- the modified refresh handler description.refreshHandlerBytes- the modified refresh handler bytes.- Returns:
- a TableChange represents the modification.
-
modifyDefinitionQuery
A table change to modify materialized table definition query.- Parameters:
definitionQuery- the modified definition query.- Returns:
- a TableChange represents the modification.
-