`binary_mut` and `try_binary_mut` return `Ok` for an empty array whose buffer is shared
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #12012 de @abhinav-phi — cerrado sin fusionar
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 52/100
Línea de trabajo
Read arrow-arith/src/arity.rs around binary_mut and try_binary_mut, then compare their empty-array early returns with into_builder in arrow-array/src/array/primitive_array.rs and the unary helpers. First resolve which shared-buffer behavior the binary forms should follow; done means their behavior and rustdoc agree, with regression coverage for the empty shared-buffer case.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
The rustdoc of binary_mut says that if the buffer of a is shared, it returns Err(self), and try_binary_mut refers to it for buffer reuse. For an empty a, both return Ok(Ok(empty array)) even when the buffer is shared, because they return early before into_builder (the same in try_binary_mut). unary_mut and try_unary_mut call into_builder first, so they return Err(self) for the same input.
No buffer is changed, so this is a difference between the documentation and the behavior, and between the unary and binary forms.
To Reproduce
On main at 9ffd63d528:
use arrow::array::Int32Array;
use arrow::compute::{binary_mut, try_binary_mut, try_unary_mut, unary_mut};
let a = Int32Array::from(Vec::<i32>::new());
let b = Int32Array::from(Vec::<i32>::new());
// Err(self): the buffer is shared with `a`
assert!(unary_mut(a.clone(), |x| x + 1).is_err());
assert!(try_unary_mut(a.clone(), |x| Ok(x + 1)).is_err());
// Ok(Ok(empty)) instead of Err(self)
assert!(matches!(binary_mut(a.clone(), &b, |x, y| x + y), Ok(Ok(_))));
assert!(matches!(try_binary_mut(a.clone(), &b, |x, y| Ok(x + y)), Ok(Ok(_))));
Expected behavior
Should the binary forms return Err(self) for a shared buffer whatever its length, as the rustdoc says and the unary forms do? Or should all four return Ok for an empty array, and the rustdoc say so?
Additional context
Found by a property test of the arity helpers.
- Lenguaje dominante
- Rust
- Estrellas
- 3.7k
- Forks
- 1.5k
- Merge medio
- 2 d 16 h
- PR fusionados (30 d)
- 183
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/arrow-rs
-
parquet: `ArrowWriter::try_new` panics on a schema with a Union field instead of returning an errorAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
`RunArray::try_new` rejects run ends whose null buffer has no nullsPosiblemente ocupada @Surajsuthar la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/arrow-rs#12427 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
[Variant] `variant_get` string and binary cast errors show Rust builder type namesQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 61/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/arrow-rs
Issues similares
-
area:ui effort:medium enhancement P7 source:agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
marketing
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
machine rename accepts a label already used by another machine, making --machine <label> ambiguousAbiertomaintainer-needed p2 remote triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug help wanted ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
userFRM/egui-charts#4605 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día