hnwyllmm opened a new issue, #729:
URL: https://github.com/apache/arrow-java/issues/729

   ### 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:
   
   ```java
   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);
      }
    }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to