vibhatha commented on code in PR #43053:
URL: https://github.com/apache/arrow/pull/43053#discussion_r1690678436
##########
java/c/src/main/java/org/apache/arrow/c/BufferImportTypeVisitor.java:
##########
@@ -116,7 +119,7 @@ private ArrowBuf importFixedBytes(ArrowType type, int
index, long bytesPerSlot)
}
private ArrowBuf importOffsets(ArrowType type, long bytesPerSlot) {
- final long capacity = bytesPerSlot * (fieldNode.getLength() + 1);
+ final long capacity = bytesPerSlot * (fieldNode.getLength() +
arrowArrayOffset + 1);
Review Comment:
Oh wait, this is needed because this fails the `integration_tests.py`
```bash
======================================================================
ERROR: test_binary_slice_array (__main__.TestPythonIntegration)
----------------------------------------------------------------------
Traceback (most recent call last):
File "Data.java", line 319, in org.apache.arrow.c.Data.importVector
java.lang.java.lang.IndexOutOfBoundsException:
java.lang.IndexOutOfBoundsException: index (24) must not be greater than size
(16)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "Data.java", line 319, in org.apache.arrow.c.Data.importVector
Exception: Java Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "integration_tests.py", line 202, in test_binary_slice_array
self.round_trip_array(lambda: sliced_array)
File "integration_tests.py", line 160, in round_trip_array
self.bridge.python_to_java_array(original_arr, dictionary_provider) as
vector:
File "integration_tests.py", line 111, in python_to_java_array
return self.java_c.Data.importVector(self.java_allocator, c_array,
c_schema, dictionary_provider)
java.lang.java.lang.IllegalArgumentException:
java.lang.IllegalArgumentException: Could not load buffers for field : Binary.
error message: index (24) must not be greater than size (16)
======================================================================
ERROR: test_string_slice_array (__main__.TestPythonIntegration)
----------------------------------------------------------------------
Traceback (most recent call last):
File "Data.java", line 319, in org.apache.arrow.c.Data.importVector
java.lang.java.lang.IndexOutOfBoundsException:
java.lang.IndexOutOfBoundsException: index (24) must not be greater than size
(16)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "Data.java", line 319, in org.apache.arrow.c.Data.importVector
Exception: Java Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "integration_tests.py", line 196, in test_string_slice_array
self.round_trip_array(lambda: sliced_array)
File "integration_tests.py", line 160, in round_trip_array
self.bridge.python_to_java_array(original_arr, dictionary_provider) as
vector:
File "integration_tests.py", line 111, in python_to_java_array
return self.java_c.Data.importVector(self.java_allocator, c_array,
c_schema, dictionary_provider)
java.lang.java.lang.IllegalArgumentException:
java.lang.IllegalArgumentException: Could not load buffers for field : Utf8.
error message: index (24) must not be greater than size (16)
```
--
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]