tom-s-powell commented on a change in pull request #12692: URL: https://github.com/apache/arrow/pull/12692#discussion_r832372322
########## File path: 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) { + for (int i = 1; i <= consumers.length; i++) { + ArrowType arrowType = config.getJdbcToArrowTypeConverter() + .apply(new JdbcFieldInfo(resultSet.getMetaData(), i)); + consumers[i - 1] = JdbcToArrowUtils.getConsumer( Review comment: Because `ArrayConsumer` requires a `FieldVector` to be passed, I've opted for lazily initialising the consumers after the first `VectorSchemaRoot` is created. https://github.com/apache/arrow/pull/12692/files#diff-f812c76a565e7c56500943f512b8498487209b15ed036d404d703854841df3d0R152 will update the vector in the consumer on subsequent iterations. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org