liukun4515 commented on a change in pull request #1073:
URL: https://github.com/apache/arrow-rs/pull/1073#discussion_r773546033



##########
File path: arrow/src/compute/kernels/cast.rs
##########
@@ -281,6 +285,56 @@ macro_rules! cast_floating_point_to_decimal {
     }};
 }
 
+// cast the decimal array to integer array
+macro_rules! cast_decimal_to_integer {
+    ($ARRAY:expr, $SCALE : ident, $VALUE_BUILDER: ident, $NATIVE_TYPE : ident, 
$DATA_TYPE : expr) => {{
+        let array = $ARRAY.as_any().downcast_ref::<DecimalArray>().unwrap();
+        let mut value_builder = $VALUE_BUILDER::new(array.len());
+        let div: i128 = 10_i128.pow(*$SCALE as u32);
+        let min_bound = ($NATIVE_TYPE::MIN) as i128;
+        let max_bound = ($NATIVE_TYPE::MAX) as i128;
+        for i in 0..array.len() {

Review comment:
       Thanks.
   I will do this in the follow-up PR.
   Maybe I need also to add some micro benchmark to get the result of 
performance improvement. 




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