Skip to content

[data] Add TopK aggregator - #59556

Closed
cem-anyscale wants to merge 4 commits into
masterfrom
cem/topk_v2
Closed

cem-anyscale wants to merge 4 commits into
masterfrom
cem/topk_v2

Conversation

@cem-anyscale

Copy link
Copy Markdown
Contributor

Description

Add TopKUnique aggregator that computes most frequent k values

* Add TopKUnique aggregator that computes most frequent k values

Signed-off-by: cem <[email protected]>
@cem-anyscale
cem-anyscale requested a review from a team as a code owner December 18, 2025 18:50

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new TopKUnique aggregator, which is a valuable addition for computing the most frequent unique values in a column. The implementation correctly builds upon the existing ValueCounter and utilizes heapq.nlargest for efficient top-k computation. The accompanying tests are thorough, covering basic functionality, global frequency aggregation across blocks, and various edge cases. I have a couple of suggestions for a minor code cleanup to improve readability and a recommendation to enhance test robustness by adding a case for frequency ties.

Comment thread python/ray/data/aggregate.py Resolved
@richardliaw

Copy link
Copy Markdown
Contributor

Why is it called TopKUnique and not just TopK?

@cem-anyscale

Copy link
Copy Markdown
Contributor Author

Why is it called TopKUnique and not just TopK?

Yeah TopK would be better; will rename.

@ray-gardener ray-gardener Bot added the data Ray Data-related issues label Dec 18, 2025
@richardliaw richardliaw changed the title [data] Add TopKUnique aggregator [data] Add TopK aggregator Dec 18, 2025
Comment thread python/ray/data/aggregate.py Resolved
* rename aggregator name
* rename default alias name

Signed-off-by: cem <[email protected]>
Signed-off-by: cem <[email protected]>
@cem-anyscale cem-anyscale added the go add ONLY when ready to merge, run all tests label Dec 18, 2025
Signed-off-by: cem <[email protected]>
@github-actions

github-actions Bot commented Jan 2, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Jan 2, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no more activity in the 14 days
since being marked stale.

Please feel free to reopen or open a new pull request if you'd still like this to be addressed.

Again, you can always ask for help on our discussion forum or Ray's public slack channel.

Thanks again for your contribution!

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

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests stale The issue is stale. It will be closed within 7 days unless there are further conversation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants