lidavidm commented on code in PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#discussion_r936846099


##########
java/source/create.rst:
##########
@@ -187,4 +187,40 @@ Array of List
 
 .. _`FieldVector`: 
https://arrow.apache.org/docs/java/reference/org/apache/arrow/vector/FieldVector.html
 .. _`ValueVector`: https://arrow.apache.org/docs/java/vector.html
-.. _`dictionary-encoding`: 
https://arrow.apache.org/docs/format/Columnar.html#dictionary-encoded-layout
\ No newline at end of file
+.. _`dictionary-encoding`: 
https://arrow.apache.org/docs/format/Columnar.html#dictionary-encoded-layout
+
+Splicing
+========
+
+Splicing provides a way of copying complete or partial data between same types 
of Vectors

Review Comment:
   ```suggestion
   Splicing provides a way of copying a range of rows between two vectors of 
the same type.
   ```



##########
java/source/create.rst:
##########
@@ -187,4 +187,40 @@ Array of List
 
 .. _`FieldVector`: 
https://arrow.apache.org/docs/java/reference/org/apache/arrow/vector/FieldVector.html
 .. _`ValueVector`: https://arrow.apache.org/docs/java/vector.html
-.. _`dictionary-encoding`: 
https://arrow.apache.org/docs/format/Columnar.html#dictionary-encoded-layout
\ No newline at end of file
+.. _`dictionary-encoding`: 
https://arrow.apache.org/docs/format/Columnar.html#dictionary-encoded-layout
+
+Splicing
+========
+
+Splicing provides a way of copying complete or partial data between same types 
of Vectors
+
+Splicing IntVector
+------------------
+
+In this example, we want to copy a portion of input Vector to a new Vector.
+
+.. testcode::
+
+    import org.apache.arrow.memory.BufferAllocator;
+    import org.apache.arrow.memory.RootAllocator;
+    import org.apache.arrow.vector.IntVector;
+    import org.apache.arrow.vector.util.TransferPair;
+
+
+    try (BufferAllocator allocator = new RootAllocator();
+             IntVector vector = new IntVector("intVector", allocator);) {
+            for (int i = 0; i < 10; i++) {
+                vector.setSafe(i, i);
+            }
+            vector.setValueCount(10);
+
+            TransferPair tp = vector.getTransferPair(allocator);
+            tp.splitAndTransfer(0, 5);
+            IntVector sliced = (IntVector) tp.getTo();
+            System.out.print(sliced);
+            sliced.clear();
+        }

Review Comment:
   Maybe show slicing from a non-zero index?



##########
java/source/create.rst:
##########
@@ -187,4 +187,40 @@ Array of List
 
 .. _`FieldVector`: 
https://arrow.apache.org/docs/java/reference/org/apache/arrow/vector/FieldVector.html
 .. _`ValueVector`: https://arrow.apache.org/docs/java/vector.html
-.. _`dictionary-encoding`: 
https://arrow.apache.org/docs/format/Columnar.html#dictionary-encoded-layout
\ No newline at end of file
+.. _`dictionary-encoding`: 
https://arrow.apache.org/docs/format/Columnar.html#dictionary-encoded-layout
+
+Splicing
+========
+
+Splicing provides a way of copying complete or partial data between same types 
of Vectors
+
+Splicing IntVector
+------------------
+
+In this example, we want to copy a portion of input Vector to a new Vector.

Review Comment:
   ```suggestion
   In this example, we copy a portion of the input IntVector to a new IntVector.
   ```



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