Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/23043#discussion_r234476055
  
    --- Diff: 
common/unsafe/src/test/java/org/apache/spark/unsafe/PlatformUtilSuite.java ---
    @@ -157,4 +159,15 @@ public void heapMemoryReuse() {
         Assert.assertEquals(onheap4.size(), 1024 * 1024 + 7);
         Assert.assertEquals(obj3, onheap4.getBaseObject());
       }
    +
    +  @Test
    +  // SPARK-26021
    +  public void writeMinusZeroIsReplacedWithZero() {
    +    byte[] doubleBytes = new byte[Double.BYTES];
    +    byte[] floatBytes = new byte[Float.BYTES];
    +    Platform.putDouble(doubleBytes, Platform.BYTE_ARRAY_OFFSET, -0.0d);
    +    Platform.putFloat(floatBytes, Platform.BYTE_ARRAY_OFFSET, -0.0f);
    +    Assert.assertEquals(0, Double.compare(0.0d, 
ByteBuffer.wrap(doubleBytes).getDouble()));
    --- End diff --
    
    BTW thanks for adding the unit test! It's a good complementary to the 
end-to-end test.


---

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

Reply via email to