`binary_mut` and `try_binary_mut` return `Ok` for an empty array whose buffer is shared
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #12012 di @abhinav-phi — chiusa senza merge
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 52/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 3.7k
- Fork
- 1.5k
- Merge medio
- 2g 16h
- PR unite (30g)
- 183
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/arrow-rs
-
parquet: `ArrowWriter::try_new` panics on a schema with a Union field instead of returning an errorAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
`RunArray::try_new` rejects run ends whose null buffer has no nullsForse già presa @Surajsuthar l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
apache/arrow-rs#12427 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Variant] `variant_get` string and binary cast errors show Rust builder type namesForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/arrow-rs
Issue simili
-
area:ui effort:medium enhancement P7 source:agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
marketing
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
machine rename accepts a label already used by another machine, making --machine <label> ambiguousApertamaintainer-needed p2 remote triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug help wanted ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
userFRM/egui-charts#4605 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno