Jungtaek Lim created SPARK-30075: ------------------------------------ Summary: ArrayIndexType doesn't implement hashCode correctly Key: SPARK-30075 URL: https://issues.apache.org/jira/browse/SPARK-30075 Project: Spark Issue Type: Bug Components: Spark Core Affects Versions: 2.4.4, 3.0.0 Reporter: Jungtaek Lim
[https://github.com/apache/spark/blob/master/common/kvstore/src/test/java/org/apache/spark/util/kvstore/ArrayKeyIndexType.java] {code:java} 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(); } } {code} 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. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org