cj-zhukov opened a new issue, #26597:
URL: https://github.com/apache/datafusion/issues/26597
### Is your feature request related to a problem or challenge?
Follow-up to #25482 (closes #17874), which allowed aggregate functions in
`DataFrame::select`. That PR added tests but no examples, and the examples were
left for a follow-up.
Right now `datafusion-examples` has no example about aggregation with the
DataFrame API. `aggregate(vec![], ...)` only shows up inside other examples
(subqueries, UDAFs), and nothing shows the new select form. A user reading the
examples will not find out that `select(vec![count(col("a")), sum(col("b"))])`
works, or when they still need aggregate.
### Describe the solution you'd like
Add a new aggregate example to the `dataframe` group in
`datafusion-examples` (`cargo run --example dataframe -- aggregate`) that
shows, side by side:
- global aggregation with `aggregate(vec![], aggs)` and with `select(aggs)`
— same result
expressions on top of aggregates (for example max(speed) - min(speed)) the
old way (aggregate then select with aliases) and the new way (one select)
- grouped aggregation, which still uses `aggregate(group_by, aggs)`, and a
note that select does not infer a GROUP BY
- the difference between an aggregate in select (one row) and a window
function in select (one row per input row)
Plus generated row in the examples `README`.
### Describe alternatives you've considered
Adding the examples to `dataframe/dataframe.rs`. That file is already long
and covers reading/writing data, so a separate example is easier to find.
### Additional context
#25482 — the PR that added aggregate support to select
#21021 — the first attempt, which included a version of these examples
### Willingness to contribute
I plan to contribute to this feature independently
--
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]