diff --git a/arrow-cast/src/cast/mod.rs b/arrow-cast/src/cast/mod.rs index f624a415b69..4b37ef27bd9 100644 --- a/arrow-cast/src/cast/mod.rs +++ b/arrow-cast/src/cast/mod.rs @@ -5187,30 +5187,26 @@ mod tests { // Cast Timestamp to Utf8View is not supported yet // TODO: Implement casting from Timestamp to Utf8View macro_rules! assert_cast_timestamp_to_string { - ($array:expr, $datatype:expr, $output_array_type: ty, $expected:expr) => { - { - let out = cast(&$array, &$datatype).unwrap(); - let actual = out - .as_any() - .downcast_ref::<$output_array_type>() - .unwrap() - .into_iter() - .collect::>(); - assert_eq!(actual, $expected); - } - }; - ($array:expr, $datatype:expr, $output_array_type: ty, $options:expr, $expected:expr) => { - { - let out = cast_with_options(&$array, &$datatype, &$options).unwrap(); - let actual = out - .as_any() - .downcast_ref::<$output_array_type>() - .unwrap() - .into_iter() - .collect::>(); - assert_eq!(actual, $expected); - } - }; + ($array:expr, $datatype:expr, $output_array_type: ty, $expected:expr) => {{ + let out = cast(&$array, &$datatype).unwrap(); + let actual = out + .as_any() + .downcast_ref::<$output_array_type>() + .unwrap() + .into_iter() + .collect::>(); + assert_eq!(actual, $expected); + }}; + ($array:expr, $datatype:expr, $output_array_type: ty, $options:expr, $expected:expr) => {{ + let out = cast_with_options(&$array, &$datatype, &$options).unwrap(); + let actual = out + .as_any() + .downcast_ref::<$output_array_type>() + .unwrap() + .into_iter() + .collect::>(); + assert_eq!(actual, $expected); + }}; } #[test] @@ -5221,7 +5217,7 @@ mod tests { let expected = vec![ Some("1997-05-19T00:00:03.005"), Some("2018-12-25T00:00:02.001"), - None + None, ]; // assert_cast_timestamp_to_string!(array, DataType::Utf8View, StringViewArray, expected); @@ -5246,11 +5242,23 @@ mod tests { let expected = vec![ Some("1997-05-19 00:00:03.005000"), Some("2018-12-25 00:00:02.001000"), - None + None, ]; // assert_cast_timestamp_to_string!(array_without_tz, DataType::Utf8View, StringViewArray, cast_options, expected); - assert_cast_timestamp_to_string!(array_without_tz, DataType::Utf8, StringArray, cast_options, expected); - assert_cast_timestamp_to_string!(array_without_tz, DataType::LargeUtf8, LargeStringArray, cast_options, expected); + assert_cast_timestamp_to_string!( + array_without_tz, + DataType::Utf8, + StringArray, + cast_options, + expected + ); + assert_cast_timestamp_to_string!( + array_without_tz, + DataType::LargeUtf8, + LargeStringArray, + cast_options, + expected + ); let array_with_tz = TimestampMillisecondArray::from(vec![Some(864000003005), Some(1545696002001), None]) @@ -5258,11 +5266,23 @@ mod tests { let expected = vec![ Some("1997-05-19 05:45:03.005000"), Some("2018-12-25 05:45:02.001000"), - None + None, ]; // assert_cast_timestamp_to_string!(array_with_tz, DataType::Utf8View, StringViewArray, cast_options, expected); - assert_cast_timestamp_to_string!(array_with_tz, DataType::Utf8, StringArray, cast_options, expected); - assert_cast_timestamp_to_string!(array_with_tz, DataType::LargeUtf8, LargeStringArray, cast_options, expected); + assert_cast_timestamp_to_string!( + array_with_tz, + DataType::Utf8, + StringArray, + cast_options, + expected + ); + assert_cast_timestamp_to_string!( + array_with_tz, + DataType::LargeUtf8, + LargeStringArray, + cast_options, + expected + ); } #[test]