Skip to content

Fix alias id when drop all aggregates#135247

Merged
dnhatn merged 5 commits intoelastic:mainfrom
dnhatn:fix-alias-id-aggregates
Sep 24, 2025
Merged

Fix alias id when drop all aggregates#135247
dnhatn merged 5 commits intoelastic:mainfrom
dnhatn:fix-alias-id-aggregates

Conversation

@dnhatn
Copy link
Member

@dnhatn dnhatn commented Sep 23, 2025

When dropping all aggregates, we create a synthetic aggregate referring to the first grouping. However, we use the ID of the first aggregate instead of the first grouping, which can lead to a single attribute referring to multiple channels when building the layout.

java.lang.AssertionError: Duplicate name ids are not allowed in layouts
    at org.elasticsearch.xpack.esql.planner.Layout$Builder.build(Layout.java:118) ~[?:?]
    at org.elasticsearch.xpack.esql.planner.AbstractPhysicalOperationProviders.groupingPhysicalOperation(AbstractPhysicalOperationProviders.java:190) ~[?:?]
@dnhatn dnhatn added v9.1.5 v8.19.5 v9.0.8 :Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged labels Sep 23, 2025
@dnhatn dnhatn requested a review from bpintea September 23, 2025 05:39
@dnhatn dnhatn marked this pull request as ready for review September 23, 2025 05:39
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Sep 23, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Copy link
Contributor

@bpintea bpintea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find, thanks Nhat.

@dnhatn dnhatn added the >bug label Sep 23, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @dnhatn, I've created a changelog YAML for you.

@dnhatn
Copy link
Member Author

dnhatn commented Sep 24, 2025

Thanks @bpintea!

@dnhatn dnhatn merged commit ddcdf29 into elastic:main Sep 24, 2025
34 checks passed
@dnhatn dnhatn deleted the fix-alias-id-aggregates branch September 24, 2025 01:10
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.19 Commit could not be cherrypicked due to conflicts
9.1 Commit could not be cherrypicked due to conflicts
9.0 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 135247

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-backport Automatically create backport pull requests when merged backport pending >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.5 v9.0.8 v9.1.5 v9.2.0

3 participants