xiangfu0 commented on code in PR #16724:
URL: https://github.com/apache/pinot/pull/16724#discussion_r2365725097
##########
pinot-plugins/pinot-stream-ingestion/pinot-kafka-2.0/src/main/java/org/apache/pinot/plugin/stream/kafka20/KafkaStreamMetadataProvider.java:
##########
@@ -193,6 +194,38 @@ public StreamPartitionMsgOffset getOffsetAtTimestamp(int
partitionId, long times
Duration.ofMillis(timeoutMillis)).get(_topicPartition).offset());
}
+ @Override
+ public Map<String, StreamPartitionMsgOffset> getStreamStartOffsets() {
+ List<PartitionInfo> partitionInfos = _consumer.partitionsFor(_topic);
+ Map<TopicPartition, Long> startOffsets = _consumer.beginningOffsets(
+ partitionInfos.stream()
+ .filter(info -> info != null)
+ .map(info -> new TopicPartition(_topic, info.partition()))
+ .collect(Collectors.toList()));
+ return startOffsets.entrySet().stream().collect(
+ Collectors.toMap(
+ entry -> String.valueOf(entry.getKey().partition()),
+ entry -> new LongMsgOffset(entry.getValue()),
+ (existingValue, newValue) -> newValue
+ ));
+ }
+
+ @Override
+ public Map<String, StreamPartitionMsgOffset> getStreamEndOffsets() {
+ List<PartitionInfo> partitionInfos = _consumer.partitionsFor(_topic);
+ Map<TopicPartition, Long> startOffsets = _consumer.endOffsets(
Review Comment:
endOffsets
##########
pinot-plugins/pinot-stream-ingestion/pinot-kafka-3.0/src/main/java/org/apache/pinot/plugin/stream/kafka30/KafkaStreamMetadataProvider.java:
##########
@@ -206,6 +207,38 @@ public StreamPartitionMsgOffset getOffsetAtTimestamp(int
partitionId, long times
Duration.ofMillis(timeoutMillis)).get(_topicPartition).offset());
}
+ @Override
+ public Map<String, StreamPartitionMsgOffset> getStreamStartOffsets() {
+ List<PartitionInfo> partitionInfos = _consumer.partitionsFor(_topic);
+ Map<TopicPartition, Long> startOffsets = _consumer.beginningOffsets(
+ partitionInfos.stream()
+ .filter(info -> info != null)
+ .map(info -> new TopicPartition(_topic, info.partition()))
+ .collect(Collectors.toList()));
+ return startOffsets.entrySet().stream().collect(
+ Collectors.toMap(
+ entry -> String.valueOf(entry.getKey().partition()),
+ entry -> new LongMsgOffset(entry.getValue()),
+ (existingValue, newValue) -> newValue
+ ));
+ }
+
+ @Override
+ public Map<String, StreamPartitionMsgOffset> getStreamEndOffsets() {
+ List<PartitionInfo> partitionInfos = _consumer.partitionsFor(_topic);
+ Map<TopicPartition, Long> startOffsets = _consumer.endOffsets(
Review Comment:
endOffsets
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]