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 2022/11/30 09:23:44 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3242: Add new API to validate the precision for decimal array

tustvold commented on code in PR #3242:
URL: https://github.com/apache/arrow-rs/pull/3242#discussion_r1035721480


##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -1151,6 +1151,14 @@ impl<T: DecimalType + ArrowPrimitiveType> PrimitiveArray<T> {
         })
     }
 
+    /// Validates the Decimal Array, if the value of slot is overflow for the specified precision, and
+    /// will be casted to Null
+    pub fn null_if_overflow_precision(self, precision: u8) -> Self {

Review Comment:
   I think `&self` is better, as otherwise this is tricky to use through a downcasted `ArrayRef`



##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -1151,6 +1151,14 @@ impl<T: DecimalType + ArrowPrimitiveType> PrimitiveArray<T> {
         })
     }
 
+    /// Validates the Decimal Array, if the value of slot is overflow for the specified precision, and
+    /// will be casted to Null
+    pub fn null_if_overflow_precision(self, precision: u8) -> Self {
+        self.unary_opt::<_, T>(|v| {

Review Comment:
   :heart: 



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

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org