Offset overflow - Native Parquet scan expands flat dictionary columns and reads twice Spark's batch rows
Les mainteneurs répondent en général sous 2 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 42/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Domaine
- data-engineering, performance
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Scala
- Étoiles
- 1.3k
- Forks
- 414
- Merge moyen
- 3 j 4 h
- PR mergées (30 j)
- 202
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/datafusion-comet
-
Native MergeRows can panic or produce wrong masks - arrow 59 `and_not` mishandles sliced arraysOuverterequires-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
apache/datafusion-comet#7596 ·
Les mainteneurs répondent en général sous 2 jours
-
requires-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
apache/datafusion-comet#7583 ·
Les mainteneurs répondent en général sous 2 jours
-
bug priority:medium
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
apache/datafusion-comet#7559 · 2 commentaires ·
Les mainteneurs répondent en général sous 2 jours
-
area:writer bug priority:low
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/datafusion-comet#7558 ·
Les mainteneurs répondent en général sous 2 jours
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/datafusion-comet#7557 ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de apache/datafusion-comet
Issues similaires
-
module: core presentation conversion
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
bigbluebutton/bigbluebutton#26508 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 3 jours
-
bug container
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
lichess-org/lila#22466 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
30-minutes algorithm any-language codewars dart easy elixir hackerrank hacktoberfest haskell help wanted interview-prep julia leetcode lua open-source r scala students zig
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
Huerte/algo-solutions-python#226 ·
Les mainteneurs répondent en général sous 1 jour