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 --git 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
index b1e2537..a029c37 100644
--- 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 @@ public class BinaryConsumerTest extends AbstractConsumerTest {
nullable,
binaryConsumer -> {
for (byte[] value : values) {
- binaryConsumer.consume(new ByteArrayInputStream(value));
+ if (value != null) {
+ binaryConsumer.consume(new ByteArrayInputStream(value));
+ }
binaryConsumer.moveWriterPosition();
}
},
values);
+
}
@Test
@@ -119,5 +122,15 @@ public class BinaryConsumerTest extends AbstractConsumerTest {
testRecords[i] = createBytes(DEFAULT_RECORD_BYTE_COUNT);
}
testConsumeInputStream(testRecords, false);
+
+ byte[] bytes1 = new byte[] {1,2,3};
+ byte[] bytes2 = new byte[] {4,5,6};
+ testConsumeInputStream(
+ new byte[][] {
+ 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: