Propagates filter() to aggregation functions' surrogates#134461
Merged
ncordon merged 14 commits intoelastic:mainfrom Sep 15, 2025
Merged
Propagates filter() to aggregation functions' surrogates#134461ncordon merged 14 commits intoelastic:mainfrom
ncordon merged 14 commits intoelastic:mainfrom
Conversation
Collaborator
|
Hi @ncordon, I've created a changelog YAML for you. |
967c2e9 to
c7715fa
Compare
Collaborator
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
ivancea
approved these changes
Sep 11, 2025
x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats.csv-spec
Outdated
Show resolved
Hide resolved
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
Outdated
Show resolved
Hide resolved
Comment on lines
+185
to
+189
| Expression expression = randomFrom( | ||
| buildLiteralExpression(testCase), | ||
| buildDeepCopyOfFieldExpression(testCase), | ||
| buildFieldExpression(testCase) | ||
| ); |
Contributor
There was a problem hiding this comment.
nit: I think there's an overload with suppliers here. Something like:
Suggested change
| Expression expression = randomFrom( | |
| buildLiteralExpression(testCase), | |
| buildDeepCopyOfFieldExpression(testCase), | |
| buildFieldExpression(testCase) | |
| ); | |
| Expression expression = randomFrom( | |
| random(), | |
| () -> buildLiteralExpression(testCase), | |
| () -> buildDeepCopyOfFieldExpression(testCase), | |
| () -> buildFieldExpression(testCase) | |
| ); |
.../test/java/org/elasticsearch/xpack/esql/expression/function/AbstractAggregationTestCase.java
Outdated
Show resolved
Hide resolved
ivancea
approved these changes
Sep 12, 2025
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
ncordon
added a commit
to ncordon/elasticsearch
that referenced
this pull request
Sep 15, 2025
) --------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com> (cherry picked from commit 381fc8e) # Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Sum.java
ncordon
added a commit
to ncordon/elasticsearch
that referenced
this pull request
Sep 15, 2025
) --------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com> (cherry picked from commit 381fc8e) # Conflicts: # x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats.csv-spec # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Count.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Sum.java
This was referenced Sep 15, 2025
Contributor
Author
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
ncordon
added a commit
to ncordon/elasticsearch
that referenced
this pull request
Sep 15, 2025
) --------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com> (cherry picked from commit 381fc8e) # Conflicts: # x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats.csv-spec # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Count.java # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Sum.java
ncordon
added a commit
to ncordon/elasticsearch
that referenced
this pull request
Sep 15, 2025
) --------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com> (cherry picked from commit 381fc8e)
ncordon
added a commit
to ncordon/elasticsearch
that referenced
this pull request
Sep 15, 2025
) --------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com> (cherry picked from commit 381fc8e)
ncordon
added a commit
to ncordon/elasticsearch
that referenced
this pull request
Sep 15, 2025
) --------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com> (cherry picked from commit 381fc8e)
ncordon
added a commit
to ncordon/elasticsearch
that referenced
this pull request
Sep 15, 2025
) --------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com> (cherry picked from commit 381fc8e)
ncordon
added a commit
to ncordon/elasticsearch
that referenced
this pull request
Sep 15, 2025
) --------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com> (cherry picked from commit 381fc8e)
mridula-s109
pushed a commit
to mridula-s109/elasticsearch
that referenced
this pull request
Sep 17, 2025
ncordon
added a commit
that referenced
this pull request
Sep 18, 2025
) (#134725) --------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com>
ncordon
added a commit
that referenced
this pull request
Sep 18, 2025
--------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com>
ncordon
added a commit
that referenced
this pull request
Sep 18, 2025
--------- Co-authored-by: Jan Kuipers <jan.kuipers@elastic.co> Co-authored-by: Jan Kuipers <148754765+jan-elastic@users.noreply.github.com>
gmjehovich
pushed a commit
to gmjehovich/elasticsearch
that referenced
this pull request
Sep 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an aggregate expression can get replaced by a surrogate in the planner, we have to propagate the original
filter()part. Example:gets replaced internally by a
MIN(field)but we were losing theWHEREpartFixes #134380