[ES|QL] Any-value aggregators#143619
Merged
mouhc1ne merged 7 commits intoelastic:mainfrom Mar 5, 2026
Merged
Conversation
- Create an "any-value" agg string template and use it to generate an aggregator for all supported types. - These aggregators read from one channel only, and are invoked from FIRST/LAST whenever the sort field is null-typed or is foldable, because in such case we're happy getting back any value from the search field. - They can be used whenever it is irrelevant which value we get as long as we get one from the field. To not confuse with getting back a random value, because this isn't really random; the aggregator will return the first value encountered, whether it was null, single-valued or multi-valued. - Create grouped/ungrouped agg functions unit tests.
…e generated by the template
Collaborator
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
alex-spies
approved these changes
Mar 5, 2026
Contributor
alex-spies
left a comment
There was a problem hiding this comment.
Heya, I reviewed only the spec tests to check in on the general behavior. That looks correct and very nice to me. I left some minor test suggestions, only, but realize that the bulk of it should be tested via aggs (unit) tests.
x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats_first_last.csv-spec
Show resolved
Hide resolved
x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats_first_last.csv-spec
Outdated
Show resolved
Hide resolved
x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats_first_last.csv-spec
Outdated
Show resolved
Hide resolved
# Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
- Add supplier dispatch logic to LAST - Add csv test where FIRST is the pipeline breaker - Pass more types
nik9000
approved these changes
Mar 5, 2026
| for (int i = 0; i < count; ++i) { | ||
| groupValues.set(i, valuesBlock.get$v_Type$(i + offset)); | ||
| } | ||
| $endif$ |
Member
There was a problem hiding this comment.
I think it's easier to read these if they are pulled all the way to the left. Like, then the "control" stuff is out of the way of the code. Mostly.
spinscale
pushed a commit
to spinscale/elasticsearch
that referenced
this pull request
Mar 6, 2026
- Create an "any-value" agg string template and use it to generate an aggregator for all supported types. - These aggregators read from one channel only, and are invoked from FIRST/LAST whenever the sort field is null-typed or is foldable, because in such case we're happy getting back any value from the search field. - They can be used whenever it is irrelevant which value we get as long as we get one from the field. To not confuse with getting back a random value, because this isn't really random; the aggregator will return the first value encountered, whether it was null, single-valued or multi-valued. - Create grouped/ungrouped agg functions unit tests.
sidosera
pushed a commit
to sidosera/elasticsearch
that referenced
this pull request
Mar 6, 2026
- Create an "any-value" agg string template and use it to generate an aggregator for all supported types. - These aggregators read from one channel only, and are invoked from FIRST/LAST whenever the sort field is null-typed or is foldable, because in such case we're happy getting back any value from the search field. - They can be used whenever it is irrelevant which value we get as long as we get one from the field. To not confuse with getting back a random value, because this isn't really random; the aggregator will return the first value encountered, whether it was null, single-valued or multi-valued. - Create grouped/ungrouped agg functions unit tests.
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.
any-valueagg string template and use it to generate an aggregator for all supported types.FIRST/LASTwhenever the sort field is null-typed or is foldable, because in such case we're happy getting back any value from the search field.grouped/ungroupedagg functions unit tests.