kszucs commented on a change in pull request #7783:
URL: https://github.com/apache/arrow/pull/7783#discussion_r455741659
##########
File path: python/pyarrow/tests/test_compute.py
##########
@@ -284,6 +284,66 @@ def test_take_indices_types():
arr.take(indices)
+def test_take_on_chunked_array():
+ # ARROW-9504
+ arr = pa.chunked_array([
+ [
+ "m",
+ "J",
+ "q",
+ "k",
+ "t"
+ ],
+ [
+ "m",
+ "J",
+ "q",
+ "k",
+ "t"
+ ]
+ ])
+
+ indices = np.array([0, 5, 1, 6, 2, 7, 3, 8, 4, 9])
+ result = arr.take(indices)
+ expected = pa.chunked_array([
+ "m",
+ "m",
+ "J",
+ "J",
+ "q",
+ "q",
+ "k",
+ "k",
+ "t"
+ "t"
+ ])
+ assert result.equals(expected)
+
+ indices = pa.chunked_array([[1], [1, 2]])
+ result = arr.take(indices)
+ expected = pa.chunked_array([
+ [
+ "J"
+ ],
+ [
+ "J",
+ "q"
+ ]
+ ])
+ assert result.equals(expected)
Review comment:
The chunking of the output array depends on the indices.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]