Add StructArray and RunArray benchmark tests to with_hashes#20182
Open
notashes wants to merge 3 commits intoapache:mainfrom
Open
Add StructArray and RunArray benchmark tests to with_hashes#20182notashes wants to merge 3 commits intoapache:mainfrom
StructArray and RunArray benchmark tests to with_hashes#20182notashes wants to merge 3 commits intoapache:mainfrom
Conversation
Jefffrey
reviewed
Feb 7, 2026
| // with_hash has different code paths for single vs multiple arrays and nulls vs no nulls | ||
| let nullable_array = add_nulls(&array); | ||
| // RunArray encodes nulls in the values array, not at the array level | ||
| let nullable_array = if name.starts_with("run_array") { |
Contributor
There was a problem hiding this comment.
Maybe we should take the approach by #20179 to have this as an explicit property instead of checking by name
| .collect::<arrow::array::BooleanArray>(), | ||
| ); | ||
|
|
||
| let int32_array: ArrayRef = Arc::new( |
Contributor
There was a problem hiding this comment.
Maybe we could reuse the existing functions above to create these random arrays? e.g. primitive_array()
The only difference I see is that it uses its own rng; is this a big concern, considering each of these functions currently use their own rng anyway?
| } | ||
|
|
||
| /// Create a RunArray with null values | ||
| fn create_run_array_with_null_values<T>(array_len: usize) -> ArrayRef |
Contributor
There was a problem hiding this comment.
I feel we can reduce the duplication with above function here if the only difference is nulls 🤔
It would just be a matter of calling add_nulls() on the values array
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?
StructArrayandRunArraybenchmarks towith_hashessuite in datafusion-common #20181Rationale for this change
Issue #20152 identifies potential areas for optimization for
RunArrayandStructArrayhashing. But the existingwith_hashesbenchmark tests don't include coverage for these types.What changes are included in this PR?
Added benchmarks to
with_hashes.rs:Are these changes tested?
No additional tests added, but the benchmarks both compile and run.
a sample run:
Are there any user-facing changes?