viirya commented on code in PR #3040:
URL: https://github.com/apache/arrow-rs/pull/3040#discussion_r1016027312
##########
arrow-cast/src/cast.rs:
##########
@@ -411,34 +412,51 @@ fn cast_reinterpret_arrays<
))
}
-// 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::<Decimal128Array>().unwrap();
- let mut value_builder = $VALUE_BUILDER::with_capacity(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() {
- if array.is_null(i) {
- value_builder.append_null();
+fn cast_decimal_to_integer<D, T>(
Review Comment:
castoptions is not supported originally for casting from decimal128 to
signed integer. We should support it actually. Can be in this PR or a later PR.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]