pitrou commented on code in PR #43782: URL: https://github.com/apache/arrow/pull/43782#discussion_r1950464319
########## cpp/src/arrow/compute/kernels/scalar_cast_nested.cc: ########## @@ -403,17 +399,27 @@ struct CastStruct { } int out_field_index = 0; - for (int field_index : fields_to_select) { - const auto& target_type = out->type()->field(out_field_index++)->type(); - if (field_index == kFillNullSentinel) { - ARROW_ASSIGN_OR_RAISE(auto nulls, - MakeArrayOfNull(target_type->GetSharedPtr(), batch.length)); + for (int in_field_index : fields_to_select) { + const auto& in_field = in_type.field(in_field_index); Review Comment: This is probably the problem. You're indexing the fields with `in_field_index` *before* testing for `kFillNullSentinel`. -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org