bench(arrow): add sparse dictionary to view cast benchmarks - #10596
Merged
Conversation
Jefffrey
reviewed
Aug 9, 2026
Comment on lines
+213
to
+214
| // `Dictionary<UInt64, Utf8>` of `size` rows over `distinct` values, each longer than 12 | ||
| // bytes so the resulting views reference the values buffer rather than inlining. |
Contributor
There was a problem hiding this comment.
should we have some mix of inline & long views to test more paths?
Contributor
Author
There was a problem hiding this comment.
done this, values now alternate short and long so both view paths get exercised
Comment on lines
+216
to
+219
| // The ratio of rows to distinct values is what matters when casting to a view: the cast | ||
| // can either build one view per dictionary value and gather those with `take`, or build | ||
| // one view per row directly against the values buffer. Which of the two is cheaper depends | ||
| // on that ratio, so both a dense and a sparse shape are benchmarked below. |
Contributor
There was a problem hiding this comment.
dont have too much detail on implementation here; just keep simple like "different implementation paths may be taken based on ratio of rows to distinct values"
| // As `build_string_dict_array`, but with `Binary` values. Casting those to `Utf8View` has | ||
| // to validate the dictionary values as UTF-8, which a `Utf8` source does not. | ||
| fn build_binary_dict_array(size: usize, distinct: usize) -> ArrayRef { | ||
| let values = BinaryArray::from_iter_values( |
Contributor
There was a problem hiding this comment.
could also get this by using output of build_string_dict_array() and casting to Dictionary(Binary)
…ast (review addressed)
Jefffrey
approved these changes
Aug 9, 2026
Contributor
|
thanks @Abhisheklearn12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
None. Split out of #10436 at review request, so these land on main first and the bot can measure that PR against them.
Rationale for this change
cast_kernelshas one dictionary to view benchmark, at 10,000 rows over 3 values. Nothing covers the opposite shape, a dictionary much larger than the array, and nothing coversdict<binary> -> utf8view, which validates the values as UTF-8.What changes are included in this PR?
Two benchmarks, both 1024 rows over 32,768 values:
cast dict to string view (sparse). For perf(arrow-cast): gate Dictionary -> View fast path on cardinality #10436 this is a no regression check rather than an expected win, since main already takes the direct path at this shapecast binary dict to string view (sparse). No dense counterpart, since that shape runs the same code either wayKeys come from
seedable_rngso they spread across the dictionary, and values exceed 12 bytes so the views reference the buffer rather than inlining.Are these changes tested?
Benchmarks only, no library code touched. They build and run under
cargo bench -p arrow --features test_utils --bench cast_kernels.Are there any user-facing changes?
No.