lilixiang commented on a change in pull request #10893:
URL: https://github.com/apache/arrow/pull/10893#discussion_r684602103



##########
File path: python/pyarrow/_flight.pyx
##########
@@ -949,7 +949,43 @@ cdef class MetadataRecordBatchWriter(_CRecordBatchWriter):
         # individual batches to have control.
         with nogil:
             check_flight_status(
-                self.writer.get().WriteRecordBatch(deref(batch.batch)))
+                self._writer().WriteRecordBatch(deref(batch.batch)))
+
+    def write_table(self, Table table, max_chunksize=None, **kwargs):
+        """
+        Write Table to stream in (contiguous) RecordBatch objects.
+
+        Parameters
+        ----------
+        table : Table
+        max_chunksize : int, default None
+            Maximum size for RecordBatch chunks. Individual chunks may be
+            smaller depending on the chunk layout of individual columns.
+        """
+        cdef:
+            # max_chunksize must be > 0 to have any impact
+            int64_t c_max_chunksize = -1
+
+        if 'chunksize' in kwargs:
+            max_chunksize = kwargs['chunksize']
+            msg = ('The parameter chunksize is deprecated for the write_table '
+                   'methods as of 0.15, please use parameter '
+                   'max_chunksize instead')
+            warnings.warn(msg, FutureWarning)
+
+        if max_chunksize is not None:
+            c_max_chunksize = max_chunksize
+
+        with nogil:
+            check_flight_status(
+                self._writer().WriteTable(table.table[0], c_max_chunksize))

Review comment:
       don't much know about cython, and should I use 
   ```python 
   self._writer().WriteTable(deref(table.table)), c_max_chunksize)
   ```
    ?




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