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
@PublicEvolving public interface TableChangeTableChangerepresents the modification of theCatalogBaseTable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classTableChange.AddColumnA table change to add a column.static classTableChange.AddDistributionA table change to add a distribution.static classTableChange.AddUniqueConstraintA table change to add a unique constraint.static classTableChange.AddWatermarkA table change to add a watermark.static classTableChange.AfterColumn position AFTER means the specified column should be put after the given `column`.static interfaceTableChange.CatalogTableChangeTableChange.CatalogTableChangerepresents the modification of the CatalogTable.static interfaceTableChange.ColumnPositionThe position of the modified or added column.static classTableChange.DropColumnA table change to drop the column.static classTableChange.DropConstraintA table change to drop the constraints.static classTableChange.DropDistributionA table change to drop a table's distribution.static classTableChange.DropWatermarkA table change to drop the watermark.static classTableChange.FirstColumn position FIRST means the specified column should be the first column.static interfaceTableChange.MaterializedTableChangeTableChange.MaterializedTableChangerepresents the modification of the materialized table.static classTableChange.ModifyColumnA base schema change to modify a column.static classTableChange.ModifyColumnCommentA table change to modify the column comment.static classTableChange.ModifyColumnNameA table change to modify the column name.static classTableChange.ModifyColumnPositionA table change to modify the column position.static classTableChange.ModifyDefinitionQueryA table change to modify the definition query.static classTableChange.ModifyDistributionA table change to modify a distribution.static classTableChange.ModifyPhysicalColumnTypeA table change that modify the physical column data type.static classTableChange.ModifyRefreshHandlerA table change to modify materialized table refresh handler.static classTableChange.ModifyRefreshStatusA table change to modify materialized table refresh status.static classTableChange.ModifyUniqueConstraintA table change to modify a unique constraint.static classTableChange.ModifyWatermarkA table change to modify the watermark.static classTableChange.ResetOptionA table change to reset the table option.static classTableChange.SetOptionA table change to set the table option.
-
Method Summary
Static Methods Modifier and Type Method Description static TableChange.AddColumnadd(Column column)A 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.static TableChange.AddUniqueConstraintadd(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.DropDistributiondropDistribution()A table change to drop a table's distribution.static TableChange.DropWatermarkdropWatermark()A table change to drop watermark.static TableChange.ModifyColumnmodify(Column oldColumn, Column newColumn, TableChange.ColumnPosition columnPosition)A table change to modify a column.static TableChange.ModifyDistributionmodify(TableDistribution distribution)A table change to modify a distribution.static TableChange.ModifyUniqueConstraintmodify(UniqueConstraint newConstraint)A table change to modify a unique constraint.static TableChange.ModifyWatermarkmodify(WatermarkSpec newWatermarkSpec)A table change to modify a watermark.static TableChange.ModifyColumnCommentmodifyColumnComment(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.static TableChange.ModifyColumnPositionmodifyColumnPosition(Column oldColumn, TableChange.ColumnPosition columnPosition)A table change to modify the column position.static TableChange.ModifyDefinitionQuerymodifyDefinitionQuery(String definitionQuery)A table change to modify materialized table definition query.static TableChange.ModifyPhysicalColumnTypemodifyPhysicalColumnType(Column oldColumn, DataType newType)A table change that modify the physical column data type.static TableChange.ModifyRefreshHandlermodifyRefreshHandler(String refreshHandlerDesc, byte[] refreshHandlerBytes)A table change to modify materialized table refresh handler.static TableChange.ModifyRefreshStatusmodifyRefreshStatus(CatalogMaterializedTable.RefreshStatus refreshStatus)A table change to modify materialized table refresh status.static TableChange.ResetOptionreset(String key)A table change to reset the table option.static TableChange.SetOptionset(String key, String value)A table change to set the table option.
-
-
-
Method Detail
-
add
static TableChange.AddColumn add(Column column)
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
static TableChange.AddColumn add(Column column, @Nullable TableChange.ColumnPosition position)
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
static TableChange.AddUniqueConstraint add(UniqueConstraint constraint)
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
static TableChange.AddDistribution add(TableDistribution distribution)
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
static TableChange.AddWatermark add(WatermarkSpec watermarkSpec)
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
static TableChange.ModifyColumnName modifyColumnName(Column oldColumn, String newName)
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
static TableChange.ModifyColumnComment modifyColumnComment(Column oldColumn, String newComment)
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
static TableChange.ModifyUniqueConstraint modify(UniqueConstraint newConstraint)
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
static TableChange.ModifyDistribution modify(TableDistribution distribution)
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
static TableChange.ModifyWatermark modify(WatermarkSpec newWatermarkSpec)
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
static TableChange.DropColumn dropColumn(String columnName)
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
static TableChange.DropWatermark 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
static TableChange.DropConstraint dropConstraint(String constraintName)
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
static TableChange.DropDistribution 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
static TableChange.SetOption set(String key, String value)
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
static TableChange.ResetOption reset(String key)
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
static TableChange.ModifyDefinitionQuery modifyDefinitionQuery(String definitionQuery)
A table change to modify materialized table definition query.- Parameters:
definitionQuery- the modified definition query.- Returns:
- a TableChange represents the modification.
-
-