sunby commented on code in PR #43485:
URL: https://github.com/apache/arrow/pull/43485#discussion_r1697915159
##########
cpp/src/arrow/array/concatenate.cc:
##########
@@ -565,10 +565,25 @@ class ConcatenateImpl {
}
Status Visit(const StructType& s) {
+ std::shared_ptr<StructType> suggested = nullptr;
for (int i = 0; i < s.num_fields(); ++i) {
ARROW_ASSIGN_OR_RAISE(auto child_data, ChildData(i));
- RETURN_NOT_OK(ConcatenateImpl(child_data, pool_)
- .Concatenate(&out_->child_data[i], /*hints=*/nullptr));
+ ErrorHints child_hints;
+ auto status = ConcatenateImpl(child_data, pool_)
+ .Concatenate(&out_->child_data[i], &child_hints);
+ if (!status.ok() && child_hints.suggested_cast) {
+ ARROW_ASSIGN_OR_RAISE(
+ suggested,
+ suggested
+ ? suggested->SetField(
+ i,
s.field(i)->WithType(std::move(child_hints.suggested_cast)))
+ : s.SetField(
+ i,
s.field(i)->WithType(std::move(child_hints.suggested_cast))));
+ }
+ }
Review Comment:
line 580 should be `suggested_field_casts[i] =
suggested_field_casts[i]->WithType(std::move(field_error_hints.suggested_cast));`
because `field_error_hints.suggested_cast`'s type is
`std::shared_ptr<DataType>`
--
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]