davisusanibar commented on a change in pull request #131:
URL: https://github.com/apache/arrow-cookbook/pull/131#discussion_r797979566



##########
File path: java/source/create.rst
##########
@@ -30,8 +30,128 @@ Array of Int (32-bit integer value)
    intVector.set(2, 3);
    intVector.setValueCount(3);
 
-   System.out.println(intVector);
+   System.out.print(intVector);
 
 .. testoutput::
 
-    [1, 2, 3]
\ No newline at end of file
+    [1, 2, 3]
+
+
+Array of Varchar
+----------------
+
+.. testcode::
+
+    import org.apache.arrow.vector.VarCharVector;
+    import org.apache.arrow.memory.RootAllocator;
+
+    RootAllocator rootAllocator = new RootAllocator(Long.MAX_VALUE);
+
+    VarCharVector varVector = new VarCharVector("varVector", rootAllocator);
+    varVector.allocateNew(3);
+    varVector.set(0, "one".getBytes());
+    varVector.set(1, "two".getBytes());
+    varVector.set(2, "three".getBytes());
+    varVector.setValueCount(3);
+
+    System.out.print(varVector);
+
+.. testoutput::
+
+    [one, two, three]
+
+Array of List
+-------------
+
+.. testcode::
+
+    import org.apache.arrow.memory.RootAllocator;
+    import org.apache.arrow.vector.complex.impl.UnionListWriter;
+    import org.apache.arrow.vector.types.Types.MinorType;
+    import org.apache.arrow.vector.types.pojo.FieldType;
+    import org.apache.arrow.vector.complex.ListVector;
+
+    RootAllocator rootAllocator = new RootAllocator(Long.MAX_VALUE);
+
+    ListVector listVector = ListVector.empty("listVector", rootAllocator);
+    listVector.allocateNew();
+    MinorType type = MinorType.INT;
+    listVector.addOrGetVector(FieldType.nullable(type.getType()));
+    UnionListWriter listWriter = listVector.getWriter();
+    listWriter.allocate();

Review comment:
       Deleted

##########
File path: java/source/create.rst
##########
@@ -30,8 +30,128 @@ Array of Int (32-bit integer value)
    intVector.set(2, 3);
    intVector.setValueCount(3);
 
-   System.out.println(intVector);
+   System.out.print(intVector);
 
 .. testoutput::
 
-    [1, 2, 3]
\ No newline at end of file
+    [1, 2, 3]
+
+
+Array of Varchar
+----------------
+
+.. testcode::
+
+    import org.apache.arrow.vector.VarCharVector;
+    import org.apache.arrow.memory.RootAllocator;
+
+    RootAllocator rootAllocator = new RootAllocator(Long.MAX_VALUE);
+
+    VarCharVector varVector = new VarCharVector("varVector", rootAllocator);
+    varVector.allocateNew(3);
+    varVector.set(0, "one".getBytes());
+    varVector.set(1, "two".getBytes());
+    varVector.set(2, "three".getBytes());
+    varVector.setValueCount(3);
+
+    System.out.print(varVector);
+
+.. testoutput::
+
+    [one, two, three]
+
+Array of List
+-------------
+
+.. testcode::
+
+    import org.apache.arrow.memory.RootAllocator;
+    import org.apache.arrow.vector.complex.impl.UnionListWriter;
+    import org.apache.arrow.vector.types.Types.MinorType;
+    import org.apache.arrow.vector.types.pojo.FieldType;
+    import org.apache.arrow.vector.complex.ListVector;
+
+    RootAllocator rootAllocator = new RootAllocator(Long.MAX_VALUE);
+
+    ListVector listVector = ListVector.empty("listVector", rootAllocator);
+    listVector.allocateNew();
+    MinorType type = MinorType.INT;
+    listVector.addOrGetVector(FieldType.nullable(type.getType()));
+    UnionListWriter listWriter = listVector.getWriter();
+    listWriter.allocate();
+    listWriter.setPosition(0);
+    listWriter.startList();
+    listWriter.bigInt().writeBigInt(1);
+    listWriter.bigInt().writeBigInt(2);
+    listWriter.bigInt().writeBigInt(3);
+    listWriter.endList();
+    listWriter.setPosition(1);
+    listWriter.startList();
+    listWriter.bigInt().writeBigInt(9);
+    listWriter.bigInt().writeBigInt(8);
+    listWriter.endList();
+    listWriter.setPosition(2);
+    listWriter.startList();
+    listWriter.bigInt().writeBigInt(10);
+    listWriter.bigInt().writeBigInt(20);
+    listWriter.bigInt().writeBigInt(30);
+    listWriter.endList();

Review comment:
       Changed

##########
File path: java/source/create.rst
##########
@@ -30,8 +30,128 @@ Array of Int (32-bit integer value)
    intVector.set(2, 3);
    intVector.setValueCount(3);
 
-   System.out.println(intVector);
+   System.out.print(intVector);
 
 .. testoutput::
 
-    [1, 2, 3]
\ No newline at end of file
+    [1, 2, 3]
+
+
+Array of Varchar
+----------------
+
+.. testcode::
+
+    import org.apache.arrow.vector.VarCharVector;
+    import org.apache.arrow.memory.RootAllocator;
+
+    RootAllocator rootAllocator = new RootAllocator(Long.MAX_VALUE);
+
+    VarCharVector varVector = new VarCharVector("varVector", rootAllocator);
+    varVector.allocateNew(3);
+    varVector.set(0, "one".getBytes());
+    varVector.set(1, "two".getBytes());
+    varVector.set(2, "three".getBytes());
+    varVector.setValueCount(3);
+
+    System.out.print(varVector);
+
+.. testoutput::
+
+    [one, two, three]
+
+Array of List
+-------------
+
+.. testcode::
+
+    import org.apache.arrow.memory.RootAllocator;
+    import org.apache.arrow.vector.complex.impl.UnionListWriter;
+    import org.apache.arrow.vector.types.Types.MinorType;
+    import org.apache.arrow.vector.types.pojo.FieldType;
+    import org.apache.arrow.vector.complex.ListVector;
+
+    RootAllocator rootAllocator = new RootAllocator(Long.MAX_VALUE);
+
+    ListVector listVector = ListVector.empty("listVector", rootAllocator);
+    listVector.allocateNew();
+    MinorType type = MinorType.INT;
+    listVector.addOrGetVector(FieldType.nullable(type.getType()));
+    UnionListWriter listWriter = listVector.getWriter();
+    listWriter.allocate();
+    listWriter.setPosition(0);
+    listWriter.startList();
+    listWriter.bigInt().writeBigInt(1);
+    listWriter.bigInt().writeBigInt(2);
+    listWriter.bigInt().writeBigInt(3);
+    listWriter.endList();
+    listWriter.setPosition(1);
+    listWriter.startList();
+    listWriter.bigInt().writeBigInt(9);
+    listWriter.bigInt().writeBigInt(8);
+    listWriter.endList();
+    listWriter.setPosition(2);
+    listWriter.startList();
+    listWriter.bigInt().writeBigInt(10);
+    listWriter.bigInt().writeBigInt(20);
+    listWriter.bigInt().writeBigInt(30);
+    listWriter.endList();
+    listVector.setValueCount(4);

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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to