@@ -1467,7 +1467,7 @@ pub fn cast_with_options(
1467
1467
( BinaryView , _) => Err ( ArrowError :: CastError ( format ! (
1468
1468
"Casting from {from_type:?} to {to_type:?} not supported" ,
1469
1469
) ) ) ,
1470
- ( from_type, Utf8View ) if from_type. is_numeric ( ) => {
1470
+ ( from_type, Utf8View ) if from_type. is_primitive ( ) => {
1471
1471
value_to_string_view ( array, cast_options)
1472
1472
}
1473
1473
( from_type, LargeUtf8 ) if from_type. is_primitive ( ) => {
@@ -5240,9 +5240,6 @@ mod tests {
5240
5240
assert_eq ! ( "2018-12-25T00:00:00" , c. value( 1 ) ) ;
5241
5241
}
5242
5242
5243
- // Cast Timestamp to Utf8View is not supported yet
5244
- // TODO: Implement casting from Timestamp to Utf8View
5245
- // https://github.com/apache/arrow-rs/issues/6734
5246
5243
macro_rules! assert_cast_timestamp_to_string {
5247
5244
( $array: expr, $datatype: expr, $output_array_type: ty, $expected: expr) => { {
5248
5245
let out = cast( & $array, & $datatype) . unwrap( ) ;
@@ -5277,7 +5274,7 @@ mod tests {
5277
5274
None ,
5278
5275
] ;
5279
5276
5280
- // assert_cast_timestamp_to_string!(array, DataType::Utf8View, StringViewArray, expected);
5277
+ assert_cast_timestamp_to_string ! ( array, DataType :: Utf8View , StringViewArray , expected) ;
5281
5278
assert_cast_timestamp_to_string ! ( array, DataType :: Utf8 , StringArray , expected) ;
5282
5279
assert_cast_timestamp_to_string ! ( array, DataType :: LargeUtf8 , LargeStringArray , expected) ;
5283
5280
}
@@ -5301,7 +5298,13 @@ mod tests {
5301
5298
Some ( "2018-12-25 00:00:02.001000" ) ,
5302
5299
None ,
5303
5300
] ;
5304
- // assert_cast_timestamp_to_string!(array_without_tz, DataType::Utf8View, StringViewArray, cast_options, expected);
5301
+ assert_cast_timestamp_to_string ! (
5302
+ array_without_tz,
5303
+ DataType :: Utf8View ,
5304
+ StringViewArray ,
5305
+ cast_options,
5306
+ expected
5307
+ ) ;
5305
5308
assert_cast_timestamp_to_string ! (
5306
5309
array_without_tz,
5307
5310
DataType :: Utf8 ,
@@ -5325,7 +5328,13 @@ mod tests {
5325
5328
Some ( "2018-12-25 05:45:02.001000" ) ,
5326
5329
None ,
5327
5330
] ;
5328
- // assert_cast_timestamp_to_string!(array_with_tz, DataType::Utf8View, StringViewArray, cast_options, expected);
5331
+ assert_cast_timestamp_to_string ! (
5332
+ array_with_tz,
5333
+ DataType :: Utf8View ,
5334
+ StringViewArray ,
5335
+ cast_options,
5336
+ expected
5337
+ ) ;
5329
5338
assert_cast_timestamp_to_string ! (
5330
5339
array_with_tz,
5331
5340
DataType :: Utf8 ,
0 commit comments