chenjunjiedada commented on a change in pull request #1356:
URL: https://github.com/apache/iceberg/pull/1356#discussion_r497229622



##########
File path: 
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/VectorizedArrowReader.java
##########
@@ -354,6 +360,47 @@ public void setBatchSize(int batchSize) {
     }
   }
 
+  private static final class PositionVectorReader extends 
VectorizedArrowReader {
+    private long rowStart;
+    private NullabilityHolder nulls;
+
+    @Override
+    public VectorHolder read(VectorHolder reuse, int numValsToRead) {
+      Field arrowField = ArrowSchemaUtil.convert(MetadataColumns.ROW_POSITION);
+      FieldVector vec = 
arrowField.createVector(ArrowAllocation.rootAllocator());
+
+      if (reuse != null) {
+        vec.setValueCount(0);
+        nulls.reset();
+      } else {
+        ((BigIntVector) vec).allocateNew(numValsToRead);
+        for (int i = 0; i < numValsToRead; i += 1) {
+          vec.getDataBuffer().setLong(i * Long.BYTES, rowStart + i);
+          nulls = new NullabilityHolder(numValsToRead);

Review comment:
       Thanks @holdenk, This is a problem. Let me move this out of the loop.




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

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