wgtmac commented on code in PR #42239:
URL: https://github.com/apache/arrow/pull/42239#discussion_r1648426172


##########
cpp/src/arrow/record_batch.h:
##########
@@ -310,7 +310,20 @@ class ARROW_EXPORT RecordBatchReader {
   /// \brief Read the next record batch in the stream. Return null for batch
   /// when reaching end of stream
   ///
-  /// \param[out] batch the next loaded batch, null at end of stream
+  /// example:
+  /// ```
+  /// std::shared_ptr<RecordBatch> batch;
+  /// while (true) {
+  ///   ARROW_RETURN_NOT_OK(reader->ReadNext(&batch));
+  ///   if (batch == nullptr) {
+  ///     break;
+  ///   }
+  ///   // handling the `batch`
+  /// }
+  /// ```
+  ///
+  /// \param[out] batch the next loaded batch, null at end of stream. Return
+  /// a empty batch doesn't means the end of stream, it could be a empty batch.

Review Comment:
   ```suggestion
     /// \param[out] batch the next loaded batch, null at end of stream. 
Returning
     /// an empty batch doesn't mean the end of stream because it is valid data.
   ```



##########
cpp/src/arrow/record_batch.h:
##########
@@ -310,7 +310,20 @@ class ARROW_EXPORT RecordBatchReader {
   /// \brief Read the next record batch in the stream. Return null for batch
   /// when reaching end of stream
   ///
-  /// \param[out] batch the next loaded batch, null at end of stream
+  /// example:
+  /// ```
+  /// std::shared_ptr<RecordBatch> batch;
+  /// while (true) {
+  ///   ARROW_RETURN_NOT_OK(reader->ReadNext(&batch));
+  ///   if (batch == nullptr) {

Review Comment:
   Should we add a block to suggest skipping empty batch?
   
   ```
   if (batch->num_rows() == 0) {
     continue;
   }
   ```



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