You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/10/26 10:02:46 UTC

[GitHub] [incubator-seatunnel] Hisoka-X commented on a diff in pull request #3157: [Improve][Connector-V2-kafka] Support setting read starting offset or time at startup config

Hisoka-X commented on code in PR #3157:
URL: https://github.com/apache/incubator-seatunnel/pull/3157#discussion_r1005471664


##########
seatunnel-connectors-v2/connector-kafka/src/main/java/org/apache/seatunnel/connectors/seatunnel/kafka/source/KafkaSourceSplitEnumerator.java:
##########
@@ -91,20 +122,20 @@ public void close() throws IOException {
     @Override
     public void addSplitsBack(List<KafkaSourceSplit> splits, int subtaskId) {
         if (!splits.isEmpty()) {
-            pendingSplit.addAll(convertToNextSplit(splits));
+            pendingSplit.putAll(convertToNextSplit(splits));
             assignSplit();
         }
     }
 
-    private Collection<? extends KafkaSourceSplit> convertToNextSplit(List<KafkaSourceSplit> splits) {
+    private Map<TopicPartition, ? extends KafkaSourceSplit> convertToNextSplit(List<KafkaSourceSplit> splits) {
         try {
-            Map<TopicPartition, ListOffsetsResult.ListOffsetsResultInfo> listOffsets =
-                getKafkaPartitionLatestOffset(splits.stream().map(KafkaSourceSplit::getTopicPartition).collect(Collectors.toList()));
+            Map<TopicPartition, Long> listOffsets =
+                listOffsets(splits.stream().map(KafkaSourceSplit::getTopicPartition).collect(Collectors.toList()), OffsetSpec.earliest());

Review Comment:
   Why use `OffsetSpec.earliest()` not latest?



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org