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 TableChange
TableChange represents the modification of the CatalogBaseTable.
  • Method Details

    • 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

      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

      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) 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>
       
      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

      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.