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

Function array

python/pyarrow/jvm.py:283–310  ·  view source on GitHub ↗

Construct an (Python) Array from its JVM equivalent. Parameters ---------- jvm_array : org.apache.arrow.vector.ValueVector Returns ------- array : Array

(jvm_array)

Source from the content-addressed store, hash-verified

281
282
283def array(jvm_array):
284 """
285 Construct an (Python) Array from its JVM equivalent.
286
287 Parameters
288 ----------
289 jvm_array : org.apache.arrow.vector.ValueVector
290
291 Returns
292 -------
293 array : Array
294 """
295 if jvm_array.getField().getType().isComplex():
296 minor_type_str = jvm_array.getMinorType().toString()
297 raise NotImplementedError(
298 f"Cannot convert JVM Arrow array of type {minor_type_str}, "
299 "complex types not yet implemented.")
300 dtype = field(jvm_array.getField()).type
301 buffers = [jvm_buffer(buf)
302 for buf in list(jvm_array.getBuffers(False))]
303
304 # If JVM has an empty Vector, buffer list will be empty so create manually
305 if len(buffers) == 0:
306 return pa.array([], type=dtype)
307
308 length = jvm_array.getValueCount()
309 null_count = jvm_array.getNullCount()
310 return pa.Array.from_buffers(dtype, length, buffers, null_count)
311
312
313def record_batch(jvm_vector_schema_root):

Callers 3

_filter_tableFunction · 0.85
record_batchFunction · 0.85
device_typesMethod · 0.85

Calls 7

jvm_bufferFunction · 0.85
listFunction · 0.85
lenFunction · 0.85
fieldFunction · 0.70
getTypeMethod · 0.45
toStringMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected