Skip to content

Conversation

bpintea
Copy link
Contributor

@bpintea bpintea commented Nov 27, 2024

If COUNT agg has a filter applied, this must also be push down to source. This currently does not happen, but this issue is masked currently by two factors:

  • a logical optimisation, ExtractAggregateCommonFilter that extracts the filter out of the STATS entirely (and pushes it to source then from a WHERE);
  • the phisical plan optimisation implementing the push down, PushStatsToSource, currently only applies if there's just one agg function to push down.

However, this fix needs to be applied since:

  • it's still present in versions prior to ExtractAggregateCommonFilter introduction;
  • the defect might resurface when the restriction in PushStatsToSource is lifted.

Fixes #115522.

(cherry picked from commit 560e0c5)

If `COUNT` agg has a filter applied, this must also be push down to source. This currently does not happen, but this issue is masked currently by two factors:
* a logical optimisation, `ExtractAggregateCommonFilter` that extracts the filter out of the STATS entirely (and pushes it to source then from a `WHERE`);
* the phisical plan optimisation implementing the  push down, `PushStatsToSource`, currently only applies if there's just one agg function to push down.

However, this fix needs to be applied since:
* it's still present in versions prior to `ExtractAggregateCommonFilter` introduction;
* the defect might resurface when the restriction in `PushStatsToSource` is lifted.

Fixes elastic#115522.

(cherry picked from commit 560e0c5)
@bpintea bpintea added >bug backport auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Analytics/ES|QL AKA ESQL v8.16.2 labels Nov 27, 2024
@elasticsearchmachine elasticsearchmachine merged commit 8103eb4 into elastic:8.16 Nov 28, 2024
14 checks passed
@bpintea bpintea deleted the port/117503_8.16 branch November 28, 2024 10:22
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 >bug v8.16.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants