@@ -133,7 +133,7 @@ macro_rules! cmp {
133
133
( 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( ) ) ,
134
134
( A :: Decimal ( a) , A :: Decimal ( b) ) => binary_op( a. as_ref( ) , b. as_ref( ) , |a, b| a $op b) ,
135
135
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) ,
137
137
138
138
( A :: Date ( a) , A :: Date ( b) ) => binary_op( a. as_ref( ) , b. as_ref( ) , |a, b| a $op b) ,
139
139
@@ -209,7 +209,7 @@ impl ArrayImpl {
209
209
}
210
210
regex
211
211
}
212
- let A :: Utf8 ( a) = self else {
212
+ let A :: String ( a) = self else {
213
213
return Err ( ConvertError :: NoUnaryOp ( "like" . into ( ) , self . type_string ( ) ) ) ;
214
214
} ;
215
215
let regex = Regex :: new ( & like_to_regex ( pattern) ) . unwrap ( ) ;
@@ -219,11 +219,11 @@ impl ArrayImpl {
219
219
}
220
220
221
221
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 {
223
223
return Err ( ConvertError :: NoBinaryOp ( "||" . into ( ) , self . type_string ( ) , other. type_string ( ) ) ) ;
224
224
} ;
225
225
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| {
227
227
format ! ( "{a}{b}" )
228
228
} ) ) )
229
229
}
@@ -282,10 +282,10 @@ impl ArrayImpl {
282
282
}
283
283
284
284
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 {
286
286
return Err ( ConvertError :: NoTernaryOp ( "substring" . into ( ) , self . type_string ( ) , start. type_string ( ) , length. type_string ( ) ) ) ;
287
287
} ;
288
- Ok ( A :: new_utf8 ( ternary_op (
288
+ Ok ( A :: new_string ( ternary_op (
289
289
a. as_ref ( ) ,
290
290
b. as_ref ( ) ,
291
291
c. as_ref ( ) ,
@@ -354,7 +354,7 @@ impl ArrayImpl {
354
354
Self :: new_float64 ( unary_op ( a. as_ref ( ) , |& b| F64 :: from ( b as u8 as f64 ) ) )
355
355
}
356
356
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" } ) )
358
358
}
359
359
Type :: Decimal ( _, _) => {
360
360
Self :: new_decimal ( unary_op ( a. as_ref ( ) , |& b| Decimal :: from ( b as u8 ) ) )
@@ -375,7 +375,7 @@ impl ArrayImpl {
375
375
Type :: Int32 => Self :: new_int32 ( unary_op ( a. as_ref ( ) , |& b| b as i32 ) ) ,
376
376
Type :: Int64 => Self :: new_int64 ( unary_op ( a. as_ref ( ) , |& b| b as i64 ) ) ,
377
377
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 ( ) ) ) ,
379
379
Type :: Decimal ( _, _) => {
380
380
Self :: new_decimal ( unary_op ( a. as_ref ( ) , |& i| Decimal :: from ( i) ) )
381
381
}
@@ -398,7 +398,7 @@ impl ArrayImpl {
398
398
Type :: Int32 => Self :: Int32 ( a. clone ( ) ) ,
399
399
Type :: Int64 => Self :: new_int64 ( unary_op ( a. as_ref ( ) , |& b| b as i64 ) ) ,
400
400
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 ( ) ) ) ,
402
402
Type :: Decimal ( _, _) => {
403
403
Self :: new_decimal ( unary_op ( a. as_ref ( ) , |& i| Decimal :: from ( i) ) )
404
404
}
@@ -424,7 +424,7 @@ impl ArrayImpl {
424
424
} ) ?) ,
425
425
Type :: Int64 => Self :: Int64 ( a. clone ( ) ) ,
426
426
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 ( ) ) ) ,
428
428
Type :: Decimal ( _, _) => {
429
429
Self :: new_decimal ( unary_op ( a. as_ref ( ) , |& i| Decimal :: from ( i) ) )
430
430
}
@@ -453,7 +453,7 @@ impl ArrayImpl {
453
453
. ok_or ( ConvertError :: Overflow ( DataValue :: Float64 ( b) , Type :: Int64 ) )
454
454
} ) ?) ,
455
455
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 ( ) ) ) ,
457
457
Type :: Decimal ( _, _) => Self :: new_decimal ( unary_op ( a. as_ref ( ) , |& f| {
458
458
Decimal :: from_f64_retain ( f. 0 ) . unwrap ( )
459
459
} ) ) ,
@@ -467,7 +467,7 @@ impl ArrayImpl {
467
467
return Err ( ConvertError :: NoCast ( "DOUBLE" , data_type. clone ( ) ) ) ;
468
468
}
469
469
} ,
470
- Self :: Utf8 ( a) => match data_type {
470
+ Self :: String ( a) => match data_type {
471
471
Type :: Bool => Self :: new_bool ( try_unary_op ( a. as_ref ( ) , |s| {
472
472
s. parse :: < bool > ( )
473
473
. map_err ( |e| ConvertError :: ParseBool ( s. to_string ( ) , e) )
@@ -488,7 +488,7 @@ impl ArrayImpl {
488
488
s. parse :: < F64 > ( )
489
489
. map_err ( |e| ConvertError :: ParseFloat ( s. to_string ( ) , e) )
490
490
} ) ?) ,
491
- Type :: String => Self :: Utf8 ( a. clone ( ) ) ,
491
+ Type :: String => Self :: String ( a. clone ( ) ) ,
492
492
Type :: Decimal ( _, _) => Self :: new_decimal ( try_unary_op ( a. as_ref ( ) , |s| {
493
493
Decimal :: from_str ( s) . map_err ( |e| ConvertError :: ParseDecimal ( s. to_string ( ) , e) )
494
494
} ) ?) ,
@@ -533,7 +533,7 @@ impl ArrayImpl {
533
533
. map ( F64 :: from)
534
534
. ok_or ( ConvertError :: FromDecimalError ( DataTypeKind :: Float64 , d) )
535
535
} ) ?) ,
536
- Type :: String => Self :: new_utf8 ( Utf8Array :: from_iter_display ( a. iter ( ) ) ) ,
536
+ Type :: String => Self :: new_string ( StringArray :: from_iter_display ( a. iter ( ) ) ) ,
537
537
Type :: Decimal ( _, _) => self . clone ( ) ,
538
538
Type :: Null
539
539
| Type :: Blob
@@ -547,17 +547,17 @@ impl ArrayImpl {
547
547
} ,
548
548
Self :: Date ( a) => match data_type {
549
549
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 ( ) ) ) ,
551
551
_ => return Err ( ConvertError :: NoCast ( "DATE" , data_type. clone ( ) ) ) ,
552
552
} ,
553
553
Self :: Timestamp ( a) => match data_type {
554
554
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 ( ) ) ) ,
556
556
_ => return Err ( ConvertError :: NoCast ( "TIMESTAMP" , data_type. clone ( ) ) ) ,
557
557
} ,
558
558
Self :: TimestampTz ( a) => match data_type {
559
559
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 ( ) ) ) ,
561
561
_ => {
562
562
return Err ( ConvertError :: NoCast (
563
563
"TIMESTAMP WITH TIME ZONE" ,
@@ -567,7 +567,7 @@ impl ArrayImpl {
567
567
} ,
568
568
Self :: Interval ( a) => match data_type {
569
569
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 ( ) ) ) ,
571
571
_ => return Err ( ConvertError :: NoCast ( "INTERVAL" , data_type. clone ( ) ) ) ,
572
572
} ,
573
573
} )
@@ -592,10 +592,10 @@ impl ArrayImpl {
592
592
}
593
593
594
594
pub fn replace ( & self , from : & str , to : & str ) -> Result {
595
- let A :: Utf8 ( a) = self else {
595
+ let A :: String ( a) = self else {
596
596
return Err ( ConvertError :: NoUnaryOp ( "replace" . into ( ) , self . type_string ( ) ) ) ;
597
597
} ;
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) ) ) )
599
599
}
600
600
}
601
601
0 commit comments