Light-City commented on code in PR #37896:
URL: https://github.com/apache/arrow/pull/37896#discussion_r1339404947


##########
cpp/src/arrow/record_batch.cc:
##########
@@ -432,4 +433,43 @@ RecordBatchReader::~RecordBatchReader() {
   ARROW_WARN_NOT_OK(this->Close(), "Implicitly called RecordBatchReader::Close 
failed");
 }
 
+Result<std::shared_ptr<RecordBatch>> ConcatenateRecordBatches(
+    const RecordBatchVector& batches, MemoryPool* pool) {
+  int64_t length = 0;
+  size_t n = batches.size();
+  if (n == 0) {
+    return Status::Invalid("Must pass at least one recordbatch");
+  }
+  if (n == 1) {

Review Comment:
   Can it be changed to this method?
   Within the col loop, the length of col=0 is assigned, and the lengths of the 
subsequent columns are verified against the first column.
   
   ```cpp
   if (col == 0) {
      length = array->length();
   } else if (length != array->length()) {
      return Status::Invalid(
               "column index ", i, " length is ", array->length(),
               ", does not match the length of previous columns: ", length);
   }
   ```



##########
cpp/src/arrow/record_batch.cc:
##########
@@ -432,4 +433,43 @@ RecordBatchReader::~RecordBatchReader() {
   ARROW_WARN_NOT_OK(this->Close(), "Implicitly called RecordBatchReader::Close 
failed");
 }
 
+Result<std::shared_ptr<RecordBatch>> ConcatenateRecordBatches(
+    const RecordBatchVector& batches, MemoryPool* pool) {
+  int64_t length = 0;
+  size_t n = batches.size();
+  if (n == 0) {
+    return Status::Invalid("Must pass at least one recordbatch");
+  }
+  if (n == 1) {

Review Comment:
   Can it be changed to this method?
   Within the col loop, the length of col=0 is assigned, and the lengths of the 
subsequent columns are verified against the first column.
   
   ```cpp
   if (col == 0) {
      length = array->length();
   } else if (length != array->length()) {
      return Status::Invalid(
               "column index ", i, " length is ", array->length(),
               ", does not match the length of previous columns: ", length);
   }
   ```



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