-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add parsing for InternalBucketMetricValue #24182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add parsing for InternalBucketMetricValue #24182
Conversation
javanna
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a question on the new interface, LGTM otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there was no interface before? That may complicate migration from transport client for users? or was SingleValue enough from the Java api?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess is transport client users that needed only value() or getValueAsString() would cast to NumericMetricsAggregation.SingleValue, if you needed keys() you would have to cast to InternalBucketMetricValue. I think it is a kind of oversight that there is no interface, other aggregations that are the output of pipeline aggregators (like InternalSimpleValue) have an interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets ask @colings86 if this interface was left out intentionally and whether we should add it on master/5.x so this works similar to e.g. InternalSimpleValue class / SimpleValue interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this interface must have been left out by accident. I think it makes sense to add it especially since there is an interface for SimpleValue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @colings86, I will pull adding the interface out as a single PR against master branch then like Luca suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened #24188 for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course
f121f13 to
bd0b396
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I'm asking something thats already been discussed but why are we adding this method given we already have value() below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only added this because similar single value interfaces like Sum/Min/Max etc... implement double getValue() in addition to double value(), just to stay consistend. Happy to remove this from this interface, as you said we don't really need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this interface must have been left out by accident. I think it makes sense to add it especially since there is an interface for SimpleValue
bd0b396 to
526b23a
Compare
tlrx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, left very minor comments
| // cannot differentiate between them. Also we cannot recreate the exact String representation | ||
| assertEquals(parsed.value(), Double.NEGATIVE_INFINITY, 0); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line
|
|
||
| public class ParsedBucketMetricValue extends ParsedSingleValueNumericMetricsAggregation implements BucketMetricValue { | ||
|
|
||
| private List<String> keys = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
emptyList()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, thats better in this case. Thanks.
Similar to #24085 this adds parsing for InternalBucketMetricValue. This will be needed for
the high level rest client. I also added a new BucketMetricValue interface since InternalBucketMetricValue didn't implement an interface yet so the keys() method wouldn't be accessible on the client side without casting to a concrete implementation.
PR is against the current feature branch for aggregation parsing.