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 Fri, 28 Sep 2018 00:37:00 GMT

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

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

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:
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.4.2, v2.5.1
>
>
> 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