You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by GitBox <gi...@apache.org> on 2021/07/26 11:37:33 UTC

[GitHub] [orc] pgaref commented on a change in pull request #748: ORC-842: Remove newKey from StringHashTableDictionary

pgaref commented on a change in pull request #748:
URL: https://github.com/apache/orc/pull/748#discussion_r676525086



##########
File path: java/core/src/java/org/apache/orc/impl/StringHashTableDictionary.java
##########
@@ -173,10 +170,18 @@ public int size() {
 
   /**
    * Compute the hash value and find the corresponding index.
-   *
    */
   int getIndex(Text text) {
-    return Math.floorMod(text.hashCode(), capacity);
+    return getIndex(text.getBytes(), 0, text.getLength());
+  }
+
+  /**
+   * Compute the hash value and find the corresponding index. Uses same
+   * implementation as {@code Text#hashCode()}.
+   */
+  int getIndex(final byte[] bytes, final int offset, final int length) {
+    return Math.floorMod(WritableComparator.hashBytes(bytes, offset, length),

Review comment:
       Thats exactly what I had in mind with my comment above..




-- 
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: dev-unsubscribe@orc.apache.org

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