apache / apache/arrow-java

[Java] MurmurHasher doesn't take the final bytes into account if size % 4 != 0

Open
#248 0 comments 2 reactions 0 assignees View on GitHub
Type: bug
Dominant language
Java
Stars
94
Forks
152
Avg merge
3d 16h
Merged PRs (30d)
11

Description

Minimal test case: all buffers of size 1 currently hash to the same value (-1684229222)

To my (admittedly untrained) eye, it looks like should range from `length - 1` rather than `index - 1`?

Also, should the nearby `index += 1` be removed, so that `i` and `index` don't meet in the middle? (`index` is being checked in the loop condition)

**Reporter**: [James Henderson](https://issues.apache.org/jira/browse/ARROW-15175) / @jarohen

**Note**: *This issue was originally created as [ARROW-15175](https://issues.apache.org/jira/browse/ARROW-15175). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Contributor guide

Open the contributing guide

Research direction

Open java/memory/memory-core/src/main/java/org/apache/arrow/memory/util/hash/MurmurHasher.java at the referenced line and reproduce the issue with buffers whose size is not divisible by four, especially size 1. Trace the loop bounds and final-byte handling, then verify that buffers with different final bytes no longer produce the same hash.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.