sweb commented on a change in pull request #9047:
URL: https://github.com/apache/arrow/pull/9047#discussion_r550806533



##########
File path: rust/parquet/src/arrow/schema.rs
##########
@@ -657,6 +645,18 @@ impl ParquetTypeConverter<'_> {
         }
     }
 
+    fn to_decimal(&self) -> DataType {
+        assert!(self.schema.is_primitive());
+        if let Type::PrimitiveType {
+            precision, scale, ..
+        } = self.schema
+        {
+            DataType::Decimal(*precision as usize, *scale as usize)
+        } else {

Review comment:
       Sorry, I think I am not familiar enough with Rust yet. I was under the 
impression that I have to provide an implementation for all possible branches 
and I get a compiler error when I remove the else branch. Is it possible to 
unwrap the if part somehow?
   
   ```
   error[E0317]: `if` may be missing an `else` clause
      --> parquet/src/arrow/schema.rs:650:9
       |
   650 | /         if let Type::PrimitiveType {
   651 | |             precision, scale, ..
   652 | |         } = self.schema
   653 | |         {
   654 | |             DataType::Decimal(*precision as usize, *scale as usize)
       | |             ------------------------------------------------------- 
found here
   655 | |         } 
       | |_________^ expected `()`, found enum `arrow::datatypes::DataType`
       |
       = note: `if` expressions without `else` evaluate to `()`
       = help: consider adding an `else` block that evaluates to the expected 
type
   ```




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


Reply via email to