HeartSaVioR commented on a change in pull request #23747: [SPARK-26848][SQL] 
Introduce new option to Kafka source: offset by timestamp (starting/ending)
URL: https://github.com/apache/spark/pull/23747#discussion_r266187918
 
 

 ##########
 File path: docs/structured-streaming-kafka-integration.md
 ##########
 @@ -310,6 +310,26 @@ The following configurations are optional:
 
 <table class="table">
 <tr><th>Option</th><th>value</th><th>default</th><th>query 
type</th><th>meaning</th></tr>
+<tr>
+  <td>startingOffsetsByTimestamp</td>
+  <td>json string
+  """ {"topicA":1000,"topicB":2000} """
+  </td>
+  <td>none (the value of `startingOffsets` will apply)</td>
+  <td>streaming and batch</td>
+  <td>The start point of timestamp when a query is started, a json string 
specifying a starting timestamp for
+  each topic. The returned offset for each partition is the earliest offset 
whose timestamp is greater than or
+  equal to the given timestamp in the corresponding partition. If the matched 
offset doesn't exist,
+  the offset will be set to latest.<p/>
+  <p/>
+  This option leverages `KafkaConsumer.offsetForTimes`: please refer 
https://kafka.apache.org/21/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#offsetsForTimes-java.util.Map-
 for details.<p/>
+  Also the meaning of `timestamp` here can be vary according to Kafka 
configuration (`log.message.timestamp.type`): please refer 
https://kafka.apache.org/documentation/ for further details.<p/>
+  Note: This option requires Kafka 0.10.1.0 or higher.<p/>
+  Note2: `startingOffsetsByTimestamp` takes precedence over 
`startingOffsets`.<p/>
 
 Review comment:
   Yeah... it might be possible if we use timestamp as some of custom format 
like `ts:<timestamp>`, and try to parse it as long for offset, and fail-back to 
custom format for timestamp. I was also considered like this but didn't feel 
good.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to