Skip to content

Fixes esql class cast bug in STATS at runtime level#138085

Open
ncordon wants to merge 1 commit intoelastic:mainfrom
ncordon:stats-fix-classCastException-runtime
Open

Fixes esql class cast bug in STATS at runtime level#138085
ncordon wants to merge 1 commit intoelastic:mainfrom
ncordon:stats-fix-classCastException-runtime

Conversation

@ncordon
Copy link
Contributor

@ncordon ncordon commented Nov 14, 2025

Addresses the runtime side of #133992 and #136598. Builds on top of #137511

Queries like:

from airports 
rename scalerank AS x 
stats  a = count(x), b = count(x) + count(x), c = count_distinct(x)

They should never fail at runtime even if the plan was not optimal for repeated aggregations.

Closes #138653

@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.3.0 labels Nov 14, 2025
@ncordon ncordon changed the title Fixes esql class cast bug in STATS at planning level Fixes esql class cast bug in STATS at runtime level Nov 14, 2025
@kingherc kingherc added the :Search Relevance/ES|QL Search functionality in ES|QL label Nov 17, 2025
@elasticsearchmachine elasticsearchmachine added Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch and removed needs:triage Requires assignment of a team area label labels Nov 17, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Nov 17, 2025
@alex-spies
Copy link
Contributor

Good change that's currently blocked on #138805.

There's a possible workaround but I"m not sure it's worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL :Search Relevance/ES|QL Search functionality in ES|QL Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid ESQL runtime failing when there are suboptimal plans with repeated aggregations

6 participants