Skip to content

Add schema provider support for Kafka redistribute options - #36332

Merged
chamikaramj merged 10 commits into
apache:masterfrom
tomstepp:kafka-key2
Oct 5, 2025
Merged

Add schema provider support for Kafka redistribute options#36332
chamikaramj merged 10 commits into
apache:masterfrom
tomstepp:kafka-key2

Conversation

@tomstepp

Copy link
Copy Markdown
Contributor

Add schema provider support for Kafka redistribute options


GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@tomstepp

Copy link
Copy Markdown
Contributor Author

R: @chamikaramj

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @tomstepp, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Apache Beam KafkaIO connector by introducing a new capability to redistribute Kafka records based on their record keys. Previously, redistribution was primarily based on offsets. This change provides users with more flexibility and control over how data is distributed within their Beam pipelines, especially when offset deduplication is active. The new functionality is implemented via a dedicated KafkaReadRedistribute transform and is fully integrated with the KafkaIO schema provider, allowing for declarative configuration of redistribution strategies.

Highlights

  • New Redistribution Option for KafkaIO: Introduced withRedistributeByRecordKey in KafkaIO.Read to allow redistribution of Kafka records based on their record keys, providing more granular control over data distribution.
  • Dedicated Redistribution Transform: Added a new KafkaReadRedistribute PTransform that encapsulates the logic for sharding Kafka records either by their offset hash or by their record key hash.
  • Schema Provider Integration: Extended KafkaReadSchemaTransformConfiguration and KafkaIOTranslation to support the new redistribution options, enabling external configuration of these features.
  • Enhanced Test Coverage: New unit tests were added for the KafkaReadRedistribute transform, and existing KafkaIO tests were updated to cover the new redistributeByRecordKey functionality.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@tomstepp

Copy link
Copy Markdown
Contributor Author

@chamikaramj any idea what I'm missing for managed transforms?
image

@github-actions

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@tomstepp

Copy link
Copy Markdown
Contributor Author

@chamikaramj any idea what I'm missing for managed transforms?

Just to close the loop on this, it turned out that this was just an issue with local caching. Clearing caches and running worked.

@tomstepp

tomstepp commented Oct 1, 2025

Copy link
Copy Markdown
Contributor Author

FYI @chamikaramj this PR is ready for review, thanks!

@chamikaramj

Copy link
Copy Markdown
Contributor

Thanks. LGTM.

@chamikaramj
chamikaramj merged commit 6043660 into apache:master Oct 5, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants