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

Function test_chunked_array_c_stream_interface

python/pyarrow/tests/test_table.py:523–540  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

521
522
523def test_chunked_array_c_stream_interface():
524 class ChunkedArrayWrapper:
525 def __init__(self, chunked):
526 self.chunked = chunked
527
528 def __arrow_c_stream__(self, requested_schema=None):
529 return self.chunked.__arrow_c_stream__(requested_schema)
530
531 data = pa.chunked_array([[1, 2, 3], [4, None, 6]])
532 wrapper = ChunkedArrayWrapper(data)
533
534 # Can roundtrip through the wrapper.
535 result = pa.chunked_array(wrapper)
536 assert result == data
537
538 # Can also import with a type that implementer can cast to.
539 result = pa.chunked_array(wrapper, type=pa.int16())
540 assert result == data.cast(pa.int16())
541
542
543class BatchWrapper:

Callers

nothing calls this directly

Calls 3

ChunkedArrayWrapperClass · 0.85
chunked_arrayMethod · 0.80
castMethod · 0.45

Tested by

no test coverage detected