Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
Reproduced on 2f6fcc772175d0c0e80ad97aac6d44360c513347; the code below is unchanged on 0c8bd5e5f3be4ce5582201513161181ddca37d6d (main, 2026-11-10).
Other Environment Information
- Single-node MatrixOne (launch.toml),
[cn.frontend.iceberg] enable/enable-write/enable-delete/enable-dml = true - Iceberg REST catalog: Nessie (
ghcr.io/projectnessie/nessie), warehouse on MinIO (RELEASE.2023-11-01T18-37-25Z) - Linux x86_64, 64 vCPU, NVMe
- Reader used for inspection: pyarrow 19.0.1 / pyiceberg 0.9.1
Actual Behavior
Every Parquet data file that MatrixOne writes to an Iceberg table (INSERT INTO <iceberg external table> ...) is written without compression and without dictionary encoding, regardless of the table property write.parquet.compression-codec.
Footer of a data file written by MO (table created with "write.parquet.compression-codec": "zstd"), 38,688 rows, 10 row groups:
created_by github.com/parquet-go/parquet-go version 0.25.1
column codec encodings
mongo_id UNCOMPRESSED PLAIN,RLE
source_stream UNCOMPRESSED PLAIN,RLE
mnemonic UNCOMPRESSED PLAIN,RLE
value_num UNCOMPRESSED PLAIN,RLE
capture_ts_ms UNCOMPRESSED PLAIN,RLE
... (all 18 columns: UNCOMPRESSED, PLAIN)
Impact, measured on the same 773,936 rows (20 data files written by MO, 18 columns: low-cardinality strings, BIGINT timestamps, DOUBLE values), re-encoded with pyarrow:
| writer | bytes/row | vs MO |
|---|---|---|
| MO (current) | 207.1 | 1.0x |
| pyarrow, uncompressed, no dictionary | 206.3 | 1.0x |
| pyarrow, uncompressed, dictionary | 45.7 | 4.5x smaller |
| pyarrow, snappy + dictionary | 19.7 | 10.5x smaller |
| pyarrow, zstd + dictionary | 14.2 | 14.5x smaller |
For a table of 22.4M rows this is 4.71 GB on object storage instead of roughly 0.32 GB. For an IoT/telemetry Bronze layer at ~12 billion points per month, it is the difference between ~2.5 TB and ~0.17 TB per month of object storage, plus proportionally more S3 GET bytes and scan I/O for every reader (MO itself, Spark, Trino, pyiceberg).
Correctness is not affected: pyiceberg reads the same 22,383,184 rows and the same SUM(value_num) as MO.
Expected Behavior
- Honour the Iceberg table property
write.parquet.compression-codec(and ideallywrite.parquet.compression-level). When the property is absent, use the Iceberg default, which iszstdsince Iceberg 1.4. - Allow dictionary encoding for string (and other low-cardinality) columns, e.g. let parquet-go pick dictionary encoding with a plain fallback, as other Iceberg writers do.
Steps to Reproduce
We observed this with INSERT INTO <iceberg table> SELECT ... FROM <MO native table> and with INSERT ... SELECT from a MongoDB external table; the files are uncompressed in both cases. The SQL below is a minimal equivalent:
-- 1. Create the Iceberg table through the REST catalog (MO maps existing tables only), e.g.
-- POST /iceberg/v1/main%7Cwarehouse/namespaces/demo/tables
-- { "name": "t", "stage-create": false,
-- "schema": {"type":"struct","schema-id":0,"fields":[
-- {"id":1,"name":"id","required":false,"type":"long"},
-- {"id":2,"name":"tag","required":false,"type":"string"},
-- {"id":3,"name":"v","required":false,"type":"double"}]},
-- "partition-spec": {"spec-id":0,"fields":[]},
-- "properties": {"format-version":"2","write.parquet.compression-codec":"zstd"} }
-- 2. Map and write from MO
CREATE ICEBERG CATALOG c WITH ('type'='rest','uri'='http://127.0.0.1:19120/iceberg',
'warehouse'='s3://mo-iceberg/warehouse','auth_mode'='none');
CREATE DATABASE d; USE d;
CREATE EXTERNAL TABLE t (id BIGINT, tag VARCHAR(64), v DOUBLE) ENGINE = ICEBERG
WITH ('catalog'='c','namespace'='demo','table'='t','ref'='main',
'read_mode'='append_only','write_mode'='append_only');
INSERT INTO t SELECT result, CONCAT('tag_', result % 10), result * 1.5
FROM generate_series(1, 1000000) g;# 3. Inspect any data file of the new snapshot
import pyarrow.parquet as pq
md = pq.ParquetFile("<data file>").metadata
rg = md.row_group(0)
print([(rg.column(i).path_in_schema, rg.column(i).compression, rg.column(i).encodings)
for i in range(rg.num_columns)])
# -> every column: 'UNCOMPRESSED', ('PLAIN', 'RLE')Additional information
Root cause in pkg/iceberg/write/parquet_writer.go:
- The writer is created with only
parquet.MaxRowsPerRowGroup(...); noparquet.Compression(...)option is passed, so parquet-go writes every page uncompressed:
matrixone/pkg/iceberg/write/parquet_writer.go
Lines 91 to 95 in 0c8bd5e
writer: parquet.NewGenericWriter[any]( cw, parquet.NewSchema("iceberg", group), parquet.MaxRowsPerRowGroup(parquetWriteMaxRowsPerRowGroup), ), - String columns are forced to plain encoding, which disables dictionary encoding:
matrixone/pkg/iceberg/write/parquet_writer.go
Lines 354 to 356 in 0c8bd5e
func icebergStringNode() parquet.Node { return parquet.Encoded(parquet.String(), &parquet.Plain) } - Nothing under
pkg/icebergreadswrite.parquet.compression-codec.
A related, smaller point: parquetWriteMaxRowsPerRowGroup = 8192 produces many small row groups (10 row groups in a 38,688-row file). Larger row groups (by bytes, e.g. Iceberg's write.parquet.row-group-size-bytes, default 128 MB) would improve compression and reduce footer and statistics overhead for readers.
Activity
fix(iceberg): honor Parquet compression and encode strings with dicti…
XuPeng-SH commentedon Nov 11, 2026
转 QA 验证:#32548 已于 2026-11-11 17:03:36 UTC 合入 main,merge SHA
01da59989792c498524489796eb1b74ad2ef2ca6,PR head799682549d5a6bcff08b8d4c16b020dbec9ad3e6。本 issue 的 codec 未传递及字符串固定 PLAIN 编码问题进入转测,尚不代表验收通过。修复将表的 write.parquet.compression-codec 传到 append/replacement writer,缺省使用 ZSTD,字符串使用 dictionary,并限制每 row group 字符串输入、复用有限 ZSTD encoder。compression-level、可配置 row-group byte limit 和 dictionary 自动 plain fallback 不在本次实现内,不能据此承诺所有数据分布均获得同样收益。
证据来自作者记录,本轮仅核对远端合并、issue 正文及完整评论,未运行本地测试:
701f9a8上相关包、focused race、静态检查及六种 codec/旧格式文件测试通过;Linux 实际 SQL append 10/10,默认/显式 ZSTD 与 UNCOMPRESSED footer/PyIceberg 对照、含 NULL 的 8194 行旧新混合 snapshot、SNAPPY INSERT OVERWRITE 已验证。7413b03做了较小的公开路径复核,并非全套重跑;PR记录ffebfe3Ubuntu UT/SCA/CI Required 通过,这些不等同于本轮对最终合并 SHA 的实测。建议 QA 在合并构建检查表属性到实际已提交 footer 的 codec/encoding、默认与显式设置、append/OVERWRITE、新旧文件混合读取、NULL/长字符串/多分区,比较行数和值,并评估真实数据压缩收益及资源使用。作者的小型低基数样本缩小96.1%,宽随机字符串 CPU约2.85倍、累计分配约2.68倍,不能作为生产吞吐或峰值内存保证;1MiB字符串输入阈值允许单行超限,也不限制总SQL内存。
保留验证边界:UPDATE虽写入SNAPPY并由MO读回,但PyIceberg0.12.0会在加载operation=update快照元数据时报错,未用完整干净旧服务建立基线,本次不能宣称解决该独立兼容限制。旧二进制读取新文件、端到端备份恢复及与更新main合并后的全套验证仍未完成。此前Ubuntu超时根因未定,后续成功不能归因为预分配修复。
Ariznawlll commentedon Nov 13, 2026
结论
测试通过。#32466 的 Iceberg 写入压缩配置和字符串字典编码问题在本次测试范围内未再复现;宽表带过滤读取仍有独立失败,见下文。
关键证据
main@3ac43c9f56eeaa7cdf6e5f45987792d9878fae8f;隔离 MO、Nessie REST catalog 和 MinIO 环境,服务git_version()与源码 SHA 一致。待解决点