johnjcasey commented on code in PR #35758: URL: https://github.com/apache/beam/pull/35758#discussion_r2246351437
########## sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java: ########## @@ -1648,6 +1650,24 @@ private void warnAboutUnsafeConfigurations(PBegin input) { } } + private Read<K, V> deduplicateTopics(Read<K, V> kafkaRead) { + if (getTopics() != null && getTopics().size() > 0) { + List<String> topics = getTopics(); + return kafkaRead + .toBuilder() + .setTopics(topics.stream().distinct().collect(Collectors.toList())) + .build(); + } + if (getTopicPartitions() != null && getTopicPartitions().size() > 0) { + List<TopicPartition> topicPartitions = getTopicPartitions(); + return kafkaRead + .toBuilder() + .setTopicPartitions(topicPartitions.stream().distinct().collect(Collectors.toList())) + .build(); + } + return kafkaRead; + } Review Comment: Feel free to do this, its probably cleaner -- 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: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org