Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

bug: gzip table metadata is neither written nor detected as gzip

Đang mở
#1,013 0 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 2 ngày

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

Từ ngày 14/10/2026.

  • #1014 của @LuciferYang — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
66/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ệ
cpp
Lĩnh vực
data

Hướng nghiên cứu

Start in src/iceberg/table_metadata.cc, at Codec::FromFileName, where find_last_of(kTableMetadataFileSuffix) searches for any single character rather than the suffix, and at TableMetadataUtil::Write, which never compresses. The existing GZipDecompressor in util/gzip_internal.h is the model for a matching GZipCompressor. Done means a gzip-configured table writes gzip metadata that is read back correctly, and a name without .metadata.json is rejected. Both halves need to land together.

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

Mô tả

Summary

With write.metadata.compression-codec=gzip, iceberg-cpp names new metadata files <version>-<uuid>.gz.metadata.json, the same layout Iceberg Java uses, but the round trip is broken on both sides:

  • TableMetadataUtil::Write never compresses. It writes plain JSON into the .gz.metadata.json file, so Java (or any reader that trusts the name) fails to inflate it.
  • Codec::FromFileName misdetects the codec. It calls find_last_of(".metadata.json"), which searches for any single character of that set, not the suffix. For 00001-abc.gz.metadata.json it lands on the final n, the .gz check fails, and the file is read as uncompressed. A gzip file written by Java under that name therefore fails to parse.

The two bugs mask each other inside iceberg-cpp: a file it writes is plain JSON and is read back as plain JSON, so its own round trip happens to work.

Root cause

src/iceberg/table_metadata.cc:

auto pos = file_name.find_last_of(kTableMetadataFileSuffix);  // character-set search

and TableMetadataUtil::Write(io, location, metadata) serializes and calls io.WriteFile with no codec step. Only a GZipDecompressor exists in util/gzip_internal.h.

Java's TableMetadataParser.Codec.fromFileName uses lastIndexOf(".metadata.json"), and internalWrite wraps the stream in GZIPOutputStream when that codec is gzip.

Impact

A table configured with gzip metadata compression is not readable across engines in either direction: Java cannot read what iceberg-cpp writes, and iceberg-cpp cannot read what Java writes. The default codec is none, so tables without that property are unaffected.

The find_last_of bug also means FromFileName accepts names with no .metadata.json at all (e.g. foo.txt is classified as uncompressed), while Java rejects them.

Proposed fix

Use rfind in FromFileName, and compress in Write when the location's codec is gzip, with a small GZipCompressor next to the existing GZipDecompressor. Both halves have to land together: fixing only the read side makes iceberg-cpp try to inflate the plain JSON it writes today.

Ngôn ngữ chính
C++
Star
226
Fork
133
Merge trung bình
6 ngày 2 giờ
Pull request đã merge (30 ngày)
49

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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-cpp

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

Issue tương tự

Thêm issue về C++

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.