Push fallible scalar functions through sparse Dict arrays

Aberta
#12,539 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
52/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
rust

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Rust
Estrelas
3.2k
Forks
239
Merge médio
1d 4h
PRs com merge (30d)
684

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de vortex-data/vortex

Todas as issues de vortex-data/vortex

Issues semelhantes

Mais issues de Rust

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.