You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/10/01 15:57:19 UTC

[GitHub] [arrow] emkornfield commented on a change in pull request #8318: ARROW-10150: [C++] Fix crashes on invalid Parquet file

emkornfield commented on a change in pull request #8318:
URL: https://github.com/apache/arrow/pull/8318#discussion_r498352840



##########
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:
       I thought checked_cast only had functionality in debug most and was essentially a static cast in prod?  Or is this not the root cause of the issue?




----------------------------------------------------------------
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:
users@infra.apache.org