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

Function test_batch_serialize

python/pyarrow/tests/test_cuda.py:699–720  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

697
698
699def test_batch_serialize():
700 batch = make_recordbatch(10)
701 hbuf = batch.serialize()
702 cbuf = cuda.serialize_record_batch(batch, global_context)
703
704 # Test that read_record_batch works properly
705 cbatch = cuda.read_record_batch(cbuf, batch.schema)
706 assert isinstance(cbatch, pa.RecordBatch)
707 assert batch.schema == cbatch.schema
708 assert batch.num_columns == cbatch.num_columns
709 assert batch.num_rows == cbatch.num_rows
710
711 # Deserialize CUDA-serialized batch on host
712 buf = cbuf.copy_to_host()
713 assert hbuf.equals(buf)
714 batch2 = pa.ipc.read_record_batch(buf, batch.schema)
715 assert hbuf.equals(batch2.serialize())
716
717 assert batch.num_columns == batch2.num_columns
718 assert batch.num_rows == batch2.num_rows
719 assert batch.column(0).equals(batch2.column(0))
720 assert batch.equals(batch2)
721
722
723def make_table():

Callers

nothing calls this directly

Calls 4

make_recordbatchFunction · 0.85
equalsMethod · 0.80
read_record_batchMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected