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 2021/01/01 09:31:13 UTC

[GitHub] [arrow] mqy commented on a change in pull request #9058: ARROW-10996: [Rust] change return value type of get_arrow_schema_from_metadata()

mqy commented on a change in pull request #9058:
URL: https://github.com/apache/arrow/pull/9058#discussion_r550750646



##########
File path: rust/parquet/src/arrow/schema.rs
##########
@@ -42,12 +42,17 @@ pub fn parquet_to_arrow_schema(
     key_value_metadata: &Option<Vec<KeyValue>>,
 ) -> Result<Schema> {
     let mut metadata = parse_key_value_metadata(key_value_metadata).unwrap_or_default();
-    let arrow_schema_metadata = metadata
+    let maybe_schema = metadata
         .remove(super::ARROW_SCHEMA_META_KEY)
         .map(|encoded| get_arrow_schema_from_metadata(&encoded));
 
+    let arrow_schema_metadata = match maybe_schema {

Review comment:
       @jorgecarleitao thank you for the tip!
   
   The codes were updated to use `map_or` for flipping `Option<Result>` to `Result<Option>`.
   BTW, I found some similar usage of `map_or` in `parquet/src/column/writer.rs` 🥇 




----------------------------------------------------------------
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