jorisvandenbossche commented on a change in pull request #12627:
URL: https://github.com/apache/arrow/pull/12627#discussion_r827276978



##########
File path: python/pyarrow/ipc.pxi
##########
@@ -550,8 +550,36 @@ class _ReadPandasMixin:
 cdef class RecordBatchReader(_Weakrefable):
     """Base class for reading stream of record batches.
 
-    Provides common implementations of convenience methods. Should not
-    be instantiated directly by user code.
+    Record batch readers function as iterators of record batches that also 
+    provide the schema (without the need to get any batches).
+
+    Warnings
+    --------
+    Do not call this class's constructor directly, use one of the
+    ``RecordBatchReader.from_*`` functions instead.
+
+    Notes
+    -----
+    To import and export using the Arrow C stream interface, use the 
+    ``_import_from_c`` and ``_export_from_c`` methods. However, keep in mind 
this
+    interface is experimental and intended for expert users.
+
+    Examples
+    --------
+    >>> schema = pa.schema([('x', pa.int64())])
+    >>> def iter_record_batches():
+    >>>     for i in range(2):
+    >>>     yield pa.RecordBatch.from_arrays([pa.array([1, 2, 3])], 
schema=schema)

Review comment:
       ```suggestion
       >>> def iter_record_batches():
       ...     for i in range(2):
       ...     yield pa.RecordBatch.from_arrays([pa.array([1, 2, 3])], 
schema=schema)
   ```

##########
File path: python/pyarrow/ipc.pxi
##########
@@ -550,8 +550,36 @@ class _ReadPandasMixin:
 cdef class RecordBatchReader(_Weakrefable):
     """Base class for reading stream of record batches.
 
-    Provides common implementations of convenience methods. Should not
-    be instantiated directly by user code.
+    Record batch readers function as iterators of record batches that also 
+    provide the schema (without the need to get any batches).
+
+    Warnings
+    --------
+    Do not call this class's constructor directly, use one of the
+    ``RecordBatchReader.from_*`` functions instead.
+
+    Notes
+    -----
+    To import and export using the Arrow C stream interface, use the 
+    ``_import_from_c`` and ``_export_from_c`` methods. However, keep in mind 
this
+    interface is experimental and intended for expert users.
+
+    Examples
+    --------
+    >>> schema = pa.schema([('x', pa.int64())])
+    >>> def iter_record_batches():
+    >>>     for i in range(2):
+    >>>     yield pa.RecordBatch.from_arrays([pa.array([1, 2, 3])], 
schema=schema)
+    >>> reader = pa.RecordBatchReader.from_batches(schema, 
iter_record_batches())
+    >>> print(reader.schema)
+    pyarrow.Schema
+    x: int64
+    >>> for batch in reader:
+    >>>     print(batch)

Review comment:
       ```suggestion
       >>> for batch in reader:
       ...     print(batch)
   ```




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