Skip to content

re-factor top-metrics to use a generic multi value output interface#71903

Merged
hendrikmuhs merged 9 commits intoelastic:masterfrom
hendrikmuhs:top-metrics-multivalue
Apr 21, 2021
Merged

re-factor top-metrics to use a generic multi value output interface#71903
hendrikmuhs merged 9 commits intoelastic:masterfrom
hendrikmuhs:top-metrics-multivalue

Conversation

@hendrikmuhs
Copy link
Copy Markdown

re-factor top-metrics to return generic(non-numeric) multi value
aggregation results

relates #71850

Motivation: top metrics implements InternalNumericMetricsAggregation.MultiValue, however is not limited to returning numeric, but it can return an arbitrary type.

However, I kept the the numeric dependency on the builder side, which seems to be valid as sorting is based on it.

A big benefit of this change: The former multi-value inteface was limited to return the top 1, this interface will make it possible to return top-N.

/CC @nik9000

@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Apr 20, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

Copy link
Copy Markdown
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is better than continuing to implement NumericMetricsAggregation.MultiValue. I have some comments around specific bits but I really like it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this one? It feels fairly top-metrics specific.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I will need this for transform later. I basically want to know the size before iterating over the values. I could instead make getValuesAsStrings returning a List, but I like Iterable more, although it is a List.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is something against size: it basically says that all values have that size. That might not be true and/or limit us in future.

WDYT about removing and changing getValuesAsStrings to return List?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is something against size: it basically says that all values have that size. That might not be true and/or limit us in future.

Yeah, that is the problem I had with size. We could make a maxSize if that's something that you'd need. But getting the results as a list seems sensible to me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "InternalX" class and "X" interface has existed for a long time for the transport client. But with it deprecated I think we can do away with the "X" interface.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking out loud, as much as I'd like to remove these now we probably should keep making them until we're ready to change all of them....

@hendrikmuhs hendrikmuhs force-pushed the top-metrics-multivalue branch from b217d96 to 9c8d13c Compare April 21, 2021 07:23
Copy link
Copy Markdown
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hendrikmuhs hendrikmuhs merged commit a96cad4 into elastic:master Apr 21, 2021
@hendrikmuhs hendrikmuhs deleted the top-metrics-multivalue branch April 21, 2021 14:12
hendrikmuhs pushed a commit that referenced this pull request Apr 21, 2021
…71903)

re-factor top-metrics to return generic(non-numeric) multi value
aggregation results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Aggregations Aggregations >refactoring Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v7.14.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants