Offset overflow - Native Parquet scan expands flat dictionary columns and reads twice Spark's batch rows
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 42/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
Start with the native Parquet scan and the arrow-rs byte-array decoding paths described in the issue, including the DELTA_LENGTH_BYTE_ARRAY decoder. Reproduce the overflow with a flat dictionary-encoded string column and a small injected byte budget, then compare native scan results with Spark's reader. Done means byte-bounded batching or dictionary handling prevents overflow while preserving the expected rows; the issue also calls out matching Spark's default batch size and an upstream decoder panic fix.
索引モデルが issue の本文から書いたものです。
説明
Part of #7267.
Problem
Two things make the native Parquet scan, and the native Iceberg scan that uses the same arrow-rs reader, overflow a string or binary column where Spark's reader does not.
Flat dictionary-encoded columns are expanded per batch. Comet asks arrow-rs for plain Utf8/Binary, so the reader copies a dictionary value into the batch once per row that references it (extend_from_dictionary, parquet 59.3.2 src/arrow/buffer/offset_buffer.rs:92-118). A column with a few wide distinct values is stored as a small dictionary page plus tiny keys, and can still expand past 2 GiB in one 8192-row batch: one 300 KB value repeated 8192 times is 2.4 GB. The scan fails with index overflow decoding byte array. Spark's vectorized reader keeps the dictionary ids and decodes a value only when a row reads it, so it succeeds. #7254 covers the nested case; flat columns overflow inside arrow-rs instead.
Twice the rows per batch. Comet reads spark.comet.batchSize rows per batch, 8192 by default. Spark's vectorized Parquet reader reads spark.sql.parquet.columnarReaderBatchSize rows (4096), and Iceberg's Java reader 5000. With values of 256-512 KiB in row groups large enough to fill a batch (large row-group sizes or highly compressible values), Comet's batch passes 2 GiB and Spark's does not.
The DELTA_LENGTH_BYTE_ARRAY decoder panics instead of returning that error (parquet 59.3.2 src/arrow/array_reader/byte_array.rs:514).
The epic lists the scan as honoring the batch size. It does, but in both cases the batch size alone doesn't bound the bytes.
Workaround
Lower spark.comet.batchSize.
Proposed fix
- Keep dictionary-encoded byte columns as dictionaries out of the reader and unpack them after the scan in row ranges bounded by bytes, or cap scan batches by bytes.
- At least, default the native scan's batch size to Spark's reader batch size.
- Upstream: return an error from the DELTA_LENGTH_BYTE_ARRAY decoder instead of panicking.
Tests
A Parquet file with a flat dictionary-encoded string column, one 300 KB value repeated 8192 times, stays tiny on disk. Reading it with the native scan and comparing with Spark shows the problem, but needs about 2.5 GB of memory, so test the byte-bounded batching with a small budget injected for the test.
- 主要言語
- Scala
- スター
- 1.3k
- フォーク
- 414
- 平均マージ
- 3日 5時間
- マージ済み PR(30日)
- 210
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/datafusion-comet のほかの issue
-
bug priority:medium
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
apache/datafusion-comet#7559 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
area:writer bug priority:low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/datafusion-comet#7558 ·
メンテナーはふだん 2 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/datafusion-comet#7557 ·
メンテナーはふだん 2 日以内に返信
-
`rand` and `randn` with an integer seed fall back to Spark without a fallback reason対応中かも @galaxytemple が 3 日前に担当しました。 オープンrequires-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/datafusion-comet#7479 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
area:writer enhancement requires-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
apache/datafusion-comet#7463 ·
メンテナーはふだん 2 日以内に返信
apache/datafusion-comet の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
chipsalliance/rocket-chip#3845 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
メンテナーはふだん 13 日以内に返信
-
gesticulate: the `FastInfoset` suffix is written `fast-infoset`, not the registered `fastinfoset`オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
propensive/soundness#2437 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ergoplatform/ergo#2918 ·
メンテナーはふだん 2 日以内に返信