Skip to content

Added aggregate KDocs#1792

Merged
AndreiKingsley merged 8 commits intomasterfrom
groupby_aggregation_kdoc
Apr 14, 2026
Merged

Added aggregate KDocs#1792
AndreiKingsley merged 8 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?

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 think AI has reordered the suggestions because you used it so much XD

This is mine:
image

*
* * [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

@AndreiKingsley AndreiKingsley force-pushed the groupby_aggregation_kdoc branch from 59b6bcf to 1667cac Compare April 14, 2026 15:27
@AndreiKingsley AndreiKingsley merged commit 438831e into master Apr 14, 2026
4 of 5 checks passed
@AndreiKingsley AndreiKingsley deleted the groupby_aggregation_kdoc branch April 14, 2026 21:57
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