Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES|QL INLINESTATS after STATS optimized incorrectly #124654

Open
jan-elastic opened this issue Mar 12, 2025 · 3 comments
Open

ES|QL INLINESTATS after STATS optimized incorrectly #124654

jan-elastic opened this issue Mar 12, 2025 · 3 comments
Labels
:Analytics/ES|QL AKA ESQL >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)

Comments

@jan-elastic
Copy link
Contributor

Elasticsearch Version

main

Installed Plugins

No response

Java Version

n/a

OS Version

n/a

Problem Description

FROM kibana_sample_data_ecommerce 
  | STATS price = SUM(taxful_total_price) BY day = BUCKET(order_date,1 DAY)
  | INLINESTATS days = TOP(day, 10, "ASC")

results in

[esql] > Unexpected error from Elasticsearch: illegal_state_exception - Found 1 problem
line 3:5: Plan [ProjectExec[[price{r}#1229, day{r}#1226, days{r}#1233]]] optimized incorrectly due to missing references [price{r}#1229]

I expected output like

 day  | price  | days
------+--------+-------------------
 day1 | price1 | [day1, day2, ...]
 day2 | price2 | [day1, day2, ...]
 ...  | ...    | ...

Steps to Reproduce

see above

Logs (if relevant)

No response

@jan-elastic jan-elastic added >bug needs:triage Requires assignment of a team area label :Analytics/ES|QL AKA ESQL labels Mar 12, 2025
@elasticsearchmachine elasticsearchmachine added Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) and removed needs:triage Requires assignment of a team area label labels Mar 12, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@alex-spies
Copy link
Contributor

alex-spies commented Mar 12, 2025

I think this should be solved by #124335, except for CATEGORIZE most likely.

@alex-spies
Copy link
Contributor

I was wrong, this still fails even with the code from the PR :)

Thanks for raising this @jan-elastic !

@alex-spies alex-spies changed the title ES|QL INLINESTATS optimized incorrectly ES|QL INLINESTATS after STATS optimized incorrectly Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo)
Projects
None yet
Development

No branches or pull requests

3 participants