Class SchemaEvolutionUtils
- java.lang.Object
-
- org.apache.flink.cdc.connectors.maxcompute.utils.SchemaEvolutionUtils
-
public class SchemaEvolutionUtils extends Object
Schema evolution utils for maxcompute.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddColumns(MaxComputeOptions options, TableId tableId, List<AddColumnEvent.ColumnWithPosition> columns)equals to run a sql like: 'alter table table_name add columns (col_name1 type1 comment [, col_name2 type2 ...]);'.static voidalterColumnType(MaxComputeOptions options, TableId tableId, Map<String,DataType> typeMapping, Map<String,String> comments)equals to run a sql like: 'alter table table_name change column old_column_name new_column_name new_data_type;'.static voidalterTableComment(MaxComputeOptions options, TableId tableId, String comment)static voidcreateTable(MaxComputeOptions options, TableId tableId, Schema schema)equals to run a sql like: create table table_name (col_name1 type1 comment [, col_name2 type2 ...]);.static voiddropColumn(MaxComputeOptions options, TableId tableId, List<String> droppedColumnNames)equals to run a sql like: 'alter table table_name drop columns col_name1[, col_name2...];'.static voiddropTable(MaxComputeOptions options, TableId tableId)static voidrenameColumn(MaxComputeOptions options, TableId tableId, Map<String,String> nameMapping)equals to run a sql like: 'alter table table_name change column old_col_name rename to new_col_name;'.static voidtruncateTable(MaxComputeOptions options, TableId tableId)
-
-
-
Method Detail
-
createTable
public static void createTable(MaxComputeOptions options, TableId tableId, Schema schema) throws com.aliyun.odps.OdpsException
equals to run a sql like: create table table_name (col_name1 type1 comment [, col_name2 type2 ...]);.- Throws:
com.aliyun.odps.OdpsException
-
addColumns
public static void addColumns(MaxComputeOptions options, TableId tableId, List<AddColumnEvent.ColumnWithPosition> columns) throws com.aliyun.odps.OdpsException
equals to run a sql like: 'alter table table_name add columns (col_name1 type1 comment [, col_name2 type2 ...]);'.- Throws:
com.aliyun.odps.OdpsException
-
alterColumnType
public static void alterColumnType(MaxComputeOptions options, TableId tableId, Map<String,DataType> typeMapping, Map<String,String> comments) throws com.aliyun.odps.OdpsException
equals to run a sql like: 'alter table table_name change column old_column_name new_column_name new_data_type;'. and 'alter table table_name change column col_name comment 'col_comment'';- Throws:
com.aliyun.odps.OdpsException
-
dropColumn
public static void dropColumn(MaxComputeOptions options, TableId tableId, List<String> droppedColumnNames) throws com.aliyun.odps.OdpsException
equals to run a sql like: 'alter table table_name drop columns col_name1[, col_name2...];'.- Throws:
com.aliyun.odps.OdpsException
-
renameColumn
public static void renameColumn(MaxComputeOptions options, TableId tableId, Map<String,String> nameMapping) throws com.aliyun.odps.OdpsException
equals to run a sql like: 'alter table table_name change column old_col_name rename to new_col_name;'.- Throws:
com.aliyun.odps.OdpsException
-
dropTable
public static void dropTable(MaxComputeOptions options, TableId tableId) throws com.aliyun.odps.OdpsException
- Throws:
com.aliyun.odps.OdpsException
-
truncateTable
public static void truncateTable(MaxComputeOptions options, TableId tableId) throws com.aliyun.odps.OdpsException
- Throws:
com.aliyun.odps.OdpsException
-
alterTableComment
public static void alterTableComment(MaxComputeOptions options, TableId tableId, String comment) throws com.aliyun.odps.OdpsException
- Throws:
com.aliyun.odps.OdpsException
-
-