Implement min, max, sum for run-end-encoded arrays.#9409
Open
brunal wants to merge 3 commits intoapache:mainfrom
Open
Implement min, max, sum for run-end-encoded arrays.#9409brunal wants to merge 3 commits intoapache:mainfrom
brunal wants to merge 3 commits intoapache:mainfrom
Conversation
Efficient implementations: * min & max work directly on the values child array. * sum folds over run lengths & values, without decompressing the array. In particular, those implementations takes care of the logical offset & len of the run-end-encoded arrays. This is non-trivial: * We get the physical start & end indices in O(log(#runs)), but those are incorrect for empty arrays. * Slicing can happen in the middle of a run. For sum, we need to track the logical start & end and reduce the run length accordingly. Finally, one caveat: the aggregation functions only work when the child values array is a primitive array. That's fine ~always, but some client might store the values in an unexpected type. They'll either get None or an Error, depending on the aggregation function used.
Contributor
Author
|
Note that in a future MR, I'm likely to move most of |
Jefffrey
reviewed
Feb 13, 2026
Contributor
Author
|
I'm not handling null values properly when computing sums. Back to draft. |
Contributor
Author
|
Thank you for the review. values_slice/sliced_values are very helpful and clean up nicely the implementations. They do have a performance downside (looking for physical indices twice) but that seems worth the clean code. |
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.
Efficient implementations:
In particular, those implementations takes care of the logical offset & len of the run-end-encoded arrays. This is non-trivial:
Finally, one caveat: the aggregation functions only work when the child values array is a primitive array. That's fine ~always, but some client might store the values in an unexpected type. They'll either get None or an Error, depending on the aggregation function used.
This feature is tracked in #3520.