You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Light-City (via GitHub)" <gi...@apache.org> on 2023/08/23 06:08:08 UTC
[GitHub] [arrow] Light-City commented on a diff in pull request #37171: GH-37170: [C++] Support schema rewriting of RecordBatch.
Light-City commented on code in PR #37171:
URL: https://github.com/apache/arrow/pull/37171#discussion_r1302523577
##########
cpp/src/arrow/record_batch.cc:
##########
@@ -283,6 +283,25 @@ bool RecordBatch::ApproxEquals(const RecordBatch& other, const EqualOptions& opt
return true;
}
+Status RecordBatch::RewriteSchema(std::shared_ptr<Schema> schema) {
+ if (schema_->num_fields() != schema->num_fields())
+ return Status::Invalid("RecordBatch schema fields", schema_->num_fields(),
+ ", did not match new schema fields: ", schema->num_fields());
+ auto fields = schema_->fields();
+ int n_fields = static_cast<int>(fields.size());
+ for (int i = 0; i < n_fields; i++) {
+ auto old_type = fields[i]->type();
+ auto replace_type = schema->field(i)->type();
Review Comment:
cool, I use Equals method.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org