This is an automated email from the ASF dual-hosted git repository.

ravindra pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 7478fac  ARROW-6264: [Java] There is no need to consider byte order in 
ArrowBufHasher
7478fac is described below

commit 7478fac1baf8324b279ddc261be9b4bc9b4b21e7
Author: liyafan82 <[email protected]>
AuthorDate: Fri Aug 16 14:27:43 2019 +0530

    ARROW-6264: [Java] There is no need to consider byte order in ArrowBufHasher
    
    According to the discussion in 
https://github.com/apache/arrow/pull/5063#issuecomment-521276547, Arrow has a 
mechanism to make sure the data is stored in little-endian, so there is no need 
to check byte order.
    
    Closes #5098 from liyafan82/fly_0816_order and squashes the following 
commits:
    
    538ce59d7 <liyafan82> ARROW-6264  There is no need to consider byte order 
in ArrowBufHasher
    
    Authored-by: liyafan82 <[email protected]>
    Signed-off-by: Pindikura Ravindra <[email protected]>
---
 .../main/java/org/apache/arrow/memory/util/ArrowBufPointer.java  | 4 ----
 .../java/org/apache/arrow/memory/util/hash/MurmurHasher.java     | 5 -----
 .../java/org/apache/arrow/memory/util/hash/SimpleHasher.java     | 9 ---------
 3 files changed, 18 deletions(-)

diff --git 
a/java/memory/src/main/java/org/apache/arrow/memory/util/ArrowBufPointer.java 
b/java/memory/src/main/java/org/apache/arrow/memory/util/ArrowBufPointer.java
index dd00c79..b381b88 100644
--- 
a/java/memory/src/main/java/org/apache/arrow/memory/util/ArrowBufPointer.java
+++ 
b/java/memory/src/main/java/org/apache/arrow/memory/util/ArrowBufPointer.java
@@ -17,8 +17,6 @@
 
 package org.apache.arrow.memory.util;
 
-import java.nio.ByteOrder;
-
 import org.apache.arrow.memory.util.hash.ArrowBufHasher;
 import org.apache.arrow.memory.util.hash.SimpleHasher;
 import org.apache.arrow.util.Preconditions;
@@ -31,8 +29,6 @@ import io.netty.buffer.ArrowBuf;
  */
 public final class ArrowBufPointer {
 
-  public static final boolean LITTLE_ENDIAN = ByteOrder.nativeOrder() == 
ByteOrder.LITTLE_ENDIAN;
-
   /**
    * The hash code when the arrow buffer is null.
    */
diff --git 
a/java/memory/src/main/java/org/apache/arrow/memory/util/hash/MurmurHasher.java 
b/java/memory/src/main/java/org/apache/arrow/memory/util/hash/MurmurHasher.java
index 9574fe6..2e7e52e 100644
--- 
a/java/memory/src/main/java/org/apache/arrow/memory/util/hash/MurmurHasher.java
+++ 
b/java/memory/src/main/java/org/apache/arrow/memory/util/hash/MurmurHasher.java
@@ -20,8 +20,6 @@ package org.apache.arrow.memory.util.hash;
 import static io.netty.util.internal.PlatformDependent.getByte;
 import static io.netty.util.internal.PlatformDependent.getInt;
 
-import org.apache.arrow.memory.util.ArrowBufPointer;
-
 import io.netty.buffer.ArrowBuf;
 
 /**
@@ -93,9 +91,6 @@ public class MurmurHasher implements ArrowBufHasher {
     int hash = seed;
     while (index + 4 <= length) {
       int intValue = getInt(address + index);
-      if (!ArrowBufPointer.LITTLE_ENDIAN) {
-        intValue = Integer.reverseBytes(intValue);
-      }
       hash = combineHashCode(hash, intValue);
       index += 4;
     }
diff --git 
a/java/memory/src/main/java/org/apache/arrow/memory/util/hash/SimpleHasher.java 
b/java/memory/src/main/java/org/apache/arrow/memory/util/hash/SimpleHasher.java
index a75566b..a81ab48 100644
--- 
a/java/memory/src/main/java/org/apache/arrow/memory/util/hash/SimpleHasher.java
+++ 
b/java/memory/src/main/java/org/apache/arrow/memory/util/hash/SimpleHasher.java
@@ -21,8 +21,6 @@ import static 
io.netty.util.internal.PlatformDependent.getByte;
 import static io.netty.util.internal.PlatformDependent.getInt;
 import static io.netty.util.internal.PlatformDependent.getLong;
 
-import org.apache.arrow.memory.util.ArrowBufPointer;
-
 import io.netty.buffer.ArrowBuf;
 
 /**
@@ -61,10 +59,6 @@ public class SimpleHasher implements ArrowBufHasher {
     int index = 0;
     while (index + 8 <= length) {
       long longValue = getLong(address + index);
-      if (!ArrowBufPointer.LITTLE_ENDIAN) {
-        // assume the buffer is in little endian
-        longValue = Long.reverseBytes(longValue);
-      }
       int longHash = getLongHashCode(longValue);
       hashValue = combineHashCode(hashValue, longHash);
       index += 8;
@@ -72,9 +66,6 @@ public class SimpleHasher implements ArrowBufHasher {
 
     while (index + 4 <= length) {
       int intValue = getInt(address + index);
-      if (!ArrowBufPointer.LITTLE_ENDIAN) {
-        intValue = Integer.reverseBytes(intValue);
-      }
       int intHash = intValue;
       hashValue = combineHashCode(hashValue, intHash);
       index += 4;

Reply via email to