Repository navigation
docs(dataframe): add dataframe aggregation example (#26597) - #26600
Conversation
| //! - `all` — run all examples included in this module | ||
| //! | ||
| //! - `aggregate` | ||
| //! (file: aggregate.rs, desc: Global and grouped aggregation with select and `aggregate`) |
There was a problem hiding this comment.
Should be `select` I think
There was a problem hiding this comment.
I named it aggregate because the examples focus on aggregation, but I see your point that select better highlights the new API. I'll consider how to make the distinction between the two approaches clearer.
There was a problem hiding this comment.
Sorry, my comment wasn't clear. I only meant that "select" in the description should be in backticks to match "aggregate"; I wasn't suggesting a rename. I think "aggregate" is the better name
The aggregate_in_select row was edited by hand. Its link text still said dataframe/aggregate.rs, and the table padding still fit the old, longer description, so check_examples_docs.sh reported the README as out of date. Running check_examples_docs.sh --write fixes both.
The example covers grouped aggregation with `aggregate` as well as aggregate functions in `select`, so `aggregate` names all of it. The name also matches issue apache#26597. The description goes back to "Global and grouped aggregation with `select` and `aggregate`", now with backticks on `select`, and the README row is regenerated to match.
The "One step" comment put backticks on "accepts" instead of on the method name `select`. The Aggregate match arm now uses the same block form with a trailing semicolon as the other arms.
|
@cj-zhukov I took the liberty of pushing a few minor fixes to your branch, to save the back-and-forth. Thanks for your work on this! |
|
@neilconway Thanks a lot for your review and guidance throughout this PR! I really appreciate your time and help. |
Which issue does this PR close?
Rationale for this change
datafusion-exampleshas no example about aggregation with theDataFrameAPI.aggregate(vec![], ...)only appears inside other examples (subqueries, UDAFs), and nothing shows the select form added in #25482. Users have no place to see when select is enough and when they still need aggregate.What changes are included in this PR?
datafusion-examples/examples/dataframe/aggregate.rs, run withcargo run --example dataframe -- aggregatedataframe/main.rs: new aggregate subcommand.datafusion-examples/README.md: generated row for the new example.No library code is changed
What is the testing strategy for this PR?
cargo run --example dataframe -- aggregateandcargo run --example dataframe -- allrun without errors../ci/scripts/check_examples_docs.shpasses (README matches the generator).Are there any user-facing changes?
No. Examples and README only.