npawar commented on code in PR #9193: URL: https://github.com/apache/pinot/pull/9193#discussion_r947032176
########## pinot-plugins/pinot-stream-ingestion/pinot-kafka-2.0/src/main/java/org/apache/pinot/plugin/stream/kafka20/KafkaStreamMetadataProvider.java: ########## @@ -63,6 +66,25 @@ public StreamPartitionMsgOffset fetchStreamPartitionOffset(OffsetCriteria offset offset = _consumer.beginningOffsets(Collections.singletonList(_topicPartition), Duration.ofMillis(timeoutMillis)) .get(_topicPartition); + } else if (offsetCriteria.isPeriod()) { + OffsetAndTimestamp offsetAndTimestamp = _consumer.offsetsForTimes(Collections.singletonMap(_topicPartition, + Clock.systemUTC().millis() - TimeUtils.convertPeriodToMillis(offsetCriteria.getOffsetString()))) + .get(_topicPartition); + if (offsetAndTimestamp == null) { + offset = _consumer.endOffsets(Collections.singletonList(_topicPartition), Duration.ofMillis(timeoutMillis)) Review Comment: nit: in both cases, log a warn if offsetAndTimestamp == null? -- 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-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org