Partition Evolution Without Rewriting a Single File
run(ctx, spark, "ALTER TABLE hms.db.orders ADD PARTITION FIELD country")Rows written from this point on are partitioned by both days(order_ts) and country; everything written before this ALTER stays under the old one-field spec. Prove both specs are alive at once:
run(ctx, spark, `
SELECT partition, spec_id, record_count
FROM hms.db.orders.partitions
ORDER BY spec_id, partition`)
run(ctx, spark, `
INSERT INTO hms.db.orders VALUES
(1009, 507, TIMESTAMP '2026-01-20 08:00:00', 77.00, 'COMPLETED', 'US', NULL)`)+------------------+-------+------------+
|partition |spec_id|record_count|
+------------------+-------+------------+
|{2026-01-15, NULL}|0 |2 |
|{2026-01-16, NULL}|0 |3 |
|{2026-01-17, NULL}|0 |2 |
|{2026-01-18, NULL}|0 |1 |
|{2026-01-19, NULL}|0 |1 |
|{2026-01-20, US} |1 |1 | <- the only row under the new spec
+------------------+-------+------------+This single result set is the whole argument. Every row carries its own spec_id, and the partition struct has two fields for every row — but rows written under spec 0 have NULL in the country slot, because at the time they were written that field did not exist. Iceberg did not rewrite them to backfill it, and it did not need to: their manifests still record them under spec 0, and pruning them uses spec 0's rules.
A query filtering WHERE country = 'US' now prunes the new partitions directly from the country field in their spec, and prunes the old partitions using nothing but their order_ts_day value plus min/max column stats — two different pruning strategies, applied silently to two different sets of files, in one query plan. That's the Partitioning and data skipping part's partition-evolution claim, and it's the one piece of this lab you cannot reproduce in a system that partitions Hive-style.