Neuw84 commented on code in PR #17296:
URL: https://github.com/apache/iceberg/pull/17296#discussion_r3665287343
##########
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/VectorizedArrowReader.java:
##########
@@ -882,12 +921,47 @@ public void setBatchSize(int batchSize) {
this.nulls = newNullabilityHolder(batchSize);
}
+ // release the result vector when the batch grows, so the next read
allocates a vector that
+ // fits the new batch size
+ if (vec != null && vec.getValueCapacity() < batchSize) {
+ vec.close();
+ this.vec = null;
+ }
+
+ this.resultBatchSize = (batchSize == 0) ? DEFAULT_BATCH_SIZE : batchSize;
Review Comment:
For context on where the pattern comes from:
PositionVectorReader.setBatchSize has the same ordering (holder sized from the
argument, batchSize resolved afterwards), and the parent
VectorizedArrowReader.setBatchSize resolves the value but sizes
NullabilityHolder from the resolved field only later in read. Happy to clean up
PositionVectorReader in this PR too if you want it consistent, or leave it for
a follow-up since it is unrelated to the leak.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]