drill-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] (DRILL-5094) Assure Comparator to be transitive
Date Fri, 02 Dec 2016 17:58:58 GMT

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

ASF GitHub Bot commented on DRILL-5094:
---------------------------------------

Github user laurentgo commented on a diff in the pull request:

    https://github.com/apache/drill/pull/675#discussion_r90688989
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/schedule/AssignmentCreator.java
---
    @@ -50,7 +50,8 @@
       private static Comparator<Entry<DrillbitEndpoint,Long>> comparator = new
Comparator<Entry<DrillbitEndpoint,Long>>() {
         @Override
         public int compare(Entry<DrillbitEndpoint, Long> o1, Entry<DrillbitEndpoint,Long>
o2) {
    -      return (int) (o1.getValue() - o2.getValue());
    +      long ret = o1.getValue() - o2.getValue();
    --- End diff --
    
    Alternatively: 
    `
    return o1.getValue().compareTo(o2.getValue());
    `


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

Mime
View raw message