viirya commented on code in PR #2756:
URL: https://github.com/apache/arrow-rs/pull/2756#discussion_r973603267


##########
arrow/src/datatypes/native.rs:
##########
@@ -102,6 +103,28 @@ pub(crate) mod native_op {
         fn div_wrapping(self, rhs: Self) -> Self {
             self / rhs
         }
+
+        /// Check `DivideByZero` error and `Overflow` error.
+        fn mod_fully_checked(self, rhs: Self) -> Result<Self> {
+            if rhs.is_zero() {
+                Err(ArrowError::DivideByZero)
+            } else {
+                Ok(self.mod_wrapping(rhs))
+            }
+        }
+
+        /// Only check `DivideByZero` error
+        fn mod_checked_divide_by_zero(self, rhs: Self) -> Result<Self> {

Review Comment:
   I don't really like to pollute the API arbitrarily. Could you keep two APIs 
(_wrapping, _checked) for mod?



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to