Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18855#discussion_r133317789
  
    --- Diff: core/src/test/scala/org/apache/spark/storage/DiskStoreSuite.scala 
---
    @@ -92,6 +92,45 @@ class DiskStoreSuite extends SparkFunSuite {
         assert(diskStore.getSize(blockId) === 0L)
       }
     
    +  test("blocks larger than 2gb") {
    +    val conf = new SparkConf()
    +      .set("spark.storage.memoryMapLimitForTests", "10k" )
    +    val diskBlockManager = new DiskBlockManager(conf, deleteFilesOnStop = 
true)
    +    val diskStore = new DiskStore(conf, diskBlockManager, new 
SecurityManager(conf))
    +
    +
    +    val blockId = BlockId("rdd_1_2")
    +    diskStore.put(blockId) { chan =>
    +      val arr = new Array[Byte](1024)
    +      for {
    +        _ <- 0 until 20
    +      } {
    +        val buf = ByteBuffer.wrap(arr)
    +        while (buf.hasRemaining()) {
    +          chan.write(buf)
    +        }
    +      }
    +    }
    +
    +    val blockData = diskStore.getBytes(blockId)
    +    assert(blockData.size == 20 * 1024)
    +
    +    val chunkedByteBuffer = 
blockData.toChunkedByteBuffer(ByteBuffer.allocate)
    +    val chunks = chunkedByteBuffer.chunks
    +    assert(chunks.size === 2)
    +    for( chunk <- chunks ) {
    --- End diff --
    
    nit: `for (chunk...) {`


---
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]

Reply via email to