[ES|QL] Fix TS bug when grouping on aliases#141568
Merged
limotova merged 9 commits intoelastic:mainfrom Feb 4, 2026
Merged
Conversation
In queries like `max(max_over_time(field)) by p = pod`, we end up an Alias in our grouping, which causes a failure: "expected named expression for grouping". This commit fixes that and allows us to group on aliases, and by extension evals like `to_upper(pod)` as well.
Collaborator
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
…and potentially become DimensionValues
dnhatn
reviewed
Feb 2, 2026
Member
dnhatn
left a comment
There was a problem hiding this comment.
One comment, but the fix looks great. Can you add a unit test in LogicalPlanOptimizerTests please? Thanks, Larisa!
| List<Expression> firstPassGroupings, | ||
| List<Expression> secondPassGroupings | ||
| ) { | ||
| firstPassGroupings.add(timeBucket); |
Member
There was a problem hiding this comment.
I think we need to handle cases where timeBucket is a ReferenceAttribute.
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
jfreden
pushed a commit
to jfreden/elasticsearch
that referenced
this pull request
Feb 4, 2026
In queries like `max(max_over_time(field)) by p = pod`, we end up an Alias in our grouping, which causes a failure: "expected named expression for grouping". This commit fixes that and allows us to group on aliases, and by extension evals like `to_upper(pod)` as well.
spinscale
pushed a commit
to spinscale/elasticsearch
that referenced
this pull request
Feb 4, 2026
In queries like `max(max_over_time(field)) by p = pod`, we end up an Alias in our grouping, which causes a failure: "expected named expression for grouping". This commit fixes that and allows us to group on aliases, and by extension evals like `to_upper(pod)` as well.
limotova
added a commit
to limotova/elasticsearch
that referenced
this pull request
Feb 4, 2026
mamazzol
pushed a commit
to mamazzol/elasticsearch
that referenced
this pull request
Feb 5, 2026
In queries like `max(max_over_time(field)) by p = pod`, we end up an Alias in our grouping, which causes a failure: "expected named expression for grouping". This commit fixes that and allows us to group on aliases, and by extension evals like `to_upper(pod)` as well.
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.
In queries like
max(max_over_time(field)) by p = pod, we end upan Alias in our grouping, which causes a failure: "expected named
expression for grouping". This commit fixes that and allows us to
group on aliases, and by extension evals like
to_upper(pod)aswell.