@PublicEvolving
public interface TableChange
TableChange represents the modification of the table.| Modifier and Type | Interface and Description |
|---|---|
static class |
TableChange.AddColumn
A table change to add a column.
|
static class |
TableChange.AddUniqueConstraint
A table change to add a unique constraint.
|
static class |
TableChange.AddWatermark
A table change to add a watermark.
|
static class |
TableChange.After
Column position AFTER means the specified column should be put after the given `column`.
|
static interface |
TableChange.ColumnPosition
The position of the modified or added column.
|
static class |
TableChange.DropColumn
A table change to drop the column.
|
static class |
TableChange.DropConstraint
A table change to drop the constraints.
|
static class |
TableChange.DropWatermark
A table change to drop the watermark.
|
static class |
TableChange.First
Column position FIRST means the specified column should be the first column.
|
static class |
TableChange.ModifyColumn
A base schema change to modify a column.
|
static class |
TableChange.ModifyColumnComment
A table change to modify the column comment.
|
static class |
TableChange.ModifyColumnName
A table change to modify the column name.
|
static class |
TableChange.ModifyColumnPosition
A table change to modify the column position.
|
static class |
TableChange.ModifyPhysicalColumnType
A table change that modify the physical column data type.
|
static class |
TableChange.ModifyUniqueConstraint
A table change to modify a unique constraint.
|
static class |
TableChange.ModifyWatermark
A table change to modify the watermark.
|
static class |
TableChange.ResetOption
A table change to reset the table option.
|
static class |
TableChange.SetOption
A table change to set the table option.
|
| Modifier and Type | Method and Description |
|---|---|
static TableChange.AddColumn |
add(Column column)
A table change to add the column at last.
|
static TableChange.AddColumn |
add(Column column,
TableChange.ColumnPosition position)
A table change to add the column with specified position.
|
static TableChange.AddUniqueConstraint |
add(UniqueConstraint constraint)
A table change to add a unique constraint.
|
static TableChange.AddWatermark |
add(WatermarkSpec watermarkSpec)
A table change to add a watermark.
|
static TableChange.DropColumn |
dropColumn(String columnName)
A table change to drop column.
|
static TableChange.DropConstraint |
dropConstraint(String constraintName)
A table change to drop constraint.
|
static TableChange.DropWatermark |
dropWatermark()
A table change to drop watermark.
|
static TableChange.ModifyColumn |
modify(Column oldColumn,
Column newColumn,
TableChange.ColumnPosition columnPosition)
A table change to modify a column.
|
static TableChange.ModifyUniqueConstraint |
modify(UniqueConstraint newConstraint)
A table change to modify a unique constraint.
|
static TableChange.ModifyWatermark |
modify(WatermarkSpec newWatermarkSpec)
A table change to modify a watermark.
|
static TableChange.ModifyColumnComment |
modifyColumnComment(Column oldColumn,
String newComment)
A table change to modify the column comment.
|
static TableChange.ModifyColumnName |
modifyColumnName(Column oldColumn,
String newName)
A table change to modify the column name.
|
static TableChange.ModifyColumnPosition |
modifyColumnPosition(Column oldColumn,
TableChange.ColumnPosition columnPosition)
A table change to modify the column position.
|
static TableChange.ModifyPhysicalColumnType |
modifyPhysicalColumnType(Column oldColumn,
DataType newType)
A table change that modify the physical column data type.
|
static TableChange.ResetOption |
reset(String key)
A table change to reset the table option.
|
static TableChange.SetOption |
set(String key,
String value)
A table change to set the table option.
|
static TableChange.AddColumn add(Column column)
It is equal to the following statement:
ALTER TABLE <table_name> ADD <column_definition>
column - the added column definition.static TableChange.AddColumn add(Column column, @Nullable TableChange.ColumnPosition position)
It is equal to the following statement:
ALTER TABLE <table_name> ADD <column_definition> <column_position>
column - the added column definition.position - added column position.static TableChange.AddUniqueConstraint add(UniqueConstraint constraint)
It is equal to the following statement:
ALTER TABLE <table_name> ADD PRIMARY KEY (<column_name>...) NOT ENFORCED
constraint - the added constraint definition.static TableChange.AddWatermark add(WatermarkSpec watermarkSpec)
It is equal to the following statement:
ALTER TABLE <table_name> ADD WATERMARK FOR <row_time> AS <row_time_expression>
watermarkSpec - the added watermark definition.static TableChange.ModifyColumn modify(Column oldColumn, Column newColumn, @Nullable TableChange.ColumnPosition columnPosition)
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) and modifyColumnPosition(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>
oldColumn - the definition of the old column.newColumn - the definition of the new column.columnPosition - the new position of the column.static TableChange.ModifyPhysicalColumnType modifyPhysicalColumnType(Column oldColumn, DataType newType)
It is equal to the following statement:
ALTER TABLE <table_name> MODIFY <column_name> <new_column_type>
oldColumn - the definition of the old column.newType - the type of the new column.static TableChange.ModifyColumnName modifyColumnName(Column oldColumn, String newName)
It is equal to the following statement:
ALTER TABLE <table_name> RENAME <old_column_name> TO <new_column_name>
oldColumn - the definition of the old column.newName - the name of the new column.static TableChange.ModifyColumnComment modifyColumnComment(Column oldColumn, String newComment)
It is equal to the following statement:
ALTER TABLE <table_name> MODIFY <column_name> <original_column_type> COMMENT '<new_column_comment>'
oldColumn - the definition of the old column.newComment - the modified comment.static TableChange.ModifyColumnPosition modifyColumnPosition(Column oldColumn, TableChange.ColumnPosition columnPosition)
It is equal to the following statement:
ALTER TABLE <table_name> MODIFY <column_name> <original_column_type> <column_position>
oldColumn - the definition of the old column.columnPosition - the new position of the column.static TableChange.ModifyUniqueConstraint modify(UniqueConstraint newConstraint)
It is equal to the following statement:
ALTER TABLE <table_name> MODIFY PRIMARY KEY (<column_name>...) NOT ENFORCED;
newConstraint - the modified constraint definition.static TableChange.ModifyWatermark modify(WatermarkSpec newWatermarkSpec)
It is equal to the following statement:
ALTER TABLE <table_name> MODIFY WATERMARK FOR <row_time> AS <row_time_expression>
newWatermarkSpec - the modified watermark definition.static TableChange.DropColumn dropColumn(String columnName)
It is equal to the following statement:
ALTER TABLE <table_name> DROP COLUMN <column_name>
columnName - the column to drop.static TableChange.DropWatermark dropWatermark()
It is equal to the following statement:
ALTER TABLE <table_name> DROP WATERMARK
static TableChange.DropConstraint dropConstraint(String constraintName)
It is equal to the following statement:
ALTER TABLE <table_name> DROP CONSTRAINT <constraint_name>
constraintName - the constraint to drop.static TableChange.SetOption set(String key, String value)
It is equal to the following statement:
ALTER TABLE <table_name> SET '<key>' = '<value>';
key - the option name to set.value - the option value to set.static TableChange.ResetOption reset(String key)
It is equal to the following statement:
ALTER TABLE <table_name> RESET '<key>'
key - the option name to reset.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.