Describe the bug, including details regarding any error messages, version, and platform.
BinaryConsumer doesn't set the offsetBuffer appropriate if the InputStream is null.
Below is the BinaryConsumerTest.java patch to reproduce the bug:
diff --gita/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/consumer/BinaryConsumerTest.javab/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/consumer/BinaryConsumerTest.javaindexb1e2537..a029c37100644
--- a/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/consumer/BinaryConsumerTest.java
+++ b/adapter/jdbc/src/test/java/org/apache/arrow/adapter/jdbc/consumer/BinaryConsumerTest.java@@ -65,11 +65,14@@publicclassBinaryConsumerTestextendsAbstractConsumerTest {
nullable,
binaryConsumer -> {
for (byte[] value : values) {
- binaryConsumer.consume(newByteArrayInputStream(value));
+ if (value != null) {
+ binaryConsumer.consume(newByteArrayInputStream(value));
+ }
binaryConsumer.moveWriterPosition();
}
},
values);
+
}
@Test@@ -119,5 +122,15@@publicclassBinaryConsumerTestextendsAbstractConsumerTest {
testRecords[i] = createBytes(DEFAULT_RECORD_BYTE_COUNT);
}
testConsumeInputStream(testRecords, false);
+
+ byte[] bytes1 = newbyte[] {1,2,3};
+ byte[] bytes2 = newbyte[] {4,5,6};
+ testConsumeInputStream(
+ newbyte[][] {
+ bytes1,
+ null,
+ bytes2
+ },
+ true);
}
}
Describe the bug, including details regarding any error messages, version, and platform.
BinaryConsumerdoesn't set theoffsetBufferappropriate if theInputStreamis null.Below is the
BinaryConsumerTest.javapatch to reproduce the bug: