@@ -133,7 +133,7 @@ macro_rules! cmp {
133133 ( A :: Decimal ( a) , A :: Float64 ( b) ) => binary_op( a. as_ref( ) , b. as_ref( ) , |a, b| * a $op Decimal :: from_f64_retain( b. 0 ) . unwrap( ) ) ,
134134 ( A :: Decimal ( a) , A :: Decimal ( b) ) => binary_op( a. as_ref( ) , b. as_ref( ) , |a, b| a $op b) ,
135135
136- ( A :: Utf8 ( a) , A :: Utf8 ( b) ) => binary_op( a. as_ref( ) , b. as_ref( ) , |a, b| a $op b) ,
136+ ( A :: String ( a) , A :: String ( b) ) => binary_op( a. as_ref( ) , b. as_ref( ) , |a, b| a $op b) ,
137137
138138 ( A :: Date ( a) , A :: Date ( b) ) => binary_op( a. as_ref( ) , b. as_ref( ) , |a, b| a $op b) ,
139139
@@ -209,7 +209,7 @@ impl ArrayImpl {
209209 }
210210 regex
211211 }
212- let A :: Utf8 ( a) = self else {
212+ let A :: String ( a) = self else {
213213 return Err ( ConvertError :: NoUnaryOp ( "like" . into ( ) , self . type_string ( ) ) ) ;
214214 } ;
215215 let regex = Regex :: new ( & like_to_regex ( pattern) ) . unwrap ( ) ;
@@ -219,11 +219,11 @@ impl ArrayImpl {
219219 }
220220
221221 pub fn concat ( & self , other : & Self ) -> Result {
222- let ( A :: Utf8 ( a) , A :: Utf8 ( b) ) = ( self , other) else {
222+ let ( A :: String ( a) , A :: String ( b) ) = ( self , other) else {
223223 return Err ( ConvertError :: NoBinaryOp ( "||" . into ( ) , self . type_string ( ) , other. type_string ( ) ) ) ;
224224 } ;
225225
226- Ok ( A :: new_utf8 ( binary_op ( a. as_ref ( ) , b. as_ref ( ) , |a, b| {
226+ Ok ( A :: new_string ( binary_op ( a. as_ref ( ) , b. as_ref ( ) , |a, b| {
227227 format ! ( "{a}{b}" )
228228 } ) ) )
229229 }
@@ -282,10 +282,10 @@ impl ArrayImpl {
282282 }
283283
284284 pub fn substring ( & self , start : & Self , length : & Self ) -> Result {
285- let ( A :: Utf8 ( a) , A :: Int32 ( b) , A :: Int32 ( c) ) = ( self , start, length) else {
285+ let ( A :: String ( a) , A :: Int32 ( b) , A :: Int32 ( c) ) = ( self , start, length) else {
286286 return Err ( ConvertError :: NoTernaryOp ( "substring" . into ( ) , self . type_string ( ) , start. type_string ( ) , length. type_string ( ) ) ) ;
287287 } ;
288- Ok ( A :: new_utf8 ( ternary_op (
288+ Ok ( A :: new_string ( ternary_op (
289289 a. as_ref ( ) ,
290290 b. as_ref ( ) ,
291291 c. as_ref ( ) ,
@@ -354,7 +354,7 @@ impl ArrayImpl {
354354 Self :: new_float64 ( unary_op ( a. as_ref ( ) , |& b| F64 :: from ( b as u8 as f64 ) ) )
355355 }
356356 Type :: String => {
357- Self :: new_utf8 ( unary_op ( a. as_ref ( ) , |& b| if b { "true" } else { "false" } ) )
357+ Self :: new_string ( unary_op ( a. as_ref ( ) , |& b| if b { "true" } else { "false" } ) )
358358 }
359359 Type :: Decimal ( _, _) => {
360360 Self :: new_decimal ( unary_op ( a. as_ref ( ) , |& b| Decimal :: from ( b as u8 ) ) )
@@ -375,7 +375,7 @@ impl ArrayImpl {
375375 Type :: Int32 => Self :: new_int32 ( unary_op ( a. as_ref ( ) , |& b| b as i32 ) ) ,
376376 Type :: Int64 => Self :: new_int64 ( unary_op ( a. as_ref ( ) , |& b| b as i64 ) ) ,
377377 Type :: Float64 => Self :: new_float64 ( unary_op ( a. as_ref ( ) , |& i| F64 :: from ( i as f64 ) ) ) ,
378- Type :: String => Self :: new_utf8 ( Utf8Array :: from_iter_display ( a. iter ( ) ) ) ,
378+ Type :: String => Self :: new_string ( StringArray :: from_iter_display ( a. iter ( ) ) ) ,
379379 Type :: Decimal ( _, _) => {
380380 Self :: new_decimal ( unary_op ( a. as_ref ( ) , |& i| Decimal :: from ( i) ) )
381381 }
@@ -398,7 +398,7 @@ impl ArrayImpl {
398398 Type :: Int32 => Self :: Int32 ( a. clone ( ) ) ,
399399 Type :: Int64 => Self :: new_int64 ( unary_op ( a. as_ref ( ) , |& b| b as i64 ) ) ,
400400 Type :: Float64 => Self :: new_float64 ( unary_op ( a. as_ref ( ) , |& i| F64 :: from ( i as f64 ) ) ) ,
401- Type :: String => Self :: new_utf8 ( Utf8Array :: from_iter_display ( a. iter ( ) ) ) ,
401+ Type :: String => Self :: new_string ( StringArray :: from_iter_display ( a. iter ( ) ) ) ,
402402 Type :: Decimal ( _, _) => {
403403 Self :: new_decimal ( unary_op ( a. as_ref ( ) , |& i| Decimal :: from ( i) ) )
404404 }
@@ -424,7 +424,7 @@ impl ArrayImpl {
424424 } ) ?) ,
425425 Type :: Int64 => Self :: Int64 ( a. clone ( ) ) ,
426426 Type :: Float64 => Self :: new_float64 ( unary_op ( a. as_ref ( ) , |& i| F64 :: from ( i as f64 ) ) ) ,
427- Type :: String => Self :: new_utf8 ( Utf8Array :: from_iter_display ( a. iter ( ) ) ) ,
427+ Type :: String => Self :: new_string ( StringArray :: from_iter_display ( a. iter ( ) ) ) ,
428428 Type :: Decimal ( _, _) => {
429429 Self :: new_decimal ( unary_op ( a. as_ref ( ) , |& i| Decimal :: from ( i) ) )
430430 }
@@ -453,7 +453,7 @@ impl ArrayImpl {
453453 . ok_or ( ConvertError :: Overflow ( DataValue :: Float64 ( b) , Type :: Int64 ) )
454454 } ) ?) ,
455455 Type :: Float64 => Self :: Float64 ( a. clone ( ) ) ,
456- Type :: String => Self :: new_utf8 ( Utf8Array :: from_iter_display ( a. iter ( ) ) ) ,
456+ Type :: String => Self :: new_string ( StringArray :: from_iter_display ( a. iter ( ) ) ) ,
457457 Type :: Decimal ( _, _) => Self :: new_decimal ( unary_op ( a. as_ref ( ) , |& f| {
458458 Decimal :: from_f64_retain ( f. 0 ) . unwrap ( )
459459 } ) ) ,
@@ -467,7 +467,7 @@ impl ArrayImpl {
467467 return Err ( ConvertError :: NoCast ( "DOUBLE" , data_type. clone ( ) ) ) ;
468468 }
469469 } ,
470- Self :: Utf8 ( a) => match data_type {
470+ Self :: String ( a) => match data_type {
471471 Type :: Bool => Self :: new_bool ( try_unary_op ( a. as_ref ( ) , |s| {
472472 s. parse :: < bool > ( )
473473 . map_err ( |e| ConvertError :: ParseBool ( s. to_string ( ) , e) )
@@ -488,7 +488,7 @@ impl ArrayImpl {
488488 s. parse :: < F64 > ( )
489489 . map_err ( |e| ConvertError :: ParseFloat ( s. to_string ( ) , e) )
490490 } ) ?) ,
491- Type :: String => Self :: Utf8 ( a. clone ( ) ) ,
491+ Type :: String => Self :: String ( a. clone ( ) ) ,
492492 Type :: Decimal ( _, _) => Self :: new_decimal ( try_unary_op ( a. as_ref ( ) , |s| {
493493 Decimal :: from_str ( s) . map_err ( |e| ConvertError :: ParseDecimal ( s. to_string ( ) , e) )
494494 } ) ?) ,
@@ -533,7 +533,7 @@ impl ArrayImpl {
533533 . map ( F64 :: from)
534534 . ok_or ( ConvertError :: FromDecimalError ( DataTypeKind :: Float64 , d) )
535535 } ) ?) ,
536- Type :: String => Self :: new_utf8 ( Utf8Array :: from_iter_display ( a. iter ( ) ) ) ,
536+ Type :: String => Self :: new_string ( StringArray :: from_iter_display ( a. iter ( ) ) ) ,
537537 Type :: Decimal ( _, _) => self . clone ( ) ,
538538 Type :: Null
539539 | Type :: Blob
@@ -547,17 +547,17 @@ impl ArrayImpl {
547547 } ,
548548 Self :: Date ( a) => match data_type {
549549 Type :: Date => self . clone ( ) ,
550- Type :: String => Self :: new_utf8 ( Utf8Array :: from_iter_display ( a. iter ( ) ) ) ,
550+ Type :: String => Self :: new_string ( StringArray :: from_iter_display ( a. iter ( ) ) ) ,
551551 _ => return Err ( ConvertError :: NoCast ( "DATE" , data_type. clone ( ) ) ) ,
552552 } ,
553553 Self :: Timestamp ( a) => match data_type {
554554 Type :: Timestamp => self . clone ( ) ,
555- Type :: String => Self :: new_utf8 ( Utf8Array :: from_iter_display ( a. iter ( ) ) ) ,
555+ Type :: String => Self :: new_string ( StringArray :: from_iter_display ( a. iter ( ) ) ) ,
556556 _ => return Err ( ConvertError :: NoCast ( "TIMESTAMP" , data_type. clone ( ) ) ) ,
557557 } ,
558558 Self :: TimestampTz ( a) => match data_type {
559559 Type :: TimestampTz => self . clone ( ) ,
560- Type :: String => Self :: new_utf8 ( Utf8Array :: from_iter_display ( a. iter ( ) ) ) ,
560+ Type :: String => Self :: new_string ( StringArray :: from_iter_display ( a. iter ( ) ) ) ,
561561 _ => {
562562 return Err ( ConvertError :: NoCast (
563563 "TIMESTAMP WITH TIME ZONE" ,
@@ -567,7 +567,7 @@ impl ArrayImpl {
567567 } ,
568568 Self :: Interval ( a) => match data_type {
569569 Type :: Interval => self . clone ( ) ,
570- Type :: String => Self :: new_utf8 ( Utf8Array :: from_iter_display ( a. iter ( ) ) ) ,
570+ Type :: String => Self :: new_string ( StringArray :: from_iter_display ( a. iter ( ) ) ) ,
571571 _ => return Err ( ConvertError :: NoCast ( "INTERVAL" , data_type. clone ( ) ) ) ,
572572 } ,
573573 } )
@@ -592,10 +592,10 @@ impl ArrayImpl {
592592 }
593593
594594 pub fn replace ( & self , from : & str , to : & str ) -> Result {
595- let A :: Utf8 ( a) = self else {
595+ let A :: String ( a) = self else {
596596 return Err ( ConvertError :: NoUnaryOp ( "replace" . into ( ) , self . type_string ( ) ) ) ;
597597 } ;
598- Ok ( A :: new_utf8 ( unary_op ( a. as_ref ( ) , |s| s. replace ( from, to) ) ) )
598+ Ok ( A :: new_string ( unary_op ( a. as_ref ( ) , |s| s. replace ( from, to) ) ) )
599599 }
600600}
601601
0 commit comments