Neuw84 commented on code in PR #17296:
URL: https://github.com/apache/iceberg/pull/17296#discussion_r3665029773


##########
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/VectorizedArrowReader.java:
##########
@@ -818,9 +819,37 @@ public void setBatchSize(int batchSize) {
       posReader.setBatchSize(batchSize);
     }
 
+    /**
+     * Returns the vector this batch is written into, which the reader owns 
and closes.
+     *
+     * <p>{@code reuse} is used the same way the parent reader uses it: a null 
holder means the
+     * caller does not want the previous vector reused, so it is released and 
reallocated. A
+     * non-null holder allows keeping the current vector, which is reallocated 
only when the batch
+     * no longer fits.
+     */
+    private BigIntVector resultVector(VectorHolder reuse, int numValsToRead) {
+      if (reuse == null || vec == null || vec.getValueCapacity() < 
numValsToRead) {
+        if (vec != null) {
+          vec.close();
+        }
+
+        this.vec = allocateBigIntVector(ROW_ID_ARROW_FIELD, numValsToRead);

Review Comment:
   Fixed on the latest push. However, note that we added a new field. 
   
   Both readers now track the batch size in `setBatchSize` (with the same
   `DEFAULT_BATCH_SIZE` fallback the parent uses) and allocate the result 
vector for a full batch, so
   `resultVector` no longer compares capacities. Growing the batch size 
releases the undersized vector
   so the next read allocates one that fits, which keeps 
`setRowGroupInfo`/`setBatchSize` reuse safe.
   



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

Reply via email to