MCPcopy Create free account
hub / github.com/apache/arrow / test_jvm_array

Function test_jvm_array

python/pyarrow/tests/test_jvm.py:225–240  ·  view source on GitHub ↗
(root_allocator, pa_type, py_data, jvm_type)

Source from the content-addressed store, hash-verified

223 # TODO(ARROW-2606): pa.decimal128(19, 4)
224])
225def test_jvm_array(root_allocator, pa_type, py_data, jvm_type):
226 # Create vector
227 cls = f"org.apache.arrow.vector.{jvm_type}"
228 jvm_vector = jpype.JClass(cls)("vector", root_allocator)
229 jvm_vector.allocateNew(len(py_data))
230 for i, val in enumerate(py_data):
231 # char and int are ambiguous overloads for these two setSafe calls
232 if jvm_type in {'UInt1Vector', 'UInt2Vector'}:
233 val = jpype.JInt(val)
234 jvm_vector.setSafe(i, val)
235 jvm_vector.setValueCount(len(py_data))
236
237 py_array = pa.array(py_data, type=pa_type)
238 jvm_array = pa_jvm.array(jvm_vector)
239
240 assert py_array.equals(jvm_array)
241
242
243def test_jvm_array_empty(root_allocator):

Callers

nothing calls this directly

Calls 3

lenFunction · 0.85
equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected