shaofengshi closed 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
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/DoggedCubeBuilder.java b/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/DoggedCubeBuilder.java index d761505b2c..06e4a5d582 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/DoggedCubeBuilder.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/DoggedCubeBuilder.java @@ -347,6 +347,19 @@ public boolean fetchNext() throws IOException { } } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + MergeSlot mergeSlot = (MergeSlot) o; + return compareTo(mergeSlot) == 0; + } + + @Override + public int hashCode() { + return Long.hashCode(currentCuboidId); + } + @Override public int compareTo(MergeSlot o) { long cuboidComp = this.currentCuboidId - o.currentCuboidId; diff --git a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java b/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java index db3eb5dd80..ef61ce9a5a 100644 --- a/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java +++ b/core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java @@ -521,5 +521,18 @@ 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 Long.hashCode(childCuboidId); + } } } ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services