HeartSaVioR commented on pull request #25911:
URL: https://github.com/apache/spark/pull/25911#issuecomment-836089685


   I see actual customer's demand on this; "a" topic has 100+ partitions and 
it's weird to let them craft json which contains 100+ partitions for the same 
timestamp.
   
   Flink already does the thing; Flink uses global value across partitions for 
earliest/latest/timestamp, while it allows to set exact offset per partition.
   
   
https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/connectors/datastream/kafka/#kafka-consumers-start-position-configuration
   
   ```
   final StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
   
   FlinkKafkaConsumer<String> myConsumer = new FlinkKafkaConsumer<>(...);
   myConsumer.setStartFromEarliest();     // start from the earliest record 
possible
   myConsumer.setStartFromLatest();       // start from the latest record
   myConsumer.setStartFromTimestamp(...); // start from specified epoch 
timestamp (milliseconds)
   myConsumer.setStartFromGroupOffsets(); // the default behaviour
   ```
   
   ```
   Map<KafkaTopicPartition, Long> specificStartOffsets = new HashMap<>();
   specificStartOffsets.put(new KafkaTopicPartition("myTopic", 0), 23L);
   specificStartOffsets.put(new KafkaTopicPartition("myTopic", 1), 31L);
   specificStartOffsets.put(new KafkaTopicPartition("myTopic", 2), 43L);
   
   myConsumer.setStartFromSpecificOffsets(specificStartOffsets);
   ```
   
   Given this PR is stale, I'll rebase this with master and raise the PR again.


-- 
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to