`partitions` metadata table merges NULL partitions from different specs

Đang mở
#19,140 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@adiranjan25 đang làm issue này rồi.

Từ ngày 25/11/2026.

  • #19148 của @adiranjan25 — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
18/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java, spark
Lĩnh vực
data

Hướng nghiên cứu

Start by running the reproduction script in the issue against a local Spark session to confirm that the partitions table merges the NULL-valued rows across specs 0 and 2 while the control table does not. Pull request 19148 is already open against this bug, so read it and its review before writing anything. Done means the NULL-partition case yields one row per spec_id, matching the control table and the files table.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Apache Iceberg version

main (development)

Query engine

Spark

Please describe the bug 🐞

After DROP PARTITION FIELD p and ADD PARTITION FIELD q, a file with p = NULL (old spec) and a file with q = NULL (new spec) are reported by the partitions table as one row with the new spec_id and summed counts; spec 0 disappears. With non-NULL values there is one row per spec. Reproduced on main (2e12b22, 2026-11-25) and 1.12.0, Spark 3.5.5.

Reproduction
CREATE TABLE local.t (id INT, p STRING, q STRING) USING iceberg PARTITIONED BY (p);
INSERT INTO local.t VALUES (1, NULL, 'old');
ALTER TABLE local.t DROP PARTITION FIELD p;
ALTER TABLE local.t ADD PARTITION FIELD q;
INSERT INTO local.t VALUES (2, 'new', NULL);
SELECT 'parts' AS marker, spec_id, partition, record_count, file_count FROM local.t.partitions ORDER BY spec_id;
SELECT 'files' AS marker, spec_id, partition FROM local.t.files ORDER BY spec_id;

-- control: non-NULL values
CREATE TABLE local.c (id INT, p STRING, q STRING) USING iceberg PARTITIONED BY (p);
INSERT INTO local.c VALUES (1, 'old', 'old');
ALTER TABLE local.c DROP PARTITION FIELD p;
ALTER TABLE local.c ADD PARTITION FIELD q;
INSERT INTO local.c VALUES (2, 'new', 'new');
SELECT 'control' AS marker, spec_id, partition, record_count, file_count FROM local.c.partitions ORDER BY spec_id;
Expected vs. actual
Expected Actual
local.t.partitions 0 {"p":null,"q":null} 1 1
2 {"p":null,"q":null} 1 1
2 {"p":null,"q":null} 2 2
local.t.files 0 ..., 2 ... 0 {"p":null,"q":null}
2 {"p":null,"q":null}
local.c.partitions (control) one row per spec 0 {"p":"old","q":null} 1 1
2 {"p":null,"q":"new"} 1 1

The old-spec partition (p is NULL) and the new-spec partition (q is NULL) are different partitions, but they are collapsed into one row and the old spec_id 0 disappears.

Willingness to contribute
  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time
Ngôn ngữ chính
Java
Star
9.5k
Fork
3.7k
Merge trung bình
2 ngày 2 giờ
Pull request đã merge (30 ngày)
170

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/iceberg

Tất cả issue của apache/iceberg

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.