lidavidm commented on code in PR #318:
URL: https://github.com/apache/arrow-cookbook/pull/318#discussion_r1300419197
##########
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:
I think it would be clearer if we just constructed the vectors in-memory
instead of having to pull in dataset for this
--
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]