Volodymyr Vysotskyi created PARQUET-1417:
--------------------------------------------
Summary: BINARY_AS_SIGNED_INTEGER_COMPARATOR fails with IOBE for
the same arrays with the different length
Key: PARQUET-1417
URL: https://issues.apache.org/jira/browse/PARQUET-1417
Project: Parquet
Issue Type: Bug
Reporter: Volodymyr Vysotskyi
{{BINARY_AS_SIGNED_INTEGER_COMPARATOR}} fails when the same byte arrays but
with the different number leading zeros are compared:
{code:java}
BINARY_AS_SIGNED_INTEGER_COMPARATOR.compare(
Binary.fromConstantByteBuffer(ByteBuffer.wrap(new byte[] { 0, 0, -108
})),
Binary.fromConstantByteBuffer(ByteBuffer.wrap(new byte[] { 0, -108 })));
{code}
Error is:
{noformat}
java.lang.IndexOutOfBoundsException
at java.nio.Buffer.checkIndex(Buffer.java:540)
at java.nio.HeapByteBuffer.get(HeapByteBuffer.java:139)
at
org.apache.parquet.schema.PrimitiveComparator$9.compare(PrimitiveComparator.java:280)
at
org.apache.parquet.schema.PrimitiveComparator$9.compare(PrimitiveComparator.java:262)
at
org.apache.parquet.schema.PrimitiveComparator$BinaryComparator.compareNotNulls(PrimitiveComparator.java:186)
at
org.apache.parquet.schema.PrimitiveComparator$BinaryComparator.compareNotNulls(PrimitiveComparator.java:183)
at
org.apache.parquet.schema.PrimitiveComparator.compare(PrimitiveComparator.java:63)
{noformat}
The problem is that {{BINARY_AS_SIGNED_INTEGER_COMPARATOR.compare(ByteBuffer
b1, ByteBuffer b2)}} method passes the length of the first {{ByteBuffer}}, but
it should pass the less length since padding was calculated and passed for the
{{ByteBuffer}} with greater length to the {{compare(int length, ByteBuffer b1,
int p1, ByteBuffer b2, int p2)}} method.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)