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/02 12:40:34 UTC

[GitHub] [arrow] alamb commented on a change in pull request #9047: ARROW-11072: [Rust] [Parquet] Support reading decimal from physical int types

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



##########
File path: rust/parquet/src/schema/types.rs
##########
@@ -103,6 +103,24 @@ impl Type {
         }
     }
 
+    /// Gets precision of this primitive type.
+    /// Note that this will panic if called on a non-primitive type.
+    pub fn get_precision(&self) -> i32 {
+        match *self {
+            Type::PrimitiveType { precision, ..} => precision,
+            _ => panic!("Cannot call get_precision() on non-primitive type")
+        }
+    }
+
+    /// Gets scale of this primitive type.
+    /// Note that this will panic if called on a non-primitive type.
+    pub fn get_scale(&self) -> i32 {
+        match *self {
+            Type::PrimitiveType { scale, ..} => scale,
+            _ => panic!("Cannot call get_scale() on non-primitive type")

Review comment:
       this is much nicer (and it is now clearer what is expected) 👍 




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