shaofengshi commented on a change in pull request #249: KYLIN-3581 Obey the
contract of 'x.equals(y) should be consistent with x.compareTo(y)'
URL: https://github.com/apache/kylin/pull/249#discussion_r221115599
##########
File path:
core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java
##########
@@ -521,5 +522,19 @@ public int compareTo(CuboidTask o) {
long comp = this.childCuboidId - o.childCuboidId;
return comp < 0 ? -1 : (comp > 0 ? 1 : 0);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ CuboidTask that = (CuboidTask) o;
+ return compareTo(that) == 0;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(childCuboidId);
Review comment:
Use "Long.hashCode(long v)" is better.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services