MapBuilder can't build a MapArray with sorted keys
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 68/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- data-engineering
Direzione di ricerca
Inizia dall'implementazione Rust di MapBuilder: finish_helper chiama MapArray::new_unchecked con un false fisso per keys_sorted, e make_builder ignora il flag sorted su DataType::Map. Aggiungi un metodo with_keys_sorted(bool) accanto a with_keys_field e with_values_field, memorizza il flag e passalo a finish_helper. È completato quando l'esempio StructBuilder dell'issue si costruisce senza panic e un test conferma che il MapArray risultante riporta keys_sorted come true.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
MapBuilder always builds maps with keys_sorted = false. finish_helper passes false to MapArray::new_unchecked and there's no way to change it. make_builder also ignores the flag on DataType::Map(field, sorted).
So a builder made from a schema that has a sorted map field produces a column that doesn't match its own field. Inside a struct it panics:
let fields = vec![Field::new_map(
"m",
"entries",
Field::new("keys", DataType::Utf8, false),
Field::new("values", DataType::Int32, true),
true, // keys_sorted
false,
)];
let mut builder = StructBuilder::from_fields(fields, 1);
builder
.field_builder::<MapBuilder<Box<dyn ArrayBuilder>, Box<dyn ArrayBuilder>>>(0)
.unwrap()
.append(true)
.unwrap();
builder.append(true);
builder.finish();
// panics: Incorrect datatype for StructArray field "m", expected a sorted Map, got an unsorted one
The only workaround today is to finish the map, take it apart with into_parts() and rebuild it with MapArray::new(.., true). That doesn't help when the map is a child of a StructBuilder or ListBuilder, because the parent calls ArrayBuilder::finish on the child itself. Downstream crates end up wrapping MapBuilder just to set the flag.
Describe the solution you'd like
- Add
MapBuilder::with_keys_sorted(bool), next towith_keys_fieldandwith_values_field, defaulting tofalse. - Have
make_builderpass the flag fromDataType::Map.
The builder would only set the flag and not check key order, same as MapArray::try_new.
Describe alternatives you've considered
Validating the order in finish when the flag is set. That would need a comparison over arbitrary key types and would make finish fallible or panicking for something MapArray::try_new doesn't check either, so I'd leave it out.
Additional context
Related: #7100 / #7101 (with_keys_field), #11603 (FFI export dropped the keys sorted flag). I have a branch with the change and tests and can open a PR.
- 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
-
`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
-
parquet: GZip/Brotli page decompression is not bounded by the page's uncompressed sizeForse già presa @Subodh-17 l’ha presa 11 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/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