Offset overflow - Comet's grouped accumulators build one array for all emitted groups
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 42/100
Línea de trabajo
Start with the Rust accumulator implementations named in the issue: native/spark-expr/src/agg_funcs/collect.rs, max_min_by.rs, list_agg.rs, and approx_percentile.rs; trace their evaluate, state, and EmitTo::First paths. Check how errors are returned and how repeated partial emits handle retained groups. Add focused tests for overflow and repeated emits; done means overflow returns an error instead of panicking and chunked emits avoid quadratic work.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Part of #7267.
Problem
Comet's own GroupsAccumulators build one array for all the groups they emit, in evaluate and in state (which also runs when the aggregate spills). With EmitTo::All that is every group in the task, so the array overflows once the values collected across all groups pass 2 GiB, even though each group's own value is small. Spark keeps one buffer per group.
collect_list(native/spark-expr/src/agg_funcs/collect.rs:382-428) usesconcatorinterleave, which returnOffsetOverflowError.collect_set(collect.rs:717-732) andmax_by/min_by(max_min_by.rs) decode with arrow-row'sconvert_rows, which panics withoffset overflow(arrow-row 59.3.2src/variable.rs:294).listagg(list_agg.rs:304-317) and theapprox_percentilestate (approx_percentile.rs:414-421) build withStringArray::fromandBinaryBuilder, which panic withbyte array offset overflow.
For example, a final collect_list(json) GROUP BY user whose reduce partition holds more than 2 GiB of strings fails.
This is the accumulator side of #7278. Two things here matter for #7278's fix:
- Chunked emit would call
EmitTo::First(n)repeatedly, and in these accumulators each call costs time proportional to everything still retained.collect_list'scompact(collect.rs:259) re-takes every retained batch, andcollect_set's (collect.rs:622) re-inserts every remaining entry. Emitting in chunks would be quadratic. - The comment at
collect.rs:509-518says the element count is what limits the emittedList<i32>. For string and binary elements, the child's bytes are limited to 2 GiB as well.
Line references are for main at 4e6b12290f.
Workaround
Raise spark.sql.shuffle.partitions, so each task emits fewer groups.
Proposed fix
- Return errors instead of panicking.
- Make
EmitTo::First(n)cheap, so the aggregate can emit groups in chunks bounded by bytes, together with #7278.
Tests
Check that an emit whose total passes the limit returns an error rather than panicking, using a few groups with large values (or a limit lowered for the test). Check the cost of repeated EmitTo::First with enough groups to show the quadratic time.
- Lenguaje dominante
- Scala
- Estrellas
- 1.3k
- Forks
- 414
- Merge medio
- 3 d 5 h
- PR fusionados (30 d)
- 210
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/datafusion-comet
-
bug priority:medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
apache/datafusion-comet#7559 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
area:writer bug priority:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/datafusion-comet#7558 ·
Los mantenedores suelen responder en 2 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/datafusion-comet#7557 ·
Los mantenedores suelen responder en 2 días
-
`rand` and `randn` with an integer seed fall back to Spark without a fallback reasonPosiblemente ocupada @galaxytemple la tomó hace 3 días. Abiertorequires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/datafusion-comet#7479 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
area:writer enhancement requires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
apache/datafusion-comet#7463 ·
Los mantenedores suelen responder en 2 días
Todos los issues de apache/datafusion-comet
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
chipsalliance/rocket-chip#3845 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
Los mantenedores suelen responder en 13 días
-
gesticulate: the `FastInfoset` suffix is written `fast-infoset`, not the registered `fastinfoset`Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
propensive/soundness#2437 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ergoplatform/ergo#2918 ·
Los mantenedores suelen responder en 2 días