bersprockets commented on PR #47876:
URL: https://github.com/apache/spark/pull/47876#issuecomment-2311315332
Note this does result in a slight (but AFAIK harmless) oddity in the plan
when the grouping expressions are included in the select statement, e.g.:
```
create or replace temp view v1(a, b, c) as values
(1, 1.001d, 2), (2, 3.001d, 4), (2, 3.001, 4);
cache table v1;
select
a,
gb,
round(sum(b), 6) as sum1,
count(distinct a) as count1,
count(distinct c) as count2
from (
select 6 as gb, *
from v1
)
group by a, gb;
```
The aggregate operator will look like this:
```
Aggregate [a#257, 6#294], [a#257, 6 AS gb#244,
round(first(sum(__auto_generated_subquery_name.b)#298, true) FILTER (WHERE
(gid#293 = 0)), 6) AS sum1#245, count(__auto_generated_subquery_name.a#295)
FILTER (WHERE (gid#293 = 1)) AS count1#246L,
count(__auto_generated_subquery_name.c#296) FILTER (WHERE (gid#293 = 2)) AS
count2#247L]
```
In the list of grouping expressions, `gb` will show up as the attribute
`6#294` (taken from the `Expand` operator's output), but `gb` will show up in
the aggregate expressions as `6 AS gb#244`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]