@@ -1472,7 +1472,7 @@ pub fn cast_with_options(
14721472 ( BinaryView , _) => Err ( ArrowError :: CastError ( format ! (
14731473 "Casting from {from_type:?} to {to_type:?} not supported" ,
14741474 ) ) ) ,
1475- ( from_type, Utf8View ) if from_type. is_numeric ( ) => {
1475+ ( from_type, Utf8View ) if from_type. is_primitive ( ) => {
14761476 value_to_string_view ( array, cast_options)
14771477 }
14781478 ( from_type, LargeUtf8 ) if from_type. is_primitive ( ) => {
@@ -5258,9 +5258,6 @@ mod tests {
52585258 assert_eq ! ( "2018-12-25T00:00:00" , c. value( 1 ) ) ;
52595259 }
52605260
5261- // Cast Timestamp to Utf8View is not supported yet
5262- // TODO: Implement casting from Timestamp to Utf8View
5263- // https://github.com/apache/arrow-rs/issues/6734
52645261 macro_rules! assert_cast_timestamp_to_string {
52655262 ( $array: expr, $datatype: expr, $output_array_type: ty, $expected: expr) => { {
52665263 let out = cast( & $array, & $datatype) . unwrap( ) ;
@@ -5295,7 +5292,7 @@ mod tests {
52955292 None ,
52965293 ] ;
52975294
5298- // assert_cast_timestamp_to_string!(array, DataType::Utf8View, StringViewArray, expected);
5295+ assert_cast_timestamp_to_string ! ( array, DataType :: Utf8View , StringViewArray , expected) ;
52995296 assert_cast_timestamp_to_string ! ( array, DataType :: Utf8 , StringArray , expected) ;
53005297 assert_cast_timestamp_to_string ! ( array, DataType :: LargeUtf8 , LargeStringArray , expected) ;
53015298 }
@@ -5319,7 +5316,13 @@ mod tests {
53195316 Some ( "2018-12-25 00:00:02.001000" ) ,
53205317 None ,
53215318 ] ;
5322- // assert_cast_timestamp_to_string!(array_without_tz, DataType::Utf8View, StringViewArray, cast_options, expected);
5319+ assert_cast_timestamp_to_string ! (
5320+ array_without_tz,
5321+ DataType :: Utf8View ,
5322+ StringViewArray ,
5323+ cast_options,
5324+ expected
5325+ ) ;
53235326 assert_cast_timestamp_to_string ! (
53245327 array_without_tz,
53255328 DataType :: Utf8 ,
@@ -5343,7 +5346,13 @@ mod tests {
53435346 Some ( "2018-12-25 05:45:02.001000" ) ,
53445347 None ,
53455348 ] ;
5346- // assert_cast_timestamp_to_string!(array_with_tz, DataType::Utf8View, StringViewArray, cast_options, expected);
5349+ assert_cast_timestamp_to_string ! (
5350+ array_with_tz,
5351+ DataType :: Utf8View ,
5352+ StringViewArray ,
5353+ cast_options,
5354+ expected
5355+ ) ;
53475356 assert_cast_timestamp_to_string ! (
53485357 array_with_tz,
53495358 DataType :: Utf8 ,
0 commit comments