refactor(rust): Refactor hist
#25574
Open
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.
I'd like to move towards addressing #23272, but we need an integer-specific implementation of
histfor this to work, as the large-integer timestamps inusandnswork pretty poorly when converted to floats in the current histogram implementation. This refactor is intended to allow for easier paths for more dtype-specific histogram implementations if desired. The base algorithms remain the same, but there is a slightly better distinction between variable-width histograms (i.e. user-supplied edges) and uniform-width histograms (bin-count supplied).I've moved the cast of the series and bins to the IR to make the implementation a little cleaner by the time we reach it. If we move to temporal histograms, we can easily coerce the arguments in the IR as well so that supplied bins match the series.
At some point soon, I would like to rename
binstoedges(open issue #23335), since the parameter actually refers to the bin edges, not the bins themselves. Internally we now useedgesas it's much clearer what it refers to.No changes to tests, as they are fairly comprehensive.