You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/01/29 22:26:46 UTC
[GitHub] [arrow] nealrichardson opened a new pull request #9365: ARROW-10520: [C++][R] Implement add/remove/replace for RecordBatch
nealrichardson opened a new pull request #9365:
URL: https://github.com/apache/arrow/pull/9365
In C++, RecordBatch had AddColumn and RemoveColumn but no SetColumn; Table had all three. This adds the missing RecordBatch method and adds R bindings.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on a change in pull request #9365: ARROW-10520: [C++][R] Implement add/remove/replace for RecordBatch
Posted by GitBox <gi...@apache.org>.
pitrou commented on a change in pull request #9365:
URL: https://github.com/apache/arrow/pull/9365#discussion_r567805069
##########
File path: cpp/src/arrow/record_batch.cc
##########
@@ -104,6 +104,27 @@ class SimpleRecordBatch : public RecordBatch {
internal::AddVectorElement(columns_, i, column->data()));
}
+ Result<std::shared_ptr<RecordBatch>> SetColumn(
+ int i, const std::shared_ptr<Field>& field,
+ const std::shared_ptr<Array>& column) const override {
+ ARROW_CHECK(field != nullptr);
+ ARROW_CHECK(column != nullptr);
+
+ if (!field->type()->Equals(column->type())) {
+ return Status::Invalid("Column data type ", field->type()->name(),
Review comment:
Return `TypeError`?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] nealrichardson commented on a change in pull request #9365: ARROW-10520: [C++][R] Implement add/remove/replace for RecordBatch
Posted by GitBox <gi...@apache.org>.
nealrichardson commented on a change in pull request #9365:
URL: https://github.com/apache/arrow/pull/9365#discussion_r568034065
##########
File path: cpp/src/arrow/record_batch.cc
##########
@@ -104,6 +104,27 @@ class SimpleRecordBatch : public RecordBatch {
internal::AddVectorElement(columns_, i, column->data()));
}
+ Result<std::shared_ptr<RecordBatch>> SetColumn(
+ int i, const std::shared_ptr<Field>& field,
+ const std::shared_ptr<Array>& column) const override {
+ ARROW_CHECK(field != nullptr);
+ ARROW_CHECK(column != nullptr);
+
+ if (!field->type()->Equals(column->type())) {
+ return Status::Invalid("Column data type ", field->type()->name(),
Review comment:
I changed 3 in this file, PTAL
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] github-actions[bot] commented on pull request #9365: ARROW-10520: [C++][R] Implement add/remove/replace for RecordBatch
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #9365:
URL: https://github.com/apache/arrow/pull/9365#issuecomment-770083437
https://issues.apache.org/jira/browse/ARROW-10520
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] nealrichardson closed pull request #9365: ARROW-10520: [C++][R] Implement add/remove/replace for RecordBatch
Posted by GitBox <gi...@apache.org>.
nealrichardson closed pull request #9365:
URL: https://github.com/apache/arrow/pull/9365
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] pitrou commented on a change in pull request #9365: ARROW-10520: [C++][R] Implement add/remove/replace for RecordBatch
Posted by GitBox <gi...@apache.org>.
pitrou commented on a change in pull request #9365:
URL: https://github.com/apache/arrow/pull/9365#discussion_r567981613
##########
File path: cpp/src/arrow/record_batch.cc
##########
@@ -104,6 +104,27 @@ class SimpleRecordBatch : public RecordBatch {
internal::AddVectorElement(columns_, i, column->data()));
}
+ Result<std::shared_ptr<RecordBatch>> SetColumn(
+ int i, const std::shared_ptr<Field>& field,
+ const std::shared_ptr<Array>& column) const override {
+ ARROW_CHECK(field != nullptr);
+ ARROW_CHECK(column != nullptr);
+
+ if (!field->type()->Equals(column->type())) {
+ return Status::Invalid("Column data type ", field->type()->name(),
Review comment:
Ah, that would be good. You may need to fix some tests too :-)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] nealrichardson commented on a change in pull request #9365: ARROW-10520: [C++][R] Implement add/remove/replace for RecordBatch
Posted by GitBox <gi...@apache.org>.
nealrichardson commented on a change in pull request #9365:
URL: https://github.com/apache/arrow/pull/9365#discussion_r567976467
##########
File path: cpp/src/arrow/record_batch.cc
##########
@@ -104,6 +104,27 @@ class SimpleRecordBatch : public RecordBatch {
internal::AddVectorElement(columns_, i, column->data()));
}
+ Result<std::shared_ptr<RecordBatch>> SetColumn(
+ int i, const std::shared_ptr<Field>& field,
+ const std::shared_ptr<Array>& column) const override {
+ ARROW_CHECK(field != nullptr);
+ ARROW_CHECK(column != nullptr);
+
+ if (!field->type()->Equals(column->type())) {
+ return Status::Invalid("Column data type ", field->type()->name(),
Review comment:
Sure. This is just copied from L92 above; should I change that one too?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org