Skip to content

Mechanism for foldable aggregations in ES|QL #118292

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

Open
astefan opened this issue Dec 9, 2024 · 1 comment
Open

Mechanism for foldable aggregations in ES|QL #118292

astefan opened this issue Dec 9, 2024 · 1 comment
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@astefan
Copy link
Contributor

astefan commented Dec 9, 2024

Description

Currently, ES|QL lacks two major performance improvements aspects for aggregations (stats):

A first attempt at addressing this introduced too many workarounds to be considered valuable and merge-worthy:

  • Calling SubstituteSurrogates twice. The SubstituteSurrogates rule should be called only once, its role shouldn't be a partial mechanism for dealing with constants in aggregate functions, as it happens now.
  • surrogate expression replacement before the entire set of constants have been folded and propagated can introduce issues for validation of arguments correctness. See this situation where currently this is an issue. More about this concept here and here as well.
  • having SubstituteSurrogates be called twice introduced yet another issue and broke existent working behavior

As a consequence, aggregations must support a specific mechanism in which they can provide a result given they receive constants as arguments, probably in the form of an interface. This should also come with support in the LogicalPlanOptimizer in the form of a new rule + changes to existent rules that deal with folding, null folding and constants propagation.

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Dec 9, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

No branches or pull requests

2 participants