Deduplicate bucket computation in width_bucket_interval_mdn_exact
Los mantenedores suelen responder en 1 día
@nightcityblade ya está trabajando en esto.
Desde el 14/10/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 85/100
Línea de trabajo
Empieza por width_bucket_interval_mdn_exact en spark/src/function/math/width_bucket.rs, donde las ramas "only month" y "months equals" repiten las comprobaciones de fuera de rango, la protección del ancho y el recorte de los buckets. Compara las dos ramas para ver qué partes difieren, sobre todo cómo se proyectan x, l y h a f64. Extrae una función auxiliar compartida que reciba los valores proyectados y devuelva Option<i64>, y haz que ambas ramas la llamen. Está terminado cuando ambas ramas usan la función auxiliar y las pruebas existentes de width_bucket pasan sin cambios.
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?
width_bucket_interval_mdn_exact (spark/src/function/math/width_bucket.rs#L300-L431) contains two near-identical blocks, "only month" (about L330-L366) and "months equals" (about L368-L424). Each repeats:
- the ascending/descending out-of-range checks (bucket
0ornum_buckets + 1), - the bucket-width computation with its zero / non-finite null guard,
- the floor-plus-one bucket clamp.
They differ only in how x, l and h are projected to f64 (months vs. day/nanosecond offset relative to l). Duplicated numeric edge-case handling like this is where a boundary fix ends up in only one copy.
Describe the solution you'd like
Extract fn bucket_from_f64(x: f64, l: f64, h: f64, num_buckets: i64, ascending: bool) -> Option<i64> (returning None for null). Each branch then only computes its projected (x, l, h) and calls it. Optionally move the per-row body into a helper returning Option<i64> so the continue chains disappear. The existing width_bucket tests cover the behaviour.
Describe alternatives you've considered
None.
Additional context
This is small and self-contained, a good first issue. Line references are pinned to commit 0d79252f61bd.
- 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
-
Use the shared aggr_test_schema in CSV scan tests instead of a local copyPosiblemente ocupada @med9110 la tomó hoy. 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ó hoy. 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ó hoy. 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
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/datafusion#26290 ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/datafusion
Issues similares
-
RUSTSEC-2026-0348: Brotli certificate decompression can allocate up to 1 GiB before authenticationAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 60/100
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 62/100
-
core: Amount::from_str panics on values above 21M BTC instead of returning an errorPosiblemente ocupada @bhuvan-somisetty la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
crate: spate-s3
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
write_iceberg ignores the table's write.parquet.compression-codec propertyPosiblemente ocupada @YuangGao la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Eventual-Inc/Daft#7606 ·
Los mantenedores suelen responder en 1 día