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

[BUG] Count() cannot be the last aggregator in Stats command #811

Open
LantaoJin opened this issue Oct 25, 2024 · 0 comments · May be fixed by #814
Open

[BUG] Count() cannot be the last aggregator in Stats command #811

LantaoJin opened this issue Oct 25, 2024 · 0 comments · May be fixed by #814
Labels
bug Something isn't working

Comments

@LantaoJin
Copy link
Member

What is the bug?

source = $testTable | eval a = 1 | stats sum(a) as sum, avg(a) as avg, count() as cnt by country

Throws

[NESTED_AGGREGATE_FUNCTION] It is not allowed to use an aggregate function in the argument of another aggregate function. Please use the inner aggregate function in a sub-query.;
Project [sum#31L, cnt#33L, country#34]
+- Aggregate [country#38], [sum(a#30) AS sum#31L, count(avg(a#30)) AS cnt#33L, country#38 AS country#34]
+- Project [name#35, age#36, state#37, country#38, year#39, month#40, 1 AS a#30]
+- SubqueryAlias spark_catalog.default.flint_ppl_test
+- Relation spark_catalog.default.flint_ppl_test[name#35,age#36,state#37,country#38,year#39,month#40] csv

But

source = $testTable | eval a = 1 | stats count() as cnt, sum(a) as sum, avg(a) as avg by country

works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant