tom-s-powell commented on code in PR #12692:
URL: https://github.com/apache/arrow/pull/12692#discussion_r880434958


##########
java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/ArrowVectorIterator.java:
##########
@@ -134,11 +122,26 @@ private VectorSchemaRoot createVectorSchemaRoot() {
       }
       throw new RuntimeException("Error occurred while creating schema root.", 
e);
     }
+
+    // ensure consumers have been initialized
+    ensureInitialized(root);
     return root;
   }
 
+  private void ensureInitialized(VectorSchemaRoot root) throws SQLException {
+    if (!initialized) {

Review Comment:
   Actually, it's fine as its currently written. After creating a new 
`VectorSchemaRoot` we'll call `load` and this will call 
`JdbcConsumer#resetValueVector` passing the vectors of the _new_ 
`VectorSchemaRoot` and obtaining a reference to them 
(https://github.com/apache/arrow/pull/12692/files#diff-f812c76a565e7c56500943f512b8498487209b15ed036d404d703854841df3d0R161).
 This will happen before we consume data. 



##########
java/adapter/jdbc/src/main/java/org/apache/arrow/adapter/jdbc/ArrowVectorIterator.java:
##########
@@ -134,11 +122,26 @@ private VectorSchemaRoot createVectorSchemaRoot() {
       }
       throw new RuntimeException("Error occurred while creating schema root.", 
e);
     }
+
+    // ensure consumers have been initialized
+    ensureInitialized(root);
     return root;
   }
 
+  private void ensureInitialized(VectorSchemaRoot root) throws SQLException {
+    if (!initialized) {

Review Comment:
   ~~Ah yes good point!~~



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