-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Lens] optimize duplicate formula functions #140859
[Lens] optimize duplicate formula functions #140859
Conversation
@elasticmachine merge upstream |
…5/optimize-duplicate-last-value-functions
1819a6a
to
6c8414c
Compare
@flash1293 Thinking more about how much flexibility to give the operation classes for optimizing... All the simple “dedupe” optimizations are turning out to follow the same set of steps
The only step here that is really specific to an operation type is deciding which aggs are duplicate. So, we could extend the operation class with a method called something like Any thoughts? |
@andrewctate This makes sense to me |
@elasticmachine merge upstream |
…ub.com:andrewctate/kibana into 135265/optimize-duplicate-last-value-functions
Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors) |
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.
This works well but the getGroupByKey
implementations are very similar across operations. Could we unify this further (either as a helper function importing in every operation or by having the operation just state the arguments that need to be checked)
…-duplicate-last-value-functions
@elasticmachine merge upstream |
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.
Looks almost good to me, found one edge case that could be handled better. I tested around and this is a really nice optimization.
I think it will become more relevant with the planned formula features like conditionals, but even right now it's already super nice:
Both of these just need to fetch data once now 🎉
x-pack/plugins/lens/public/indexpattern_datasource/operations/definitions/last_value.tsx
Show resolved
Hide resolved
@kibanamachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
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.
AppServices changes LGTM
Summary
Part of #135265
Optimizes semantically-duplicate functions of the following types
Left to do
This PR also improves how we update order-by references from terms aggregations for percentile operations. Instead of anticipating the optimization in the
toEsAggsFn
method on the terms operation class, we update the order-bys as part of the AST transformations themselves in theoptimizeEsAggs
method on the percentile operation class.Testing
Create a visualization and add a dimension with this formula
Check the Elasticsearch request in the inspector. There should only be 7 aggregations, not 14.
Then try this formula
Checklist
Delete any items that are not applicable to this PR.