davisusanibar commented on code in PR #183:
URL: https://github.com/apache/arrow-cookbook/pull/183#discussion_r848643681
##########
java/source/io.rst:
##########
@@ -33,30 +34,34 @@ Write - Out to File
import org.apache.arrow.vector.VectorSchemaRoot;
import static java.util.Arrays.asList;
import org.apache.arrow.vector.ipc.ArrowFileWriter;
-
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
- try (RootAllocator rootAllocator = new RootAllocator(Long.MAX_VALUE)) {
+ try (
+ BufferAllocator allocator = new RootAllocator()
+ ) {
Field name = new Field("name", FieldType.nullable(new
ArrowType.Utf8()), null);
Field age = new Field("age", FieldType.nullable(new ArrowType.Int(32,
true)), null);
Schema schemaPerson = new Schema(asList(name, age));
- try(VectorSchemaRoot vectorSchemaRoot =
VectorSchemaRoot.create(schemaPerson, rootAllocator)){
+ try(
+ VectorSchemaRoot vectorSchemaRoot =
VectorSchemaRoot.create(schemaPerson, allocator);
VarCharVector nameVector = (VarCharVector)
vectorSchemaRoot.getVector("name");
+ IntVector ageVector = (IntVector) vectorSchemaRoot.getVector("age")
Review Comment:
Oh, thanks, changed
##########
java/source/io.rst:
##########
@@ -87,33 +93,39 @@ Write - Out to Buffer
import org.apache.arrow.vector.VectorSchemaRoot;
import static java.util.Arrays.asList;
import org.apache.arrow.vector.ipc.ArrowFileWriter;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.channels.Channels;
- try (RootAllocator rootAllocator = new RootAllocator(Long.MAX_VALUE)) {
+ try (
+ BufferAllocator allocator = new RootAllocator()
+ ) {
Review Comment:
Deleted
--
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]