Repository: lens Updated Branches: refs/heads/master 24d4f1531 -> dbbd0c446
LENS-1475 : Override equals(Object obj) and hashcode() methods of SegmentationCandidate Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/dbbd0c44 Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/dbbd0c44 Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/dbbd0c44 Branch: refs/heads/master Commit: dbbd0c44670d5b15022bb93f05f526783f29a4a4 Parents: 24d4f15 Author: Sushil Mohanty <sushil.k.moha...@gmail.com> Authored: Thu Sep 14 12:42:57 2017 +0530 Committer: sushilmohanty <sushilmoha...@apache.org> Committed: Thu Sep 14 12:42:57 2017 +0530 ---------------------------------------------------------------------- .../lens/cube/parse/SegmentationCandidate.java | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lens/blob/dbbd0c44/lens-cube/src/main/java/org/apache/lens/cube/parse/SegmentationCandidate.java ---------------------------------------------------------------------- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/SegmentationCandidate.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/SegmentationCandidate.java index 055d6ef..9378009 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/parse/SegmentationCandidate.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/SegmentationCandidate.java @@ -404,4 +404,25 @@ public class SegmentationCandidate implements Candidate { return cubeQueryContextMap.entrySet().stream().filter(entry -> entry.getValue().getPickedCandidate() == null) .collect(toMap(Map.Entry::getKey, entry -> entry.getValue().getStoragePruningMsgs())); } + + @Override + public boolean equals(Object obj) { + if (super.equals(obj)) { + return true; + } + + if (obj == null || !(obj instanceof SegmentationCandidate)) { + return false; + } + + SegmentationCandidate segmantationCandidate = (SegmentationCandidate) obj; + return (segmantationCandidate.segmentation.getSegments().equals(this.segmentation.getSegments()) + && segmantationCandidate.segmentation.getBaseCube().equals(this.segmentation.getBaseCube())); + } + + @Override + public int hashCode() { + return segmentation.hashCode(); + } + }