You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Haisheng Yuan (Jira)" <ji...@apache.org> on 2020/06/30 04:06:00 UTC
[jira] [Created] (CALCITE-4096) Change Pair.hashCode() not to use
XOR
Haisheng Yuan created CALCITE-4096:
--------------------------------------
Summary: Change Pair.hashCode() not to use XOR
Key: CALCITE-4096
URL: https://issues.apache.org/jira/browse/CALCITE-4096
Project: Calcite
Issue Type: Improvement
Components: core
Reporter: Haisheng Yuan
JDK Map Entry uses XOR maybe because it is unlikely to use Map Entry as the HashMap key.
But Pair in Calcite is a general data structure, it is used in several places as the key of HashMap/HashSet. XOR is not a good candidate for hash algorithm, it is more likely to generate hash collision than simple prime multiplication, especially when pair.left equals pair.right.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)