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

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Two problems in the `consume()` methods of `ClobConsumer` (JDBC adapter), in 
both `NullableClobConsumer` and `NonNullableClobConsumer`, found while 
reviewing #1231:
   
   - A NULL row (`wasNull()`, or `getClob()` returning `null`) doesn't write 
its end offset. The next value reads its start offset from that unwritten slot, 
which is `0`, so it is written at the start of the data buffer, over the 
earlier values. Rows `"AAAA", NULL, "BB"` read back as `"BBAA", NULL, "BB"`, 
and `ValueVectorUtility.validateFull()` fails with `The values in positions 2 
and 3 of the offset buffer are decreasing: 4, 0.` The H2 test with NULL rows 
doesn't catch it because its two CLOB values are identical.
   - The consumers write the offset and validity bit at `currentIndex` without 
growing the validity and offset buffers first, as `BinaryConsumer` does. 
Consuming more rows than the value capacity of the vector (3970 by default) 
fails with `IndexOutOfBoundsException: index: 15880, length: 4 (expected: 
range(0, 15880))`. `ArrowVectorIterator` sizes the vectors for the batch 
beforehand, but `JdbcToArrowUtils.jdbcToArrowVectors()` with a target batch 
size doesn't.
   
   Both problems predate #1231. Expected: the values after a NULL row are 
written after the previous value, and the buffers grow with the row count.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to