array_min / array_max fail on a zero-row batch for non-primitive element types
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
Línea de trabajo
Empieza con array_min_max_helper en datafusion/functions-nested/src/min_max.rs y sigue el fallback para tipos de elementos no primitivos. Añade cobertura para una entrada List<Utf8> con cero filas y verifica que la función devuelve cero filas sin error; compara con el comportamiento existente para tipos primitivos.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
array_min / array_max on a zero-row List<Utf8> (or any non-primitive element type) fails:
Execution error: Empty iterator passed to ScalarValue::iter_to_array
A zero-row List<Int64> works. array_min_max_helper (datafusion/functions-nested/src/min_max.rs) only has a fast path for primitive types; the fallback builds a Vec<ScalarValue> and calls ScalarValue::iter_to_array, which rejects an empty iterator.
Zero-row batches do reach these functions in practice: ProjectionExec and TopK evaluate expressions on every batch, so ORDER BY array_min(tags) LIMIT n fails whenever an input emits an empty batch.
To Reproduce
use std::sync::Arc;
use datafusion::arrow::array::{ArrayRef, ListBuilder, StringBuilder};
use datafusion::arrow::record_batch::RecordBatch;
use datafusion::prelude::SessionContext;
#[tokio::main]
async fn main() -> datafusion::error::Result<()> {
let ctx = SessionContext::new();
let tags: ArrayRef = Arc::new(ListBuilder::new(StringBuilder::new()).finish());
ctx.register_batch("t", RecordBatch::try_from_iter(vec![("tags", tags)])?)?;
ctx.sql("SELECT array_min(tags) FROM t").await?.show().await?; // error
Ok(())
}
Seen on 54.0.0; the code is unchanged on main.
Expected behavior
Zero rows, the same as for primitive element types.
Additional context
Found in OpenSearch's DataFusion backend when sorting on multi-valued keyword fields with an empty shard. Proposed fix: return new_empty_array(&array.value_type()) for an empty input before the fallback. PR to follow.
- Lenguaje dominante
- Rust
- Estrellas
- 9.4k
- Forks
- 2.5k
- Merge medio
- 4 d 9 h
- PR fusionados (30 d)
- 329
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- 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
-
bug help wanted unparser
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/datafusion#26316 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Deduplicate bucket computation in width_bucket_interval_mdn_exactPosiblemente ocupada @nightcityblade la tomó hace 1 día. Abiertoenhancement good first issue help wanted spark tech debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
apache/datafusion#26307 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Use the shared aggr_test_schema in CSV scan tests instead of a local copyPosiblemente ocupada @med9110 la tomó hace 1 día. Abiertocore enhancement good first issue help wanted tech debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
apache/datafusion#26306 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
gcd benchmarks pass number_rows: 0 for 100k-row inputsPosiblemente ocupada @med9110 la tomó hace 1 día. Abiertobug functions good first issue help wanted tech debt
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
apache/datafusion#26297 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Struct union type coercion takes field nullability from the wrong field when field order differsPosiblemente ocupada @med9110 la tomó hace 1 día. Abiertobug help wanted logical-expr tech debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/datafusion#26296 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/datafusion
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
ActivityWatch/aw-notify-rs#47 · 1 comentario ·
-
`inverse()` of a controlled `CUGate` drops the phase parameter γPosiblemente ocupada @rupasri118 la tomó hoy. Abiertobug mod: circuit
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Qiskit/qiskit#17223 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
Los mantenedores suelen responder en 2 días
-
agent:triaged bug bughunt pm:bundler priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
SocketDev/socket-patch#1573 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
rustix::termios::Termios::OutputModes does not expost some const e.g. OLCUC for musl and macOSAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
bytecodealliance/rustix#1706 · 1 comentario ·
Los mantenedores suelen responder en 11 días