bug: gzip table metadata is neither written nor detected as gzip
維護者通常 2 天內回覆
評估
研究方向
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.
由索引模型根據 Issue 內容生成。
描述
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::Writenever compresses. It writes plain JSON into the.gz.metadata.jsonfile, so Java (or any reader that trusts the name) fails to inflate it.Codec::FromFileNamemisdetects the codec. It callsfind_last_of(".metadata.json"), which searches for any single character of that set, not the suffix. For00001-abc.gz.metadata.jsonit lands on the finaln, the.gzcheck 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.
- 主要語言
- C++
- 星號
- 226
- 分支
- 133
- 平均合併
- 6 天 5 小時
- 30 天內合併 PR
- 40
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
apache/iceberg-cpp 的其他 Issue
-
bug: TableMetadataBuilder::RemoveSchemas leaves removed ids in the schema index可能已有人在做 @LuciferYang 於 1 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
apache/iceberg-cpp#1011 ·
維護者通常 2 天內回覆
-
bug: manifest Avro headers use the wrong partition-spec shape and omit schema-id可能已有人在做 @mavam 於 1 天前認領。 未關閉
難度 4/5 1-2 天 新手友好度 58/100
apache/iceberg-cpp#1016 ·
維護者通常 2 天內回覆
-
難度 4/5 3-5 天 新手友好度 35/100
apache/iceberg-cpp#1000 · 2 則留言 · 1 個 reaction ·
維護者通常 2 天內回覆
-
Support Iceberg table encryption (Java-compatible)可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 5/5 一週以上 新手友好度 8/100
apache/iceberg-cpp#988 · 1 則留言 ·
維護者通常 2 天內回覆
-
難度 5/5 一週以上 新手友好度 20/100
apache/iceberg-cpp#959 · 1 則留言 ·
維護者通常 2 天內回覆
查看 apache/iceberg-cpp 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
FriendsofECCE/ECCE#336 · 1 則留言 ·
-
error not reported low priority semantics
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
bitcoin-core/gui-qml#1030 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 80/100
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆