Skip to content

Added aggregate KDocs#1792

Open
AndreiKingsley wants to merge 6 commits intomasterfrom
groupby_aggregation_kdoc
Open

Added aggregate KDocs#1792
AndreiKingsley wants to merge 6 commits intomasterfrom
groupby_aggregation_kdoc

Conversation

@AndreiKingsley
Copy link
Copy Markdown
Collaborator

@AndreiKingsley AndreiKingsley commented Apr 8, 2026

Helps #1528.
Adds aggregate methods KDocs

@AndreiKingsley AndreiKingsley changed the title Groupby aggregation kdoc Added aggregate KDocs Apr 8, 2026
@AndreiKingsley AndreiKingsley marked this pull request as ready for review April 8, 2026 14:28
@AndreiKingsley AndreiKingsley changed the title Added aggregate KDocs Added aggregate KDocs Apr 8, 2026
@AndreiKingsley AndreiKingsley force-pushed the groupby_aggregation_kdoc branch from 40af1e2 to 1aad806 Compare April 8, 2026 20:01
internal typealias AggregateDslColumnKindSnippet = Nothing

@ExcludeFromSources
internal typealias AGGREGATE_DSL_TYPE = Nothing
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are arguments? I usually put them inside a documentation interface, so they are scoped and don't pollute the global namespace

* A specialized [ColumnsSelectionDsl] that allows to aggregate
* [DataFrame] or `DataFrame`-like structures ([GroupBy], [Pivot] or [PivotGroupBy]).
*
* {@include [AggregateDslDocsSnippet]}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unneccesary braces

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the very first autocomplete suggestion:
image
I just accept it. Could you possibly fix it?

*
* * [count][DataFrame.count] — calculate the number of rows
* (optionally counting only rows that satisfy the given predicate);
* * [max][DataFrame.max] / [maxOf][DataFrame.maxOf] / [maxFor][DataFrame.maxFor] —
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the -By functions? like maxBy. Should they be mentioned here as well or not?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm those are reducing methods;
but yeah, reducing is a special case of aggregation so why not.

* {@include [AggregateDslDocsSnippet]}
* {@set [AGGREGATE_DSL_TYPE] [AggregateDsl]}
* {@set [AGGREGATE_DSL_RECEIVER] [DataFrame], [GroupBy], [Pivot] or [PivotGroupBy]}
* {@set [AGGREGATE_DSL_APPLY] The given [expression][body] is applied to each group independently.}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[body] points at nothing

/**
* A specialized [ColumnsSelectionDsl] that allows to aggregate
* [DataFrame] or `DataFrame`-like structures ([GroupBy], [Pivot] or [PivotGroupBy]).
*
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing a example here maybe... or is that better done in the specific functions? it's not obvious how to define .aggregate { sum { col } default 0 into "col" }

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I forgot about it actually! Examples are supposed to be in different .aggregate {}-s kdocs!

* {@include [AggregateDslDocsSnippet]}
* {@set [AGGREGATE_DSL_TYPE] [AggregateGroupedDsl]}
* {@set [AGGREGATE_DSL_RECEIVER] [GroupBy]}
* {@set [AGGREGATE_DSL_APPLY] The given [expression][body] is applied to each group independently.}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

body again points at nothing, making it expand incorrectly when included in AggregateGroupedDsl

* Returns a new [DataRow] with the original [pivot] keys as top-level columns on top level
* and the correspndonding aggregated values in new nested columns.
*
* {@include [AggregateDslDocsSnippet]}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

braces not needed for include, but they are needed for the set's, because there's more text below

/**
* Converts this [GroupBy] into a [DataFrame].
*
* Do the same as [GroupBy.toDataFrame].
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*Does

}

/**
* {@include [PivotGroupByDocs.CommonDescription]}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary braces

* Check out [`PivotGroupBy` Grammar][PivotGroupByDocs.Grammar] for more information.
*
* For more information: {@include [DocumentationUrls.Pivot]}
*
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm yeah, I still miss an example or two, how the aggregate DSL looks in practice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants