Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.4.4, 3.0.0
-
None
Description
public class ArrayKeyIndexType { @KVIndex public int[] key; @KVIndex("id") public String[] id; @Override public boolean equals(Object o) { if (o instanceof ArrayKeyIndexType) { ArrayKeyIndexType other = (ArrayKeyIndexType) o; return Arrays.equals(key, other.key) && Arrays.equals(id, other.id); } return false; } @Override public int hashCode() { return key.hashCode(); } }
Here hashCode() simply calls key.hashCode() which won't work as our intention - as the implementation would be Object.hashCode(). We need to call Array.hashCode(key) instead.
Attachments
Issue Links
- is duplicated by
-
SPARK-30405 ArrayKeyIndexType should use Arrays.hashCode
- Resolved
- links to