You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@arrow.apache.org by Martin Janda <ja...@crcdata.cz> on 2020/04/09 16:57:53 UTC

Java: DefaultVectorComparators - invalid implementation

I made first look to Apache Arrow Java sources.

I found wrong implementation for DefaultVectorComparators.LongComparator 
I suppose that other comparators can be wrong too.

Simple test:

long l1=Long.MIN_VALUE +1L;
long l2=Long.MAX_VALUE;

System.out.println("Arrow: " + Long.signum(l1 - l2)); // actual arrow code
System.out.println("Java : " + Long.compare(l1, l2));

Result:
Arrow: 1
Java : -1

I think that there should be added tests for corner cases. And I suggest to replace arrow implementation with Long.compare, Integer.compare...
  that provides correct results.
   Thank you
    Martin

PS I have no access to JIRA to report this issue.


Re: Java: DefaultVectorComparators - invalid implementation

Posted by Micah Kornfield <em...@gmail.com>.
Hi Martin,
Yes this does appear incorrect, and I expect other integer implementations
probably have similar issues.

You should be able to sign up for an account on JIRA with a valid e-mail
address and then file an issue in the Arrow project.

Thanks,
Micah

On Thu, Apr 9, 2020 at 9:58 AM Martin Janda <ja...@crcdata.cz> wrote:

> I made first look to Apache Arrow Java sources.
>
> I found wrong implementation for DefaultVectorComparators.LongComparator I
> suppose that other comparators can be wrong too.
>
> Simple test:
>
> long l1=Long.MIN_VALUE + 1L;long l2=Long.MAX_VALUE;
>
> System.out.println("Arrow: " + Long.signum(l1 - l2)); // actual arrow code
> System.out.println("Java : " + Long.compare(l1, l2));
>
> Result:
> Arrow: 1
> Java : -1
>
> I think that there should be added tests for corner cases. And I suggest to replace arrow implementation with Long.compare, Integer.compare...
>  that provides correct results.
>   Thank you
>    Martin
>
> PS I have no access to JIRA to report this issue.
>
>
>