Native MergeRows can panic or produce wrong masks - arrow 59 `and_not` mishandles sliced arrays
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Empieza en merge_rows.rs, alrededor de las líneas 625–626, y sigue cómo MergeRowsStream construye las máscaras de las filas que no coinciden. Reproduce el comportamiento de Arrow 59 con el ejemplo proporcionado de un array segmentado y luego verifica que las máscaras coincidan con and(a, not(b)) y que MergeRows nativo ya no entre en pánico; el issue sugiere reemplazar las dos llamadas a and_not como solución provisional.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
MergeRowsStream builds the "not matched" masks with arrow::compute::kernels::boolean::and_not (merge_rows.rs:625-626). In arrow 59.x and_not mixes up the offsets of its inputs when one of them is a slice (apache/arrow-rs#10698, fixed in apache/arrow-rs#10699 for 60.0.0, not backported). Comet main resolves arrow to 59.3.2, so the bug is still there.
After the full outer join one marker column can be a slice with a non-zero offset. Then the task either panics with offset + len out of bounds, or gets wrong masks with no error and applies inserts and deletes to the wrong rows. We hit the panic on Iceberg MERGE with spark.comet.exec.mergeRows.enabled=true (Comet 1.2.0, Spark 4.0.2); with the flag off the jobs pass.
Steps to reproduce
// arrow = "=59.3.2"
use arrow::array::{Array, BooleanArray};
use arrow::compute::kernels::boolean::{and, and_not, not};
fn mask(len: usize, f: fn(usize) -> bool) -> BooleanArray {
BooleanArray::from((0..len).map(f).collect::<Vec<_>>())
}
fn main() {
let left = mask(3000, |i| i % 3 != 0).slice(0, 1000);
let right = mask(2000, |i| i % 5 == 0).slice(1000, 1000);
let expected = and(&left, ¬(&right).unwrap()).unwrap();
let actual = and_not(&left, &right).unwrap();
let wrong = (0..1000).filter(|&i| actual.value(i) != expected.value(i)).count();
println!("wrong values: {wrong} of 1000"); // 59.x: 533, 60.1: 0
}
Expected behavior
and_not(a, b) gives the same result as and(a, not(b)), and native MergeRows does not panic.
Additional context
Until Comet moves to arrow 60 (#7249), replacing the two calls with and(a, ¬(b)?) fixes it.
Willingness to contribute
I can contribute a fix for this bug independently
- Lenguaje dominante
- Scala
- Estrellas
- 1.3k
- Forks
- 418
- Merge medio
- 2 d 23 h
- PR fusionados (30 d)
- 158
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
-
`IcebergWriteExec` and `CometIcebergWriteExec` are marked with `!` (missing input) in EXPLAINPosiblemente ocupada @Visorgood la tomó hoy. Abiertobug requires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
apache/datafusion-comet#7622 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
-
requires-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/datafusion-comet#7583 ·
Los mantenedores suelen responder en 2 días
-
bug priority:medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
apache/datafusion-comet#7559 · 2 comentarios ·
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
-
Comet Native Executors: run a query in Spark when Comet is turned offPosiblemente ocupada @andygrove la tomó hace 8 días. Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/datafusion-comet#7557 ·
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 66/100
lichess-org/lila#22506 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
15-minutes 5-minutes algorithm any-language beginner-friendly c cpp csharp easy go good first issue hacktoberfest help wanted java javascript kotlin python rust swift typescript
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
Huerte/algo-solutions-python#260 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
cpp-best-practices/project_validator#245 ·
Los mantenedores suelen responder en 1 día
-
python 🐍 Task 🔧
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
valkey-io/valkey-glide#7709 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
zio/zio-logging#1181 ·
Los mantenedores suelen responder en 1 día