pitrou commented on a change in pull request #8318:
URL: https://github.com/apache/arrow/pull/8318#discussion_r498354560
##########
File path: cpp/src/parquet/arrow/schema.cc
##########
@@ -693,10 +693,12 @@ Status ApplyOriginalStorageMetadata(const Field&
origin_field, SchemaField* infe
auto origin_type = origin_field.type();
auto inferred_type = inferred->field->type();
- if (inferred_type->id() == ::arrow::Type::TIMESTAMP) {
+ if (origin_type->id() == ::arrow::Type::TIMESTAMP &&
+ inferred_type->id() == ::arrow::Type::TIMESTAMP) {
// Restore time zone, if any
- const auto& ts_type = static_cast<const
::arrow::TimestampType&>(*inferred_type);
- const auto& ts_origin_type = static_cast<const
::arrow::TimestampType&>(*origin_type);
+ const auto& ts_type = checked_cast<const
::arrow::TimestampType&>(*inferred_type);
+ const auto& ts_origin_type =
+ checked_cast<const ::arrow::TimestampType&>(*origin_type);
Review comment:
Well, it's useful to have a debug mode check, IMHO.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]