Skip to content

Update GroupBy doc: use idiomatic groupBy key function#2795

Merged
He-Pin merged 1 commit intoapache:mainfrom
He-Pin:port-groupby-doc-update
Mar 28, 2026
Merged

Update GroupBy doc: use idiomatic groupBy key function#2795
He-Pin merged 1 commit intoapache:mainfrom
He-Pin:port-groupby-doc-update

Conversation

@He-Pin
Copy link
Copy Markdown
Member

@He-Pin He-Pin commented Mar 28, 2026

Motivation

The GroupBy documentation example used a hardcoded number of substreams instead of demonstrating the idiomatic key-based grouping pattern.

Modification

Updated the GroupBy documentation to use a proper key function that groups elements by their inherent property, making the example more realistic and educational.

Result

Documentation now shows the recommended way to use GroupBy with a meaningful key function.

References

Change groupBy key from '_ % 2 == 0' (Boolean) to '_ % 2' (Int) for a
more idiomatic example. Add note about non-deterministic mergeSubstreams
output ordering.

Upstream: akka/akka-core@1ed6dc09fd
Cherry-picked from akka/akka-core v2.8.0, which is now Apache licensed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@He-Pin He-Pin marked this pull request as ready for review March 28, 2026 06:56
@He-Pin He-Pin added this to the 2.0.0-M2 milestone Mar 28, 2026
@He-Pin He-Pin requested review from Philippus and pjfanning March 28, 2026 07:47
Copy link
Copy Markdown
Member

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Copy Markdown
Member

@Philippus Philippus left a comment

Choose a reason for hiding this comment

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

Can we also change the corresponding Java example? That would make comparing code examples less confusing.

@He-Pin
Copy link
Copy Markdown
Member Author

He-Pin commented Mar 28, 2026

@Philippus, please unlock this. You can submit a pr to follow up, my local agents are in another loop

@He-Pin He-Pin requested a review from Philippus March 28, 2026 08:59
@He-Pin
Copy link
Copy Markdown
Member Author

He-Pin commented Mar 28, 2026

@Philippus, because my local harness is current in another loop, and each loop costs some money:)

@He-Pin He-Pin merged commit a5fbcfb into apache:main Mar 28, 2026
9 checks passed
@He-Pin He-Pin deleted the port-groupby-doc-update branch March 28, 2026 09:05
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.

3 participants