Skip to content

Commit

Permalink
Update python/pyarrow/src/arrow/python/ipc.cc
Browse files Browse the repository at this point in the history
Co-authored-by: Felipe Oliveira Carvalho <[email protected]>
  • Loading branch information
jorisvandenbossche and felipecrv authored Jun 13, 2024
1 parent ee6dbf7 commit b1278d2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/pyarrow/src/arrow/python/ipc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ Status CastingRecordBatchReader::Init(std::shared_ptr<RecordBatchReader> parent,

// Ensure all columns can be cast before succeeding
for (int i = 0; i < num_fields; i++) {
if ((!((src->field(i)->type()->Equals(schema->field(i)->type())))) &&
(!compute::CanCast(*src->field(i)->type(), *schema->field(i)->type()))) {
auto& src_type = src->field(i)->type();
auto& schema_type = schema->field(i)->type();
if (!src_type->Equals(schema_type) && !compute::CanCast(*src_type, *schema_type)) {
return Status::TypeError("Field ", i, " cannot be cast from ",
src->field(i)->type()->ToString(), " to ",
schema->field(i)->type()->ToString());
Expand Down

0 comments on commit b1278d2

Please sign in to comment.