[jira] [Commented] (KYLIN-3581) compareTo method should be paired with equals method

2018-09-29 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/KYLIN-3581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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:
us...@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)


[jira] [Commented] (KYLIN-3581) compareTo method should be paired with equals method

2018-09-29 Thread ASF subversion and git services (JIRA)


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

ASF subversion and git services commented on KYLIN-3581:


Commit 3342d08ef8f4684cac6fe0bfc7484fbba6aa8fb9 in kylin's branch 
refs/heads/master from hit-lacus
[ https://gitbox.apache.org/repos/asf?p=kylin.git;h=3342d08 ]

KYLIN-3581 Obey the contract of 'x.equals(y) should be consistent with 
x.compareTo(y)'

https://issues.apache.org/jira/browse/KYLIN-3581


> 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)


[jira] [Commented] (KYLIN-3581) compareTo method should be paired with equals method

2018-09-29 Thread ASF subversion and git services (JIRA)


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

ASF subversion and git services commented on KYLIN-3581:


Commit 3342d08ef8f4684cac6fe0bfc7484fbba6aa8fb9 in kylin's branch 
refs/heads/master from hit-lacus
[ https://gitbox.apache.org/repos/asf?p=kylin.git;h=3342d08 ]

KYLIN-3581 Obey the contract of 'x.equals(y) should be consistent with 
x.compareTo(y)'

https://issues.apache.org/jira/browse/KYLIN-3581


> 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)


[jira] [Commented] (KYLIN-3581) compareTo method should be paired with equals method

2018-09-25 Thread ASF GitHub Bot (JIRA)


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

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

coveralls commented on issue #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#issuecomment-424236234
 
 
   ## Pull Request Test Coverage Report for [Build 
3645](https://coveralls.io/builds/19171883)
   
   * **0** of **10**   **(0.0%)**  changed or added relevant lines in **2** 
files are covered.
   * **3** unchanged lines in **2** files lost coverage.
   * Overall coverage decreased (**-0.008%**) to **23.116%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-|--||---: |
   | 
[core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/DoggedCubeBuilder.java](https://coveralls.io/builds/19171883/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Finmemcubing%2FDoggedCubeBuilder.java#L353)
 | 0 | 5 | 0.0%
   | 
[core-cube/src/main/java/org/apache/kylin/cube/inmemcubing/InMemCubeBuilder.java](https://coveralls.io/builds/19171883/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Finmemcubing%2FInMemCubeBuilder.java#L528)
 | 0 | 5 | 0.0%
   
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-|--|--: |
   | 
[core-metadata/src/main/java/org/apache/kylin/metadata/cachesync/Broadcaster.java](https://coveralls.io/builds/19171883/source?filename=core-metadata%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fmetadata%2Fcachesync%2FBroadcaster.java#L149)
 | 1 | 57.71% |
   | 
[core-cube/src/main/java/org/apache/kylin/cube/cuboid/TreeCuboidScheduler.java](https://coveralls.io/builds/19171883/source?filename=core-cube%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fcube%2Fcuboid%2FTreeCuboidScheduler.java#L124)
 | 2 | 68.46% |
   
   
   |  Totals | [![Coverage 
Status](https://coveralls.io/builds/19171883/badge)](https://coveralls.io/builds/19171883)
 |
   | :-- | --: |
   | Change from base [Build 3641](https://coveralls.io/builds/19170293): |  
-0.008% |
   | Covered Lines: | 16155 |
   | Relevant Lines: | 69888 |
   
   ---
   #   - [Coveralls](https://coveralls.io)
   


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


> 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)


[jira] [Commented] (KYLIN-3581) compareTo method should be paired with equals method

2018-09-25 Thread ASF GitHub Bot (JIRA)


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

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

hit-lacus opened a new 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 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


> 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)


[jira] [Commented] (KYLIN-3581) compareTo method should be paired with equals method

2018-09-25 Thread ASF GitHub Bot (JIRA)


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

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

asfgit commented on issue #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#issuecomment-424230094
 
 
   Can one of the admins verify this patch?


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


> 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)


[jira] [Commented] (KYLIN-3581) compareTo method should be paired with equals method

2018-09-25 Thread ASF GitHub Bot (JIRA)


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

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

asfgit commented on issue #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#issuecomment-424230093
 
 
   Can one of the admins verify this patch?


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


> 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)


[jira] [Commented] (KYLIN-3581) compareTo method should be paired with equals method

2018-09-25 Thread XiaoXiang Yu (JIRA)


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

XiaoXiang Yu commented on KYLIN-3581:
-

[https://www.artima.com/lejava/articles/equality.html]

Pitfall #3: Defining equals in terms of mutable fields

> 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)


[jira] [Commented] (KYLIN-3581) compareTo method should be paired with equals method

2018-09-24 Thread XiaoXiang Yu (JIRA)


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

XiaoXiang Yu commented on KYLIN-3581:
-

I think I can fix it.

> 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
>Priority: Minor
>
> 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)