jorisvandenbossche commented on code in PR #42223:
URL: https://github.com/apache/arrow/pull/42223#discussion_r1699582642


##########
python/pyarrow/table.pxi:
##########
@@ -3549,6 +3549,29 @@ cdef class RecordBatch(_Tabular):
                                                                              
row_major, pool))
         return pyarrow_wrap_tensor(c_tensor)
 
+    def copy_to(self, MemoryManager memory_manager):
+        """
+        Copy the entire RecordBatch to destination MemoryManager.
+
+        This copies each column of the record batch to create
+        a new record batch where all underlying buffers for the columns have
+        been copied to the destination MemoryManager.
+
+        Parameters
+        ----------
+        memory_manager : pyarrow.MemoryManager
+
+        Returns
+        ------
+        RecordBatch
+        """
+        cdef:
+            shared_ptr[CRecordBatch] c_batch
+
+        with nogil:
+            c_batch = 
GetResultValue(self.batch.CopyTo(memory_manager.unwrap()))

Review Comment:
   Ah, yes, with the current design it is a required keyword and so I should 
protect it from not being None (add a `not None` in the signature). 
   
   But we might want to allow it to be None, and in that case use the source's 
memory manager as destination device (i.e. copy to the same device)?



-- 
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]

Reply via email to