You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "davisusanibar (via GitHub)" <gi...@apache.org> on 2023/08/28 22:23:36 UTC

[GitHub] [arrow-cookbook] davisusanibar commented on a diff in pull request #318: GH-317: [Java] add recipe for vector schema root appender cases

davisusanibar commented on code in PR #318:
URL: https://github.com/apache/arrow-cookbook/pull/318#discussion_r1308015755


##########
java/source/data.rst:
##########
@@ -23,6 +23,85 @@ Recipes related to compare, filtering or transforming data.
 
 .. contents::
 
+Append VectorSchemaRoots
+========================
+
+In some cases, VectorSchemaRoot needs to be modeled as a container. To accomplish
+this, you can use ``VectorSchemaRootAppender.append``. The following code reads a
+Parquet file with three row groups, gets the three vectors separately, and then
+appends the three vectors together:
+
+.. testcode::
+
+    import java.io.IOException;
+
+    import org.apache.arrow.dataset.file.FileFormat;
+    import org.apache.arrow.dataset.file.FileSystemDatasetFactory;
+    import org.apache.arrow.dataset.jni.NativeMemoryPool;
+    import org.apache.arrow.dataset.scanner.ScanOptions;
+    import org.apache.arrow.dataset.scanner.Scanner;
+    import org.apache.arrow.dataset.source.Dataset;
+    import org.apache.arrow.dataset.source.DatasetFactory;
+    import org.apache.arrow.memory.BufferAllocator;
+    import org.apache.arrow.memory.RootAllocator;
+    import org.apache.arrow.vector.VectorSchemaRoot;
+    import org.apache.arrow.vector.ipc.ArrowReader;
+    import org.apache.arrow.vector.util.VectorSchemaRootAppender;
+
+    VectorSchemaRoot appendVectorSchemaRootAsOne(BufferAllocator allocator) {

Review Comment:
   Changed



-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org