Update and delete data features

From Hive, you can update and delete data in a V2 Iceberg table.

Hive updates and deletes Iceberg tables using position delete files, one type of encoding defined by the Iceberg Spec. Impala reads, but does not write, position updates and deletes. Hive and Impala do not support equality deletes, the other type of encoding. As a typical user, you are oblivious to these encodings. If you have a problem with updates or deletes in the following situations, an equality delete file in the table is the likely cause:
  • In Change Data Capture (CDC) applications
  • In upserts from Apache Flink
  • From a third-party engine

Inserting, deleting, or updating table data generates a snapshot. A new snapshot corresponds to a new manifest list. Manifest lists are named snap-*.avro.

Hive syntax

UPDATE tablename SET column = value [, column = value ...] [WHERE expression]
DELETE FROM tablename [WHERE expression]

Hive example

create external table tbl_ice(a int, b string, c int) stored by iceberg stored as orc tblproperties ('format-version'='2');

insert into tbl_ice values (1, 'one', 50), (2, 'two', 51), (3, 'three', 52), (4, 'four', 53), (5, 'five', 54), (111, 'one', 55), (333, 'two', 56);

update tbl_ice set b='Changed' where b in (select b from tbl_ice where a < 4);

delete from tbl_ice where a <= 2,1;