ALTER TABLE PROPERTY
This statement is used to modify the properties of an existing table. This operation is synchronous, and the return of the command indicates the completion of the execution.
Modify the properties of the table, currently supports modifying the bloom filter column, the colocate_with attribute and the dynamic_partition attribute, the replication_num and default.replication_num.
grammar:
ALTER TABLE [database.]table alter_clause;
The alter_clause of property supports the following modification methods.
Note:
Can also be merged into the above schema change operation to modify, see the example below
ALTER TABLE example_db.my_table SET ("bloom_filter_columns"="k1,k2,k3");
Can also be incorporated into the schema change operation above (note that the syntax for multiple clauses is slightly different)
ALTER TABLE example_db.my_table DROP COLUMN col2 PROPERTIES ("bloom_filter_columns"="k1,k2,k3");
ALTER TABLE example_db.my_table set ("colocate_with" = "t1");
ALTER TABLE example_db.my_table set ("distribution_type" = "random");
ALTER TABLE example_db.my_table set ("dynamic_partition.enable" = "false");
If you need to add dynamic partition attributes to tables without dynamic partition attributes, you need to specify all dynamic partition attributes (Note: adding dynamic partition attributes is not supported for non-partitioned tables)
ALTER TABLE example_db.my_table set ( "dynamic_partition.enable" = "true", "dynamic_partition.time_unit" = "DAY", "dynamic_partition.end" = "3", "dynamic_partition.prefix" = "p", "dynamic_partition. buckets" = "32" );
ALTER TABLE example_db.my_table set ("in_memory" = "true");
ALTER TABLE example_db.my_table ENABLE FEATURE "BATCH_DELETE";
Note:
ALTER TABLE example_db.my_table ENABLE FEATURE "SEQUENCE_LOAD" WITH PROPERTIES ( "function_column.sequence_type" = "Date" );
Note:
ALTER TABLE example_db.my_table MODIFY DISTRIBUTION DISTRIBUTED BY HASH(k1) BUCKETS 50;
Note:
ALTER TABLE example_db.my_table MODIFY COMMENT "new comment";
ALTER TABLE example_db.my_table MODIFY COLUMN k1 COMMENT "k1", MODIFY COLUMN k2 COMMENT "k2";
Only the MySQL type can be changed to the ODBC type. The value of driver is the name of the driver in the odbc.init configuration.
ALTER TABLE example_db.mysql_table MODIFY ENGINE TO odbc PROPERTIES("driver" = "MySQL");
ALTER TABLE example_db.mysql_table SET ("replication_num" = "2"); ALTER TABLE example_db.mysql_table SET ("default.replication_num" = "2"); ALTER TABLE example_db.mysql_table SET ("replication_allocation" = "tag.location.tag1: 1"); ALTER TABLE example_db.mysql_table SET ("default.replication_allocation" = "tag.location.tag1: 1");
Note:
show create table and show partitions from tbl statements, you can see that the replica distribution has been modified. changed.show partitions from tbl statement. If you want to modify the actual replica distribution, see ALTER TABLE PARTITION.ALTER TABLE example_db.my_table SET ("bloom_filter_columns"="k1,k2,k3");
Can also be incorporated into the schema change operation above (note that the syntax for multiple clauses is slightly different)
ALTER TABLE example_db.my_table DROP COLUMN col2 PROPERTIES ("bloom_filter_columns"="k1,k2,k3");
ALTER TABLE example_db.my_table set ("colocate_with" = "t1");
ALTER TABLE example_db.my_table set ("distribution_type" = "random");
ALTER TABLE example_db.my_table set ("dynamic_partition.enable" = "false");
If you need to add dynamic partition attributes to tables without dynamic partition attributes, you need to specify all dynamic partition attributes (Note: adding dynamic partition attributes is not supported for non-partitioned tables)
ALTER TABLE example_db.my_table set ("dynamic_partition.enable" = "true", "dynamic_partition.time_unit" = "DAY", "dynamic_partition.end" = "3", "dynamic_partition.prefix" = "p", "dynamic_partition. buckets" = "32");
ALTER TABLE example_db.my_table set ("in_memory" = "true");
ALTER TABLE example_db.my_table ENABLE FEATURE "BATCH_DELETE";
ALTER TABLE example_db.my_table ENABLE FEATURE "SEQUENCE_LOAD" WITH PROPERTIES ("function_column.sequence_type" = "Date");
ALTER TABLE example_db.my_table MODIFY DISTRIBUTION DISTRIBUTED BY HASH(k1) BUCKETS 50;
ALTER TABLE example_db.my_table MODIFY COMMENT "new comment";
ALTER TABLE example_db.my_table MODIFY COLUMN k1 COMMENT "k1", MODIFY COLUMN k2 COMMENT "k2";
ALTER TABLE example_db.mysql_table MODIFY ENGINE TO odbc PROPERTIES("driver" = "MySQL");
ALTER, TABLE, PROPERTY, ALTER TABLE