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_r266604239
 
 

 ##########
 File path: 
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/JsonUtils.scala
 ##########
 @@ -76,6 +76,16 @@ private object JsonUtils {
     }
   }
 
+  def topicTimestamps(str: String): Map[String, Long] = {
+    try {
+      Serialization.read[Map[String, Long]](str)
+    } catch {
+      case NonFatal(x) =>
+        throw new IllegalArgumentException(
+          s"""Expected e.g. {"topicA": 1549597128110,"topicB": 1549597120110}, 
got $str""")
 
 Review comment:
   I considered actual use cases and feel we don't have to let end users 
describe all partitions. Most of use cases end users wouldn't want to set 
different timestamp for partitions. They mostly want to rewind to specific 
timestamp and replay, which timestamp should be global here.
   Maybe we even don't want to set it for each topic too, but I just open the 
possibility. If we agree timestamp should be same for topics as well I can 
change it. I'm still open to support timestamp to partition level, but would 
like to hear more voices on this.

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