[ 
https://issues.apache.org/jira/browse/ARROW-969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16357439#comment-16357439
 ] 

ASF GitHub Bot commented on ARROW-969:
--------------------------------------

wesm commented on a change in pull request #1574: ARROW-969: [C++] Add 
add/remove field functions for RecordBatch
URL: https://github.com/apache/arrow/pull/1574#discussion_r167038477
 
 

 ##########
 File path: cpp/src/arrow/record_batch.cc
 ##########
 @@ -78,6 +79,52 @@ class SimpleRecordBatch : public RecordBatch {
 
   std::shared_ptr<ArrayData> column_data(int i) const override { return 
columns_[i]; }
 
+  Status AddColumn(int i, const std::shared_ptr<Field>& field,
+                   const std::shared_ptr<ArrayData>& column,
+                   std::shared_ptr<RecordBatch>* out) const override {
+    if (i < 0 || i > num_columns() + 1) {
+      return Status::Invalid("Invalid column index");
+    }
+    if (field == nullptr) {
+      std::stringstream ss;
+      ss << "Field " << i << " was null";
+      return Status::Invalid(ss.str());
+    }
+    if (column == nullptr) {
+      std::stringstream ss;
+      ss << "Column " << i << " was null";
+      return Status::Invalid(ss.str());
+    }
 
 Review comment:
   I took a look at `SimpleTable::AddColumn`; there `col` is being null-checked 
-- I think that should also be a DCHECK

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [C++/Python] Add add/remove field functions for RecordBatch
> -----------------------------------------------------------
>
>                 Key: ARROW-969
>                 URL: https://issues.apache.org/jira/browse/ARROW-969
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: C++, Python
>            Reporter: Wes McKinney
>            Assignee: Panchen Xue
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.9.0
>
>
> Analogous to the Table equivalents



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to