Push fallible scalar functions through sparse Dict arrays

Abierto
#12,539 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

Start by reading vortex-array/src/arrays/dict/compute/rules.rs, especially DictionaryScalarFnValuesPushDownRule and the handling of has_all_values_referenced(). Benchmark the existing row-wise and dictionary push-down paths for sparse dictionaries, including fallible functions such as utf8_to_json and checked integer division. Done means sparse dictionary values are evaluated through the new path when the heuristic permits, while edge cases and regressions are covered by benchmarks and tests.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

feature
Problem or motivation

DictionaryScalarFnValuesPushDownRule (vortex-array/src/arrays/dict/compute/rules.rs) skips fallible scalar functions when has_all_values_referenced() is false, because a reduce rule cannot inspect codes to avoid evaluating unreferenced entries. On sliced or filtered dictionaries (where all_values_referenced is reset), fallible scalar functions like utf8_to_json, json_to_utf8, parse_uuid, or checked integer division fall back to row-wise execution, re-evaluating duplicate values and losing dictionary encoding downstream.

Proposed solution

Add an execution-time ExecuteParentKernel<Dict> for AnyScalarFn that handles sparse dictionaries (!has_all_values_referenced() and !signature.is_infallible()), gated by a benchmarked heuristic so it only runs when it beats row-wise execution.

Two approaches to evaluate and benchmark:

  1. Masking unreferenced values (strict functions only): use DictArrayExt::compute_referenced_values_mask to mask out unreferenced entries in values, then evaluate the scalar function on the masked values without allocating a rank table, remapping codes, or copying values.
  2. Compacting referenced values (works for non-strict functions too): scan codes to build referenced_indices and remap codes, gather referenced values, evaluate the scalar function once per distinct referenced value, and return a Dict with all_values_referenced = true.

Open questions:

  • What cardinality ratio (values.len() / codes.len()) or function-cost signal prevents regressions on cheap fallible functions (such as integer division) over near-dense dictionaries?
  • Should this decline on non-host (CUDA) codes, empty inputs, and strict functions with null constant siblings (to preserve short-circuiting and execution-time checks)?
Additional context

Prototype and review discussion in #12537 (closed pending benchmarks and a clear cost heuristic). Related to #12535 and #11693.

Lenguaje dominante
Rust
Estrellas
3.2k
Forks
239
Merge medio
1 d 4 h
PR fusionados (30 d)
684

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vortex-data/vortex

Todos los issues de vortex-data/vortex

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.