Skip to content

bench: add array_has array-needle benchmarks#23335

Merged
gabotechs merged 2 commits into
apache:mainfrom
freakyzoidberg:bench/array-has-array
Jul 6, 2026
Merged

bench: add array_has array-needle benchmarks#23335
gabotechs merged 2 commits into
apache:mainfrom
freakyzoidberg:bench/array-has-array

Conversation

@freakyzoidberg

@freakyzoidberg freakyzoidberg commented Jul 6, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Rationale for this change

In order to correctly characterize a performance improvement for array_has with column needle, needed more benchmark cover.

What changes are included in this PR?

Adds criterion benchmarks for array_has with an array (column) needle — the path through array_has_dispatch_for_array, with no functional change.

Groups added in datafusion/functions-nested/benches/array_has.rs:

  • array_has_array_i64 / array_has_array_strings — found / not-found over list sizes 10/100/500.
  • array_has_array_null_patterns — null patterns at list length 64: for i64, no nulls (found + not found) / 30% nulls found / 30% nulls not found / all null / null-fill collision; for Utf8, LargeUtf8, and Utf8View, no-nulls / 30% nulls at both short (inline, ≤ 12 byte) and long (> 12 byte, shared-prefix) element lengths, plus all-null.
  • array_has_array_by_size — i64, 30% element nulls, not found, list length 8..1024.
  • array_has_array_by_rows — i64, 8 elems/row, 30% nulls, not found, 10K / 100K / 1M rows.

Are these changes tested?

no functional change here

Are there any user-facing changes?

no

Adds criterion benchmarks for `array_has` with an array (column) needle --
the path through `array_has_dispatch_for_array`:

- `array_has_array_i64` / `array_has_array_strings`: found / not-found over
  list sizes 10/100/500.
- `array_has_array_null_patterns`: null patterns at list length 64 (no nulls,
  30% nulls found/not-found, all null, and a null-fill collision) for i64, and
  no-nulls / 30% nulls for each of the Utf8, LargeUtf8, and Utf8View string
  element types at both short (inline, <= 12 byte) and long (> 12 byte,
  shared-prefix) element lengths, plus all-null.
- `array_has_array_by_size`: i64, 30% nulls, not found, list length 8..1024.
- `array_has_array_by_rows`: i64, 8 elems/row, 30% nulls, not found, 10K..1M rows.

Added ahead of the array-needle optimization (a separate PR) so the before/after
can be measured by running `cargo bench --bench array_has` on `main` and then on
the optimization branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread datafusion/functions-nested/benches/array_has.rs
Add `i64/no_nulls_not_found` to `array_has_array_null_patterns` -- the worst
case for the all-valid fast path (non-null elements, needle absent), where the
branchless OR-reduction scans the whole row without short-circuiting.

Addresses review feedback on apache#23335.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the functions Changes to functions implementation label Jul 6, 2026

@gabotechs gabotechs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 Thanks @freakyzoidberg for the PR, and @geoffreyclaude for the review!

@gabotechs gabotechs added this pull request to the merge queue Jul 6, 2026
Merged via the queue into apache:main with commit 0365d3c Jul 6, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants