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/06/22 13:39:07 UTC

[GitHub] [arrow-rs] liukun4515 commented on a diff in pull request #1922: Support casting `NULL` to/from `Decimal`

liukun4515 commented on code in PR #1922:
URL: https://github.com/apache/arrow-rs/pull/1922#discussion_r903756677


##########
arrow/src/compute/kernels/cast.rs:
##########
@@ -4312,6 +4314,24 @@ mod tests {
         assert_eq!(array_to_strings(&cast_array), expected);
     }
 
+    #[test]
+    fn test_cast_null_array_to_decimal_array() {
+        let data_type = DataType::Decimal(12, 4);
+        let array = new_null_array(&DataType::Null, 4);
+        assert_eq!(array.data_type(), &DataType::Null);
+        let cast_array = cast(&array, &data_type).expect("cast failed");
+        assert_eq!(cast_array.data_type(), &data_type);
+        for i in 0..4 {
+            assert!(cast_array.is_null(i));
+        }
+
+        // Now: can't convert decimal to NULL type
+        let array = new_null_array(&data_type, 4);

Review Comment:
   I will fill up `Decimal to Null` in this pull request.



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