liyafan82 commented on a change in pull request #10114:
URL: https://github.com/apache/arrow/pull/10114#discussion_r769610987



##########
File path: 
java/dataset/src/test/java/org/apache/arrow/dataset/file/TestFileSystemDataset.java
##########
@@ -295,6 +326,39 @@ public void testMemoryAllocationOnAssociatedAllocator() 
throws Exception {
     Assert.assertEquals(-expected_diff, finalReservation - reservation);
   }
 
+  private void checkParquetReadResult(Schema schema, String expectedJson, 
List<ArrowRecordBatch> actual)
+      throws IOException {
+    final ObjectMapper json = new ObjectMapper();
+    final Set<?> expectedSet = json.readValue(expectedJson, Set.class);
+    final Set<List<Object>> actualSet = new HashSet<>();
+    final int fieldCount = schema.getFields().size();
+    try (VectorSchemaRoot vsr = VectorSchemaRoot.create(schema, 
rootAllocator())) {
+      VectorLoader loader = new VectorLoader(vsr);
+      for (ArrowRecordBatch batch : actual) {
+        try {
+          loader.load(batch);
+          int batchRowCount = vsr.getRowCount();
+          for (int i = 0; i < batchRowCount; i++) {
+            List<Object> row = new ArrayList<>();
+            for (int j = 0; j < fieldCount; j++) {
+              Object object = vsr.getVector(j).getObject(i);
+              if (Primitives.isWrapperType(object.getClass())) {
+                row.add(object);
+              } else {
+                row.add(object.toString());
+              }
+            }
+            actualSet.add(row);
+          }
+        } finally {
+          batch.close();

Review comment:
       It seems the batch is closed here, and in the caller. So it is closed 
twice?




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