tom-s-powell commented on a change in pull request #12692:
URL: https://github.com/apache/arrow/pull/12692#discussion_r832378685



##########
File path: 
java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/consumer/ArrayConsumer.java
##########
@@ -64,6 +63,14 @@ public void close() throws Exception {
     this.delegate.close();
   }
 
+  @Override
+  public void resetValueVector(ListVector vector) {
+    super.resetValueVector(vector);
+
+    FieldVector childVector = vector.getDataVector();

Review comment:
       When `VectorSchemaRoot` is reused in `ArrowVectorIterator`, we currently 
hit the issue that the `currentIndex` here is reset to `0` but is never updated 
in the delegate consumer. As such, subsequent iterations will result in `null` 
array values because the `ListVector` (and data vector) is reset 
https://github.com/apache/arrow/pull/12692/files#diff-f812c76a565e7c56500943f512b8498487209b15ed036d404d703854841df3d0R150.
 
   
   For example, if you have a batch size of 2 and a `ResultSet` with 4 rows, 
the second iteration will be writing values into index 0 and 1 in the 
`ListVector` but the offsets for those in the data vector will be pointing at 
null values (because it was reset) and the values written to the data vector 
will be at larger indexes.




-- 
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