You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Laurent Goujon (JIRA)" <ji...@apache.org> on 2016/12/02 19:40:58 UTC

[jira] [Comment Edited] (DRILL-5094) Assure Comparator to be transitive

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

Laurent Goujon edited comment on DRILL-5094 at 12/2/16 7:40 PM:
----------------------------------------------------------------

The Long.compareTo() is slightly different as it's not doing any substraction:

{code:java}
public static int compare(long x, long y) {
    return (x < y) ? -1 : ((x == y) ? 0 : 1);
}
{code}


was (Author: laurentgo):
The Long.compareTo() is slightly different as it's not doing any substraction:

```
public static int compare(long x, long y) {
    return (x < y) ? -1 : ((x == y) ? 0 : 1);
}
```

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