Fokko commented on code in PR #36846:
URL: https://github.com/apache/arrow/pull/36846#discussion_r1307084587
##########
cpp/src/arrow/table.cc:
##########
@@ -502,9 +515,23 @@ Result<std::shared_ptr<Table>> PromoteTableToSchema(const
std::shared_ptr<Table>
continue;
}
+#ifdef ARROW_COMPUTE
+ if (!compute::CanCast(*current_field->type(), *field->type())) {
+ return Status::TypeError("Unable to promote field ", field->name(),
+ ": incompatible types: ",
field->type()->ToString(),
+ " vs ", current_field->type()->ToString());
+ }
+ compute::ExecContext ctx(pool);
+ ARROW_ASSIGN_OR_RAISE(auto casted,
compute::Cast(table->column(field_index),
+ field->type(), *options,
&ctx));
+ columns.push_back(casted.chunked_array());
+#else
return Status::Invalid("Unable to promote field ", field->name(),
": incompatible types: ",
field->type()->ToString(), " vs ",
Review Comment:
Hmm, interesting. Looking at the PR, I think you're right!
--
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]