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



##########
File path: arrow/src/compute/kernels/cast.rs
##########
@@ -1837,6 +1906,125 @@ where
 mod tests {
     use super::*;
     use crate::{buffer::Buffer, util::display::array_value_to_string};
+    use num::traits::Pow;
+
+    #[test]
+    fn test_cast_numeric_to_decimal() {
+        let data_types = vec![
+            DataType::Int8,
+            DataType::Int16,
+            DataType::Int32,
+            DataType::Int64,
+            DataType::Float32,
+            DataType::Float64,
+        ];
+        let decimal_type = DataType::Decimal(38, 6);
+        for data_type in data_types {
+            assert!(can_cast_types(&data_type, &decimal_type))
+        }
+        assert!(!can_cast_types(&DataType::UInt64, &decimal_type));
+
+        // test i8 to decimal type
+        let array = Int8Array::from(vec![1, 2, 3, 4, 5]);

Review comment:
       add the Null element for test, please check.




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


Reply via email to