[ https://issues.apache.org/jira/browse/DRILL-5094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15716029#comment-15716029 ]
Chunhui Shi commented on DRILL-5094: ------------------------------------ My implementation is actually implemented by referring to Long.compareTo. The reason I prefer not to use compareTo() was I wanted to reduce one function call, and move more possible code paths ('>' and '<' ) to the front (of '='). I think it is reasonable assumption that we don't expect dataset to be larger than half of Long.MAX_VALUE bytes(2EB)? So -1 still will be fine. :-) . > Assure Comparator to be transitive > ---------------------------------- > > Key: DRILL-5094 > URL: https://issues.apache.org/jira/browse/DRILL-5094 > Project: Apache Drill > Issue Type: Bug > Reporter: Chunhui Shi > Assignee: Chunhui Shi > Priority: Critical > Labels: ready-to-commit > > In AssignmentCreator.java, one Comparator could break transitive attribute > required for a Comparator implementation and the result is not correct. > E.g. for: > long IntPlusOne = 0x80000000L; > [0]=2 * IntPlusOne + 5, [1] = 2* IntPlusOne + 8, [2] = 4 * IntPlusOne + 4, > the compare results will be like: > compare([0],[1]) = -3, > compare([1],[2]) = 4, > compare([0],[2]) = 1 -- This message was sent by Atlassian JIRA (v6.3.4#6332)