gaborgsomogyi 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_r266787989
##########
File path:
external/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaRelationSuite.scala
##########
@@ -142,6 +142,118 @@ class KafkaRelationSuite extends QueryTest with
SharedSQLContext with KafkaTest
checkAnswer(df, (0 to 30).map(_.toString).toDF)
}
+ test("timestamp provided for starting and ending") {
+ val (topic, timestamps) = prepareTimestampRelatedUnitTest
+
+ // timestamp both presented: starting "first" ending "finalized"
+ verifyTimestampRelatedQueryResult({ df =>
+ val startTopicTimestamps = Map(topic -> timestamps.head)
+ val startingTimestamps = JsonUtils.topicTimestamps(startTopicTimestamps)
+
+ val endTopicTimestamps = Map(topic -> timestamps(3))
+ val endingTimestamps = JsonUtils.topicTimestamps(endTopicTimestamps)
+
+ df.option("startingOffsetsByTimestamp", startingTimestamps)
+ .option("endingOffsetsByTimestamp", endingTimestamps)
+ }, topic, 0 to 20)
Review comment:
Couple of tests are something like this (oversimplified):
```
producer.send(0 to 20)
...some mambo-jumbo here...
val result = consumer.pollAll(0, 20)
assert(result, (0 to 20))
```
It would be good to test something which is not `earliest` or `latest`.
----------------------------------------------------------------
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]