Skip to content

ESQL: Introduce per agg filter (#113735)#114842

Merged
elasticsearchmachine merged 3 commits intoelastic:8.xfrom
costin:backport/esql/filter-per-agg
Oct 15, 2024
Merged

ESQL: Introduce per agg filter (#113735)#114842
elasticsearchmachine merged 3 commits intoelastic:8.xfrom
costin:backport/esql/filter-per-agg

Conversation

@costin
Copy link
Copy Markdown
Member

@costin costin commented Oct 15, 2024

Add support for aggregation scoped filters that work dynamically on the
data in each group.

| STATS
    success = COUNT(*) WHERE 200 <= code AND code < 300,
   redirect = COUNT(*) WHERE 300 <= code AND code < 400,
 client_err = COUNT(*) WHERE 400 <= code AND code < 500,
 server_err = COUNT(*) WHERE 500 <= code AND code < 600,
total_count = COUNT(*)

Implementation wise, the base AggregateFunction has been extended to
allow a filter to be passed on. This is required to incorporate the
filter as part of the aggregate equality/identify which would fail with
the filter as an external component.

As part of the process, the serialization for the existing aggregations
had to be fixed so AggregateFunction implementations so that it
delegates to their parent first.

(cherry picked from commit d102659)
Backport for #113735

Add support for aggregation scoped filters that work dynamically on the
 data in each group.

| STATS
    success = COUNT(*) WHERE 200 <= code AND code < 300,
   redirect = COUNT(*) WHERE 300 <= code AND code < 400,
 client_err = COUNT(*) WHERE 400 <= code AND code < 500,
 server_err = COUNT(*) WHERE 500 <= code AND code < 600,
 total_count = COUNT(*)

Implementation wise, the base AggregateFunction has been extended to
 allow a filter to be passed on. This is required to incorporate the
 filter as part of the aggregate equality/identify which would fail with
 the filter as an external component.

As part of the process, the serialization for the existing aggregations
 had to be fixed so AggregateFunction implementations so that it
 delegates to their parent first.

(cherry picked from commit d102659)
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @costin, I've created a changelog YAML for you. Note that since this PR is labelled release highlight, you need to update the changelog YAML to fill out the extended information sections.

@costin costin added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Oct 15, 2024
@elasticsearchmachine elasticsearchmachine merged commit fc90105 into elastic:8.x Oct 15, 2024
@costin costin deleted the backport/esql/filter-per-agg branch October 15, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport ES|QL-ui Impacts ES|QL UI >feature v8.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants