You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/03 00:13:19 UTC
[GitHub] [arrow-cookbook] mystic-lama opened a new pull request, #237: [Java]Add splicing example
mystic-lama opened a new pull request, #237:
URL: https://github.com/apache/arrow-cookbook/pull/237
Added an example to show splicing on 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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] davisusanibar commented on a diff in pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
davisusanibar commented on code in PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#discussion_r936840214
##########
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
Review Comment:
Only by readability could be possible to move these lines to end of file
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] davisusanibar commented on a diff in pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
davisusanibar commented on code in PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#discussion_r936837001
##########
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:
```suggestion
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);
try (IntVector sliced = (IntVector) tp.getTo()) {
System.out.print(sliced);
}
}
```
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] lidavidm commented on a diff in pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
lidavidm commented on code in PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#discussion_r937029482
##########
java/source/create.rst:
##########
@@ -185,6 +185,43 @@ Array of List
[[1,2,3], [10,20,30], [100,200,300], [1000,2000,3000]]
+
+Splicing
+========
+
+Splicing provides a way of copying a range of rows between two vectors of the same type.
+
+Splicing IntVector
+------------------
+
+In this example, we copy a portion of the input IntVector to a new IntVector.
+
+.. testcode::
+
+ import org.apache.arrow.memory.BufferAllocator;
Review Comment:
Just one thing: everything here is indented by one space too many I think (it should line up). Same with the output below
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] mystic-lama commented on a diff in pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
mystic-lama commented on code in PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#discussion_r936909720
##########
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
Review Comment:
updated
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] mystic-lama commented on a diff in pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
mystic-lama commented on code in PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#discussion_r937860039
##########
java/source/create.rst:
##########
@@ -185,6 +185,43 @@ Array of List
[[1,2,3], [10,20,30], [100,200,300], [1000,2000,3000]]
+
+Splicing
+========
+
+Splicing provides a way of copying a range of rows between two vectors of the same type.
+
+Splicing IntVector
+------------------
+
+In this example, we copy a portion of the input IntVector to a new IntVector.
+
+.. testcode::
+
+ import org.apache.arrow.memory.BufferAllocator;
Review Comment:
Done, hopefully it shall be correct this time.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] lidavidm commented on a diff in pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
lidavidm commented on code in PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#discussion_r937751431
##########
java/source/create.rst:
##########
@@ -185,6 +185,43 @@ Array of List
[[1,2,3], [10,20,30], [100,200,300], [1000,2000,3000]]
+
+Splicing
+========
+
+Splicing provides a way of copying a range of rows between two vectors of the same type.
+
+Splicing IntVector
+------------------
+
+In this example, we copy a portion of the input IntVector to a new IntVector.
+
+.. testcode::
+
+ import org.apache.arrow.memory.BufferAllocator;
Review Comment:
The other PR is now merged
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] mystic-lama commented on a diff in pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
mystic-lama commented on code in PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#discussion_r936877052
##########
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
Review Comment:
Sure thing, let me move them to end and update the PR. Thanks
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] mystic-lama commented on a diff in pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] davisusanibar commented on pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
davisusanibar commented on PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#issuecomment-1204146880
Thank you @mystic-lama for your support
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] lidavidm commented on a diff in pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] mystic-lama commented on a diff in pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
mystic-lama commented on code in PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237#discussion_r937246659
##########
java/source/create.rst:
##########
@@ -185,6 +185,43 @@ Array of List
[[1,2,3], [10,20,30], [100,200,300], [1000,2000,3000]]
+
+Splicing
+========
+
+Splicing provides a way of copying a range of rows between two vectors of the same type.
+
+Splicing IntVector
+------------------
+
+In this example, we copy a portion of the input IntVector to a new IntVector.
+
+.. testcode::
+
+ import org.apache.arrow.memory.BufferAllocator;
Review Comment:
There is similar comment on other PR, shall fix this once the other is fixed as expected :)
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-cookbook] lidavidm merged pull request #237: [Java] Added splicing example for IntVector
Posted by GitBox <gi...@apache.org>.
lidavidm merged PR #237:
URL: https://github.com/apache/arrow-cookbook/pull/237
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org