johnjcasey commented on code in PR #34258:
URL: https://github.com/apache/beam/pull/34258#discussion_r1999333692
##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaUnboundedSource.java:
##########
@@ -100,8 +102,31 @@ public List<KafkaUnboundedSource<K, V>> split(int
desiredNumSplits, PipelineOpti
}
}
} else {
- for (TopicPartition p : partitions) {
- Lineage.getSources().add("kafka", ImmutableList.of(bootStrapServers,
p.topic()));
+ try (Consumer<?, ?> consumer =
spec.getConsumerFactoryFn().apply(spec.getConsumerConfig())) {
+ Map<String, List<Integer>> topicsAndPartitions = new HashMap<>();
+ try {
+ for (TopicPartition p : partitions) {
+ if (!topicsAndPartitions.containsKey(p.topic())) {
+ List<Integer> partitionsList = new ArrayList<>();
+ List<PartitionInfo> partitionInfoList =
consumer.partitionsFor(p.topic());
+ for (PartitionInfo info : partitionInfoList) {
+ partitionsList.add(info.partition());
+ }
+ topicsAndPartitions.put(p.topic(), partitionsList);
+ }
+ checkState(
+ topicsAndPartitions.containsKey(p.topic())
+ &&
topicsAndPartitions.get(p.topic()).contains(p.partition()),
+ "Partition "
Review Comment:
Can you fix the formatting on this?
##########
sdks/java/io/kafka/src/test/java/org/apache/beam/sdk/io/kafka/KafkaIOIT.java:
##########
@@ -211,6 +216,30 @@ public static void afterClass() {
}
}
+ @Test
Review Comment:
Can you add more similar tests for the sdf pipeline?
--
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]