MapBuilder can't build a MapArray with sorted keys
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- rust
- Área
- data-engineering
Línea de trabajo
Empieza en la implementación en Rust de MapBuilder: finish_helper llama a MapArray::new_unchecked con un false fijo para keys_sorted, y make_builder ignora el flag sorted en DataType::Map. Añade un método with_keys_sorted(bool) junto a with_keys_field y with_values_field, guarda el flag y pásalo a finish_helper. Está terminado cuando el ejemplo de StructBuilder del issue se construye sin provocar un panic y un test confirma que el MapArray resultante informa keys_sorted como true.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- 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
-
`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
-
parquet: GZip/Brotli page decompression is not bounded by the page's uncompressed sizePosiblemente ocupada @Subodh-17 la tomó hace 11 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/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