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_r327463385
##########
File path:
external/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaMicroBatchSourceSuite.scala
##########
@@ -1537,19 +1548,8 @@ abstract class KafkaSourceSuiteBase extends
KafkaSourceTest {
) ++ Map(new TopicPartition(topic, 4) -> firstTimestamp)
val startingTimestamps =
JsonUtils.partitionTimestamps(startPartitionTimestamps)
- val reader = spark
- .readStream
- .format("kafka")
- .option("startingOffsetsByTimestamp", startingTimestamps)
- .option("kafka.bootstrap.servers", testUtils.brokerAddress)
- .option("kafka.metadata.max.age.ms", "1")
- .option("failOnDataLoss", failOnDataLoss.toString)
- options.foreach { case (k, v) => reader.option(k, v) }
- val kafka = reader.load()
- .selectExpr("CAST(key AS STRING)", "CAST(value AS STRING)")
- .as[(String, String)]
- val mapped: org.apache.spark.sql.Dataset[_] = kafka.map(kv => kv._2.toInt)
-
+ val mapped = setupDataFrameForTestOnTimestampOffsets(startingTimestamps,
failOnDataLoss,
Review comment:
Lines with setting up DataFrame are moved to
`setupDataFrameForTestOnTimestampOffsets` 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]