You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/10/17 00:36:22 UTC

[GitHub] [spark] kazuyukitanimura commented on a change in pull request #34284: [SPARK-36900][CORE][TEST] Refactor `SPARK-36464: size returns correct positive number even with over 2GB data` to pass with Java 8, 11 and 17

kazuyukitanimura commented on a change in pull request #34284:
URL: https://github.com/apache/spark/pull/34284#discussion_r729986884



##########
File path: core/src/test/scala/org/apache/spark/util/io/ChunkedByteBufferOutputStreamSuite.scala
##########
@@ -121,12 +121,13 @@ class ChunkedByteBufferOutputStreamSuite extends SparkFunSuite {
   }
 
   test("SPARK-36464: size returns correct positive number even with over 2GB data") {
-    val ref = new Array[Byte](1024 * 1024 * 1024)
-    val o = new ChunkedByteBufferOutputStream(1024 * 1024, ByteBuffer.allocate)
-    o.write(ref)
-    o.write(ref)
+    val data4M = 1024 * 1024 * 4

Review comment:
       LGTM (non-binding)
   
   Or alternatively, .... (twisting Sean's point a bit)
   ```
   val chunkSize = 1024 * 1024 * 4
   val writeTimes = 2L * 1024 * 1024 * 1024 / chunkSize + 1 // = 513
   ...
   (0 until writeTimes)....
   ```

##########
File path: core/src/test/scala/org/apache/spark/util/io/ChunkedByteBufferOutputStreamSuite.scala
##########
@@ -121,12 +121,10 @@ class ChunkedByteBufferOutputStreamSuite extends SparkFunSuite {
   }
 
   test("SPARK-36464: size returns correct positive number even with over 2GB data") {
-    val ref = new Array[Byte](1024 * 1024 * 1024)
-    val o = new ChunkedByteBufferOutputStream(1024 * 1024, ByteBuffer.allocate)
-    o.write(ref)
-    o.write(ref)
-    o.close()
+    val ref = new Array[Byte](1024 * 1024 * 4)
+    val o = new ChunkedByteBufferOutputStream(1024 * 1024 * 4, ByteBuffer.allocate)

Review comment:
       Nice finding. Thank you!




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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org