Skip to content

[KafkaIO] Add with_gcp_adc and num_partitions options to Kafka SchemaTransforms and YAML - #40181

Open
Abacn wants to merge 1 commit into
apache:masterfrom
Abacn:kafka-gmk-eou
Open

Abacn wants to merge 1 commit into
apache:masterfrom
Abacn:kafka-gmk-eou

Conversation

@Abacn

@Abacn Abacn commented Sep 18, 2026

Copy link
Copy Markdown
Contributor
  • Expose with_gcp_adc (withGcpAdc) in KafkaIO read/write SchemaTransform, Python xlang IO and YAML. This option is already present in Java KafkaIO but not exposed to xlang. It make Python and YAML user easier to use Google managed Kafka (GMK).

  • Add num_partitions in KafkaIO read SchemaTransform, Python xlang IO and YAML. This avoids the need to Kafka instance connection at pipeline submission time for Dataflow runner v1 (Streaming runner) if using SchemaTransform

Please add a meaningful description for your change here


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

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.

…hemaTransforms and Beam YAML

- Expose `with_gcp_adc` (`withGcpAdc`) in KafkaIO read/write SchemaTransform, Python xlang IO and YAML

- Add `num_partitions` in KafkaIO read SchemaTransform, Python xlang IO and YAML. This avoids the need to Kafka instance connection at pipeline submission time for Dataflow runner v1 (Streaming runner) if using SchemaTransform
@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @jrmccluskey for label python.
R: @chamikaramj for label java.
R: @sjvanrossum for label kafka.
R: @derrickaw for label yaml.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

public abstract Boolean getRedistributeByRecordKey();

@SchemaFieldDescription(
"Whether to use Google Cloud Platform Application Default Credentials (ADC) for"

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.

Nit: Google auth library docs typically use the name "Application Default Credentials" or in rare cases "Google Application Default Credentials" since the provider can be used for Google APIs in general.

+ " construction time.")
@SchemaFieldNumber("18")
@Nullable
public abstract Integer getNumPartitions();

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.

In most cases the partition set for a topic will match the range of integers from 0 to N, but users may arbitrarily retire individual partitions.
Examples:

  • Create a partition per entity with a non-sequential integer id (e.g., a partition per player in a game).
  • Retire a partition after the last usable offset is used to produce a record.

Replacing the number of partitions property with a topic partition list property would spare adding it later with more boilerplate to validate the different combinations of configuration properties.

+ " authenticating with a Google Managed Kafka cluster.")
@SchemaFieldNumber("17")
@Nullable
public abstract Boolean getWithGcpAdc();

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.

Nit: This doesn't match the name used to configure the transform. Application default credentials is annoyingly long to spell so I'm not opposed to ADC, but I'd consider keeping it the same for consistency and clarity to users who might be unfamiliar with the acronym.

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