jorisvandenbossche commented on code in PR #42010:
URL: https://github.com/apache/arrow/pull/42010#discussion_r1636586472
##########
python/pyarrow/tests/test_cuda.py:
##########
@@ -792,3 +792,57 @@ def test_IPC(size):
p.start()
p.join()
assert p.exitcode == 0
+
+
+def test_print_array():
+ batch = make_recordbatch(10)
+ cbuf = cuda.serialize_record_batch(batch, global_context)
+ cbatch = cuda.read_record_batch(cbuf, batch.schema)
+ arr = batch["f0"]
+ carr = cbatch["f0"]
+ assert str(carr) == str(arr)
+
+ batch = make_recordbatch(100)
+ cbuf = cuda.serialize_record_batch(batch, global_context)
+ cbatch = cuda.read_record_batch(cbuf, batch.schema)
+ arr = batch["f0"]
+ carr = cbatch["f0"]
+ assert str(carr) == str(arr)
+
+
+def make_chunked_array(n_elements_per_chunk, n_chunks):
+ arrs = []
+ carrs = []
+ for _ in range(n_chunks):
+ batch = make_recordbatch(n_elements_per_chunk)
+ cbuf = cuda.serialize_record_batch(batch, global_context)
+ cbatch = cuda.read_record_batch(cbuf, batch.schema)
+ arrs.append(batch["f0"])
+ carrs.append(cbatch["f0"])
+
+ return pa.chunked_array(arrs), pa.chunked_array(carrs)
Review Comment:
This is still a bit verbose, but can be simplified once the "copy to device"
functionality is exposed (should maybe do that first now)
--
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]