Skip to content

Optimize group by for single partition topics #836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ovv
Copy link
Contributor

@ovv ovv commented Apr 14, 2025

Group by operations on topics with a single partition are now optimized to avoid creating a repartition topic. Instead, the messages are directly transformed to use the new key, as all messages go to the same partition.

@ovv ovv changed the title Optimize groupb y for single partition topics Optimize group by for single partition topics Apr 15, 2025
@ovv ovv force-pushed the quent/single-partition-groupby branch from 85cf8af to 87f2af7 Compare April 15, 2025 12:46
Group by operations on topics with a single partition are now optimized to avoid
creating a repartition topic. Instead, the messages are directly transformed to
use the new key, as all messages go to the same partition.
@ovv ovv force-pushed the quent/single-partition-groupby branch from 87f2af7 to 5999c3a Compare April 15, 2025 12:53
@ovv ovv marked this pull request as ready for review April 16, 2025 11:58
Comment on lines +633 to +638
groupby_sdf = self.__dataframe_clone__(
stream=stream, stream_id=f"{self.stream_id}--groupby--{operation}"
)
self._registry.register_groupby(
source_sdf=self, new_sdf=groupby_sdf, register_new_root=False
)
Copy link
Collaborator

@daniil-quix daniil-quix Apr 30, 2025

Choose a reason for hiding this comment

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

I'm not sure we even need .register_groupby() here since the operation doesn't create a new topic.
We can treat it as a stateless operation, and keep the same stream_id too.

Copy link
Collaborator

@daniil-quix daniil-quix left a comment

Choose a reason for hiding this comment

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

See the comments

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