kylin-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KYLIN-3581) compareTo method should be paired with equals method
Date Sun, 30 Sep 2018 03:43:00 GMT

    [ https://issues.apache.org/jira/browse/KYLIN-3581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633211#comment-16633211
] 

ASF GitHub Bot commented on KYLIN-3581:
---------------------------------------

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:
users@infra.apache.org


> compareTo method should be paired with equals method
> ----------------------------------------------------
>
>                 Key: KYLIN-3581
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3581
>             Project: Kylin
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: XiaoXiang Yu
>            Priority: Minor
>             Fix For: v2.6.0
>
>
> DoggedCubeBuilder$MergeSlot and InMemCubeBuilder$CuboidTask define compareTo method.
> They should define equals method as well.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message