Push fallible scalar functions through sparse Dict arrays

Đang mở
#12,539 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
3.2k
Fork
239
Merge trung bình
1 ngày 4 giờ
Pull request đã merge (30 ngày)
684

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của vortex-data/vortex

Tất cả issue của vortex-data/vortex

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.