diff --git a/cpp/src/arrow/extension/fixed_shape_tensor.cc b/cpp/src/arrow/extension/fixed_shape_tensor.cc index 1d61e929073cd..f5fe561f1336d 100644 --- a/cpp/src/arrow/extension/fixed_shape_tensor.cc +++ b/cpp/src/arrow/extension/fixed_shape_tensor.cc @@ -214,7 +214,7 @@ Result> FixedShapeTensorType::MakeTensor( return Status::TypeError("Cannot convert non-fixed-width values to Tensor."); } const auto& array = - internal::checked_pointer_cast(ext_scalar->value)->value; + internal::checked_cast(ext_scalar->value)->value; if (array->null_count() > 0) { return Status::Invalid("Cannot convert data with nulls to Tensor."); } @@ -264,6 +264,7 @@ Result> FixedShapeTensorArray::FromTensor std::vector dim_names; if (!tensor->dim_names().empty()) { + dim_names.reserve(permutation.size()); for (auto i : permutation) { dim_names.emplace_back(tensor->dim_names()[i]); }