[
https://issues.apache.org/jira/browse/KYLIN-3581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16625468#comment-16625468
]
XiaoXiang Yu edited comment on KYLIN-3581 at 9/25/18 3:08 AM:
--------------------------------------------------------------
I think I can fix it.
My opinion:
According to java api, https://docs.oracle.com/javase/8/docs/api/ says:
{quote}_It is strongly recommended, but not strictly required that
{{(x.compareTo(y)==0) == (x.equals(y))}}. Generally speaking, any class that
implements the {{Comparable}} interface and violates this condition should
clearly indicate this fact. The recommended language is "Note: this class has a
natural ordering that is inconsistent with equals."_
{quote}
And
[https://dzone.com/articles/the-hidden-contract-between-equals-and-comparable]
I think I should provide both implementation of equals and hashCode.Maybe I can
delegate equal to compareTo(obj) == 0.Like:
{quote}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;
}
{quote}
was (Author: hit_lacus):
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
> 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)