stankiewicz commented on code in PR #36112:
URL: https://github.com/apache/beam/pull/36112#discussion_r2367969990
##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java:
##########
@@ -1845,18 +1846,21 @@ public PCollection<KafkaRecord<K, V>> expand(PBegin
input) {
"Offsets committed due to usage of commitOffsetsInFinalize()
and may not capture all work processed due to use of withRedistribute() with
duplicates enabled");
}
- if (kafkaRead.getRedistributeNumKeys() == 0) {
- return output.apply(
- "Insert Redistribute",
- Redistribute.<KafkaRecord<K, V>>arbitrarily()
- .withAllowDuplicates(kafkaRead.isAllowDuplicates()));
- } else {
+ if (kafkaRead.getOffsetDeduplication() != null &&
kafkaRead.getOffsetDeduplication()) {
+ // TODO: Expose Kafka read options to control byOffsetShard vs
byRecordKey.
return output.apply(
- "Insert Redistribute with Shards",
- Redistribute.<KafkaRecord<K, V>>arbitrarily()
- .withAllowDuplicates(kafkaRead.isAllowDuplicates())
- .withNumBuckets((int) kafkaRead.getRedistributeNumKeys()));
+ KafkaReadRedistribute.<K,
V>byOffsetShard(kafkaRead.getRedistributeNumKeys()));
+ }
+
+ RedistributeArbitrarily<KafkaRecord<K, V>> redistribute =
+ Redistribute.<KafkaRecord<K, V>>arbitrarily()
Review Comment:
byRecordKey based on options could replace this random redistribute.
--
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]