This is an automated email from the ASF dual-hosted git repository.
zhouky pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git
The following commit(s) were added to refs/heads/main by this push:
new bf725afb3 [CELEBORN-1068] Fix hashCode computation
bf725afb3 is described below
commit bf725afb35732e5b5caf50cc830577927c5931d0
Author: Mridul Muralidharan <mridulatgmail.com>
AuthorDate: Sun Oct 22 21:31:38 2023 +0800
[CELEBORN-1068] Fix hashCode computation
### What changes were proposed in this pull request?
The `hashCode` for an array does not hash the content - but just the
identity array reference.
This was identified as part of enabling error prone (See #2016)
See more [here](https://errorprone.info/bugpattern/ArrayHashCode)
### Why are the changes needed?
Fix bug with `hashCode` computation as identified by error-prone
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Existing unit tests
Closes #2017 from mridulm/fix-hashcode-computation.
Authored-by: Mridul Muralidharan <mridulatgmail.com>
Signed-off-by: zky.zhoukeyong <[email protected]>
---
.../java/org/apache/celeborn/common/network/protocol/OpenStream.java | 3 ++-
.../org/apache/celeborn/common/network/protocol/PushMergedData.java | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git
a/common/src/main/java/org/apache/celeborn/common/network/protocol/OpenStream.java
b/common/src/main/java/org/apache/celeborn/common/network/protocol/OpenStream.java
index da5b3dad3..7919900e7 100644
---
a/common/src/main/java/org/apache/celeborn/common/network/protocol/OpenStream.java
+++
b/common/src/main/java/org/apache/celeborn/common/network/protocol/OpenStream.java
@@ -81,7 +81,8 @@ public final class OpenStream extends RequestMessage {
@Override
public int hashCode() {
- return Objects.hashCode(shuffleKey, fileName, startMapIndex, endMapIndex);
+ return Objects.hashCode(
+ Arrays.hashCode(shuffleKey), Arrays.hashCode(fileName), startMapIndex,
endMapIndex);
}
@Override
diff --git
a/common/src/main/java/org/apache/celeborn/common/network/protocol/PushMergedData.java
b/common/src/main/java/org/apache/celeborn/common/network/protocol/PushMergedData.java
index a18944c46..332e66f6f 100644
---
a/common/src/main/java/org/apache/celeborn/common/network/protocol/PushMergedData.java
+++
b/common/src/main/java/org/apache/celeborn/common/network/protocol/PushMergedData.java
@@ -99,7 +99,7 @@ public final class PushMergedData extends RequestMessage {
@Override
public int hashCode() {
- return Objects.hashCode(requestId, mode, shuffleKey, partitionUniqueIds,
batchOffsets, body());
+ return Objects.hashCode(requestId, mode, shuffleKey);
}
@Override