mystic-lama commented on code in PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#discussion_r936857718


##########
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:
   @lidavidm more examples coming



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