[KafkaIO] Remove beam_fn_api requirement for dynamic reads - #39735
Conversation
|
Assigning reviewers: R: @kennknowles for label java. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
|
I think this is fine - but is there some nuance where it simply won't work? (the runner should really reject it, not the transform itself, but I know that KafkaIO does a bunch of logic around various flags and whatnot) Is there a postsubmit with trigger file we should add here? |
Agree, it's no longer needed. AI investigation (checked manually): This check is outdated, inaccurate, and should be removed or updated.
static boolean useUnifiedWorker(DataflowPipelineOptions options) {
return hasExperiment(options, "beam_fn_api")
|| hasExperiment(options, "use_runner_v2")
|| hasExperiment(options, "use_unified_worker")
|| hasExperiment(options, "use_portable_job_submission")
|| hasExperiment(options, "enable_portable_runner");
}If a user launches a Dataflow pipeline with --experiments=use_runner_v2 (the standard and recommended flag for Runner v2) without also explicitly passing --experiments=beam_fn_api, the check in KafkaIO.java:L1663-1666 will throw an error: even though the job is running on Runner v2.
Hardcoding a runner-specific experiment string inside KafkaIO.expand() breaks runner-agnostic SDK architecture. If a runner check is desired for Dataflow specifically, it should either rely on DataflowRunner.useUnifiedWorker(options) or let the runner transform override handle capability validation. |
Fixes #29998.
KafkaIO dynamic reads currently fail during pipeline expansion unless the obsolete
beam_fn_apiexperiment is enabled.This change removes that expansion-time requirement. Dynamic reads remain SDF-only through the existing
KafkaIOReadImplementationCompatibilityselection, so runner fallback and compatibility behavior are unchanged.The regression test verifies that:
beam_fn_apiThe change also updates the 2.77.0 release notes.
Testing
./gradlew :sdks:java:io:kafka:test :sdks:java:io:kafka:kafkaVersion392Test :sdks:java:io:kafka:spotlessCheck --no-daemon./gradlew :sdks:java:io:kafka:test --tests org.apache.beam.sdk.io.kafka.KafkaIOReadImplementationCompatibilityTest.testDynamicReadUsesSdfWithoutBeamFnApiExperiment :sdks:java:io:kafka:check --no-build-cache --rerun-tasks --no-daemonThe full KafkaIO check includes Checkstyle, SpotBugs, Javadocs, dependency analysis, formatting, and unit tests.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
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, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.