ALTER ICEBERG TABLE

Syntax

Changing table options

Alters previously configured options for the specified Apache Iceberg table:

ALTER ICEBERG TABLE <table_identifier> 
    SET <table_option> = <value>;

Partition evolution

Changes the partition columns of an existing table. This change does not rebuild the existing data according to the new partitioning, but will apply the new partitioning to data moving forward.

ALTER TABLE <table_name> PARTITION BY <column_name> [, ...];

Note you can use any partition transforms supported by iceberg. for example:

ALTER TABLE <table_name> PARTITION BY
  TRUNCATE(10, <column_name>),
  DAY(<timestamp_column_name>);

To stop partitioning a table moving forward:

ALTER TABLE <table_name> PARTITION BY ();

Sorting evolution

Changes the sorting columns of an existing table.

This will affect the data written from now onwards and new compactions will write data using the new sorting.

ALTER TABLE <table_name> ORDER BY <column_name> [ASC | DESC] [, ...]

To disable sorting completely:

ALTER TABLE <table_name> ORDER BY ()

If you wishes to re-sort old data after changing the sorting, you can trigger a compaction with OPTIMIZE TABLE command.

Examples

Modifying table options:

ALTER ICEBERG TABLE my_iceberg_table
SET compute_cluster = "my_compute_cluster",
iceberg.'read.split.planning-lookback'='10';

Changing partitions columns:

ALTER ICEBERG TABLE my_iceberg_table PARTITION BY COLUMN1, COLUMNS2;

Changing Sort columns:

ALTER ICEBERG TABLE my_iceberg_table ORDER BY COLUMN1 DESC, COLUMNS2 ASC;

Note that not all table options are mutable.

All mutable options are denoted by — editable in the individual option descriptions.

To check if a certain table option is mutable, see CREATE ICEBERG TABLE.

Last updated