@@ -888,6 +888,8 @@ fn coerced_from<'a>(
888888 ( Utf8View , Utf8 | LargeUtf8 | Null ) => Some ( type_into. clone ( ) ) ,
889889 // Any type can be coerced into strings
890890 ( Utf8 | LargeUtf8 , _) => Some ( type_into. clone ( ) ) ,
891+ // We can go into a BinaryView from a Binary or LargeBinary
892+ ( BinaryView , Binary | LargeBinary | Null ) => Some ( type_into. clone ( ) ) ,
891893 ( Null , _) if can_cast_types ( type_from, type_into) => Some ( type_into. clone ( ) ) ,
892894
893895 ( List ( _) , FixedSizeList ( _, _) ) => Some ( type_into. clone ( ) ) ,
@@ -956,6 +958,20 @@ mod tests {
956958 let cases = vec ! [
957959 ( DataType :: Utf8View , DataType :: Utf8 ) ,
958960 ( DataType :: Utf8View , DataType :: LargeUtf8 ) ,
961+ ( DataType :: Utf8View , DataType :: Null ) ,
962+ ] ;
963+
964+ for case in cases {
965+ assert_eq ! ( coerced_from( & case. 0 , & case. 1 ) , Some ( case. 0 ) ) ;
966+ }
967+ }
968+
969+ #[ test]
970+ fn test_binary_conversion ( ) {
971+ let cases = vec ! [
972+ ( DataType :: BinaryView , DataType :: Binary ) ,
973+ ( DataType :: BinaryView , DataType :: LargeBinary ) ,
974+ ( DataType :: BinaryView , DataType :: Null ) ,
959975 ] ;
960976
961977 for case in cases {
0 commit comments