HeartSaVioR commented on a change in pull request #25911:
[SPARK-29223][SQL][SS] Enable global timestamp per topic while specifying
offset by timestamp in Kafka source
URL: https://github.com/apache/spark/pull/25911#discussion_r327463145
##########
File path:
external/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaMicroBatchSourceSuite.scala
##########
@@ -1505,28 +1533,11 @@ abstract class KafkaSourceSuiteBase extends
KafkaSourceTest {
failOnDataLoss: Boolean,
addPartitions: Boolean,
options: (String, String)*): Unit = {
- def sendMessages(topic: String, msgs: Seq[String], part: Int, ts: Long):
Unit = {
- val records = msgs.map { msg =>
- new RecordBuilder(topic, msg).partition(part).timestamp(ts).build()
- }
- testUtils.sendMessages(records)
- }
-
testUtils.createTopic(topic, partitions = 5)
val firstTimestamp = System.currentTimeMillis() - 5000
- sendMessages(topic, Array(-20).map(_.toString), 0, firstTimestamp)
- sendMessages(topic, Array(-10).map(_.toString), 1, firstTimestamp)
- sendMessages(topic, Array(0, 1).map(_.toString), 2, firstTimestamp)
- sendMessages(topic, Array(10, 11).map(_.toString), 3, firstTimestamp)
- sendMessages(topic, Array(20, 21, 22).map(_.toString), 4, firstTimestamp)
-
val secondTimestamp = firstTimestamp + 1000
- sendMessages(topic, Array(-21, -22).map(_.toString), 0, secondTimestamp)
- sendMessages(topic, Array(-11, -12).map(_.toString), 1, secondTimestamp)
- sendMessages(topic, Array(2).map(_.toString), 2, secondTimestamp)
- sendMessages(topic, Array(12).map(_.toString), 3, secondTimestamp)
- // no data after second timestamp for partition 4
+ setupTestMessagesForTestOnTimestampOffsets(topic, firstTimestamp,
secondTimestamp)
Review comment:
Lines with `sendMessages` are moved to
`setupTestMessagesForTestOnTimestampOffsets` to reuse between tests for
timestamps and tests for global timestamp.
----------------------------------------------------------------
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]