Schema evolution feature

You learn that the Impala schema changes when the associated Iceberg table changes. You see examples of changing the schema.

Although you can change the schema of your table over time, you can still read old data files because Iceberg uniquely identifies schema elements. A schema change results in a new metadata.json and a commit, but does not create a new snapshot.

The Iceberg table schema is synchronized with the Impala table schema. A change to the schema of the Iceberg table by an outside entity, such as Spark, changes the corresponding Impala table. You can change the Iceberg table using ALTER TABLE to make the following changes:

From Impala:

  • Add a column
  • Rename a column
  • Drop a column
  • Change a column type
An unsafe change to a column type, which would require updating each row of the table for example, is not allowed. The following type changes are safe:
  • int to long
  • float to double
  • decimal(P, S) to decimal(P', S) if precision is increased
You can drop a column by changing the old column to the new column.

Impala syntax

ALTER TABLE table_name ADD COLUMNS(col_name type[, …])

ALTER TABLE table_name CHANGE COLUMN col_name1 col_name2 type

ALTER TABLE table_name DROP COLUMN col_name

Impala examples

ALTER TABLE ice_12 ADD COLUMNS(message STRING, price DECIMAL(8,1));

ALTER TABLE ice_12 DROP COLUMN i;

ALTER TABLE ice_12 CHANGE COLUMN s str STRING;