linehrr commented on a change in pull request #23666: [SPARK-26718][SS] Fixed 
integer overflow in SS kafka rateLimit calculation 
URL: https://github.com/apache/spark/pull/23666#discussion_r251598019
 
 

 ##########
 File path: 
external/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaMicroBatchSourceSuite.scala
 ##########
 @@ -204,6 +204,43 @@ abstract class KafkaMicroBatchSourceSuiteBase extends 
KafkaSourceSuiteBase {
       StopStream)
   }
 
+  test("SPARK-26718 Rate limit set to Long.Max should not overflow integer " +
+    "during end offset calculation") {
+    val topic = newTopic()
+    testUtils.createTopic(topic, partitions = 1)
+    // fill in 5000 messages to trigger potential integer overflow
+    testUtils.sendMessages(topic, (0 until 5000).map(_.toString).toArray, 
Some(0))
+
+    val partitionOffsets = Map(
+      new TopicPartition(topic, 0) -> 5000L
+    )
+    val startingOffsets = JsonUtils.partitionOffsets(partitionOffsets)
+
+    val sparkSession = spark
+    import sparkSession.implicits._
 
 Review comment:
   ha, it's not, Encoders are already provided in this context as implicits, I 
will remove it.  

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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