Alter table feature

In Hive or Impala, you can use ALTER TABLE to set table properties. From Impala, you can use ALTER TABLE to rename a table, to change the table owner, or to change the role of the table owner. From Hive, you can alter the metadata location of the table if the new metadata does not belong to another table; otherwise, an exception occurs.

You can convert an Iceberg v1 table to v2 by setting a table property as follows:'format-version' = '2'.

Hive or Impala syntax

ALTER TABLE table_name SET TBLPROPERTIES table_properties;
  • table_properties
    A list of properties and values using the following syntax:
    ('key' = 'value', 'key' = 'value', ... )

Impala syntax

ALTER TABLE table_name RENAME TO new_table_name;

ALTER TABLE table_name SET OWNER USER user_name;

ALTER TABLE table_name SET OWNER ROLE role_name;

Hive example

ALTER TABLE test_table SET TBLPROPERTIES('metadata_location'='hdfs://ice_table/metadata/v1.metadata.json');
       ALTER TABLE test_table2 SET TBLPROPERTIES('format-version' = '2');

Impala examples

ALTER TABLE t1 RENAME TO t2;

ALTER TABLE ice_table1 set OWNER USER john_doe;

ALTER TABLE ice_table2 set OWNER ROLE some_role;

ALTER TABLE ice_8 SET TBLPROPERTIES ('read.split.target-size'='268435456');

ALTER TABLE ice_table3 SET TBLPROPERTIES('format-version' = '2');