Skip to content

Mechanism for foldable aggregations in ES|QL #118292

@astefan

Description

@astefan

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions