Github user huaxingao commented on a diff in the pull request:
https://github.com/apache/spark/pull/11250#discussion_r53430913
--- Diff:
extras/kinesis-asl/src/test/scala/org/apache/spark/streaming/kinesis/KinesisStreamSuite.scala
---
@@ -241,13 +243,13 @@ abstract class KinesisStreamTests(aggregateTestData:
Boolean) extends KinesisFun
kinesisStream.foreachRDD((rdd: RDD[Array[Byte]], time: Time) => {
val kRdd = rdd.asInstanceOf[KinesisBackedBlockRDD[Array[Byte]]]
val data = rdd.map { bytes => new String(bytes).toInt
}.collect().toSeq
- collectedData(time) = (kRdd.arrayOfseqNumberRanges, data)
+ collectedData.put(time, (kRdd.arrayOfseqNumberRanges, data))
})
ssc.remember(Minutes(60)) // remember all the batches so that they are
all saved in checkpoint
ssc.start()
- def numBatchesWithData: Int = collectedData.count(_._2._2.nonEmpty)
+ def numBatchesWithData: Int =
collectedData.asScala.count(_._2._2.nonEmpty)
--- End diff --
@srowen
Thanks for your comment. For the 5 files I changed, I will remove the usage
of Java ConcurrentHashMap, and use mutable.HashMap instead. I will wrap every
mutable.HashMap operation in a synchronized block.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]