damnMeddlingKid opened a new issue, #30469:
URL: https://github.com/apache/beam/issues/30469

   ### What happened?
   
   ## Issue
   
   When running a pipeline with KafkaIO and withDynamicReads enabled I get the 
following error in Dataflow on Runner V2
   
   ```
   Exception in thread "main" java.lang.IllegalStateException: 
   The current runner does not support SDF-based Kafka read properly and the 
replacement runner lacks the support for the following properties: 
[DYNAMIC_READ, WATCH_TOPIC_PARTITION_DURATION]. 
   For example if you are using Dataflow then consider using Dataflow Runner 
v2.; see consecutive INFO logs for details.
   ```
   
   This is despite setting the `use_runner_v2` and `beam_fn_api` experiment 
flags.
   
   Steps to reproduce:
   
   1) Create a pipeline with KafkaIO and dynamic reads, heres my configuration
   
   ```
       KafkaIO
         .read[Array[Byte], Array[Byte]]
         .withBootstrapServers(kafkaBootstrapServers)
         .withDynamicRead(Duration.standardMinutes(15))
         .withTopics(kafkaTopics.asJava)
         .withReadCommitted()
         .withConsumerConfigUpdates(kafkaConsumerProperties.toMap[String, 
AnyRef].asJava)
         .commitOffsetsInFinalize
         .withKeyDeserializer(classOf[ByteArrayDeserializer])
         .withValueDeserializer(classOf[ByteArrayDeserializer])
   ```
   
   2) Enable experiment flags for runner v2 and beam function api: 
`use_runner_v2`, `beam_fn_api`
   
   3) Run the pipeline in Dataflow
   
   ## Investigation
   
   I believe this error is happening because beam always [replaces V1 
transforms](https://github.com/apache/beam/blob/935ca9c58d61e5d070056d36c21c6b6c03a97908/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java#L1227C1-L1229C35)
 and the transform replacement for V1 is a non-SDF based reader that doesn't 
support dynamic reads.
   
   so when the replacement is attempted [Beam correctly 
validates](https://github.com/apache/beam/blob/master/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java#L1539-L1543)
 that the replacement is not compatible with Dynamic Reads and throws a 
compatibility exception.
   
   I would like to propose that we only make this replacement for runner v1 
like so https://github.com/damnMeddlingKid/beam/pull/1/files
   
   ```
           if (!hasExperiment(options, "use_runner_v2")) {
             overridesBuilder.add(KafkaIO.Read.KAFKA_READ_OVERRIDE);
           }
   ```
   
   
   
   
   
   
   
   
   
   
   
   ### Issue Priority
   
   Priority: 3 (minor)
   
   ### Issue Components
   
   - [ ] Component: Python SDK
   - [X] Component: Java SDK
   - [ ] Component: Go SDK
   - [ ] Component: Typescript SDK
   - [ ] Component: IO connector
   - [ ] Component: Beam YAML
   - [ ] Component: Beam examples
   - [ ] Component: Beam playground
   - [ ] Component: Beam katas
   - [ ] Component: Website
   - [ ] Component: Spark Runner
   - [ ] Component: Flink Runner
   - [ ] Component: Samza Runner
   - [ ] Component: Twister2 Runner
   - [ ] Component: Hazelcast Jet Runner
   - [X] Component: Google Cloud Dataflow Runner


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to