srowen commented on a change in pull request #22282: [SPARK-23539][SS] Add
support for Kafka headers in Structured Streaming
URL: https://github.com/apache/spark/pull/22282#discussion_r322760676
##########
File path:
external/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaDataConsumerSuite.scala
##########
@@ -157,10 +159,22 @@ class KafkaDataConsumerSuite extends SharedSparkSession
with PrivateMethodTester
try {
val range = consumer.getAvailableOffsetRange()
val rcvd = range.earliest until range.latest map { offset =>
- val bytes = consumer.get(offset, Long.MaxValue, 10000,
failOnDataLoss = false).value()
- new String(bytes)
+ val record = consumer.get(offset, Long.MaxValue, 10000,
failOnDataLoss = false)
+ val value = new String(record.value(), StandardCharsets.UTF_8)
+ val headers = record.headers().toArray.map(header => (header.key(),
header.value())).toSeq
+ (value, headers)
+ }
+ data.zip(rcvd).foreach { case (expected, actual) =>
+ // value
+ assert(expected._1 === actual._1)
+ // headers
+ expected._2 zip actual._2 foreach { case (l, r) =>
+ // header key
+ assert(l._1 == r._1)
Review comment:
Nit: use `===` in test asserts
----------------------------------------------------------------
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]