Drop partition feature

You can easily remove a partition from an Iceberg partition using an alter table statement from Impala.

Removing a partition does not affect the table schema. The column is not removed from the schema.

Prerequisites

  • The filter expression in the drop partition syntax below is a combination of, or at least one of, the following predicates:
    • Minimum of one binary predicate
    • IN predicate
    • IS NULL predicate
  • The argument of the predicate in the filter expression must be a partition transform, such as ‘YEARS(col-name)’ or ‘column’.
  • Any non-identity transform must be included in the select statement. For example, if you partition a column by days, the filter must be days.

Impala syntax

alter table table-name drop partition (<filter expression>)

The following operators are supported in the predicate: =, !=,<, >, <=, >=

Impala example

CREATE TABLE ice_table PARTITIONED BY SPEC (day(d)) STORED BY ICEBERG TBLPROPERTIES ('format-version'='2') AS SELECT x, ts, d FROM source_t;

INSERT INTO ice_table(d) VALUES ('2024-04-30');

ALTER TABLE ice_table DROP PARTITION (day(d) = '2024-04-30');