ESQL: Implement TO_STRING for exponential_histogram#138884
Merged
JonasKunz merged 8 commits intoelastic:mainfrom Dec 5, 2025
Merged
ESQL: Implement TO_STRING for exponential_histogram#138884JonasKunz merged 8 commits intoelastic:mainfrom
JonasKunz merged 8 commits intoelastic:mainfrom
Conversation
17 tasks
Collaborator
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
dnhatn
approved these changes
Dec 4, 2025
| if (this.processFunction.args.getFirst() instanceof StandardArgument == false) { | ||
| throw new IllegalArgumentException("first argument must be the field to process"); | ||
| } | ||
| argument = (StandardArgument) this.processFunction.args.getFirst(); |
|
|
||
| @ConvertEvaluator(extraName = "FromExponentialHistogram") | ||
| static BytesRef fromExponentialHistogram(ExponentialHistogram histogram) { | ||
| return new BytesRef(exponentialHistogramToString(histogram)); |
Member
There was a problem hiding this comment.
We convert to a string in exponentialHistogramToString (from a byte array), then convert to BytesRef here. However, since performance is not a concern for this method, it is perfectly fine to keep it this way instead of adding an exponentialHistogramToBytesRef method.
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.
exponential_histogramwould have been the only type without TO_STRING support.While this function is not necessarily very useful on this type, it might be used in explorative use-cases.
As it is not much effort, I decided to just add it.
The implementation will output a string containing the exponential histogram serialized as JSON.