pitrou commented on a change in pull request #12574:
URL: https://github.com/apache/arrow/pull/12574#discussion_r821645141



##########
File path: cpp/src/arrow/csv/writer.cc
##########
@@ -571,34 +556,39 @@ class CSVWriterImpl : public ipc::RecordBatchWriter {
           column_populators_[col]->UpdateRowLengths(*batch.column(col), 
offsets_.data()));
     }
     // Calculate cumulative offsets for each row (including delimiters).
-    // ',' * num_columns - 1(last column doesn't have ,) + eol
-    int32_t delimiters_length =
+    // - before conversion: offsets_[i] = length of i-th row

Review comment:
       ```suggestion
       // - before conversion: offsets_[i] = length of (i-1)th row
   ```

##########
File path: cpp/src/arrow/csv/writer.cc
##########
@@ -571,34 +556,39 @@ class CSVWriterImpl : public ipc::RecordBatchWriter {
           column_populators_[col]->UpdateRowLengths(*batch.column(col), 
offsets_.data()));
     }
     // Calculate cumulative offsets for each row (including delimiters).
-    // ',' * num_columns - 1(last column doesn't have ,) + eol
-    int32_t delimiters_length =
+    // - before conversion: offsets_[i] = length of i-th row
+    // - after conversion:  offsets_[i] = offset to the starting of i-th row 
buffer
+    //   - offsets_[0] = 0
+    //   - offsets_[i] = offsets_[i-1] + len(i-1-th row) + len(delimiters)
+    // Delimiters: ',' * num_columns - 1(last column doesn't have ,) + eol

Review comment:
       ```suggestion
       // Delimiters: ',' * (num_columns - 1) + eol
   ```




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