@@ -483,10 +483,12 @@ fn expr_test_schema() -> DFSchemaRef {
483
483
Field :: new( "c2" , DataType :: Boolean , true ) ,
484
484
Field :: new( "c3" , DataType :: Int64 , true ) ,
485
485
Field :: new( "c4" , DataType :: UInt32 , true ) ,
486
+ Field :: new( "c5" , DataType :: Utf8View , true ) ,
486
487
Field :: new( "c1_non_null" , DataType :: Utf8 , false ) ,
487
488
Field :: new( "c2_non_null" , DataType :: Boolean , false ) ,
488
489
Field :: new( "c3_non_null" , DataType :: Int64 , false ) ,
489
490
Field :: new( "c4_non_null" , DataType :: UInt32 , false ) ,
491
+ Field :: new( "c5_non_null" , DataType :: Utf8View , false ) ,
490
492
] )
491
493
. to_dfschema_ref ( )
492
494
. unwrap ( )
@@ -665,20 +667,32 @@ fn test_simplify_concat_ws_with_null() {
665
667
}
666
668
667
669
#[ test]
668
- fn test_simplify_concat ( ) {
670
+ fn test_simplify_concat ( ) -> Result < ( ) > {
671
+ let schema = expr_test_schema ( ) ;
669
672
let null = lit ( ScalarValue :: Utf8 ( None ) ) ;
670
673
let expr = concat ( vec ! [
671
674
null. clone( ) ,
672
- col( "c0 " ) ,
675
+ col( "c1 " ) ,
673
676
lit( "hello " ) ,
674
677
null. clone( ) ,
675
678
lit( "rust" ) ,
676
- col( "c1" ) ,
679
+ lit( ScalarValue :: Utf8View ( Some ( "!" . to_string( ) ) ) ) ,
680
+ col( "c2" ) ,
677
681
lit( "" ) ,
678
682
null,
683
+ col( "c5" ) ,
679
684
] ) ;
680
- let expected = concat ( vec ! [ col( "c0" ) , lit( "hello rust" ) , col( "c1" ) ] ) ;
681
- test_simplify ( expr, expected)
685
+ let expr_datatype = expr. get_type ( schema. as_ref ( ) ) ?;
686
+ let expected = concat ( vec ! [
687
+ col( "c1" ) ,
688
+ lit( ScalarValue :: Utf8View ( Some ( "hello rust!" . to_string( ) ) ) ) ,
689
+ col( "c2" ) ,
690
+ col( "c5" ) ,
691
+ ] ) ;
692
+ let expected_datatype = expected. get_type ( schema. as_ref ( ) ) ?;
693
+ assert_eq ! ( expr_datatype, expected_datatype) ;
694
+ test_simplify ( expr, expected) ;
695
+ Ok ( ( ) )
682
696
}
683
697
#[ test]
684
698
fn test_simplify_cycles ( ) {
0 commit comments