@@ -43,10 +43,10 @@ use datafusion_expr::expr_schema::cast_subquery;
4343use datafusion_expr:: logical_plan:: Subquery ;
4444use datafusion_expr:: type_coercion:: binary:: { comparison_coercion, like_coercion} ;
4545use datafusion_expr:: type_coercion:: functions:: { UDFCoercionExt , fields_with_udf} ;
46+ use datafusion_expr:: type_coercion:: is_datetime;
4647use datafusion_expr:: type_coercion:: other:: {
4748 get_coerce_type_for_case_expression, get_coerce_type_for_list,
4849} ;
49- use datafusion_expr:: type_coercion:: { is_datetime, is_utf8_or_utf8view_or_large_utf8} ;
5050use datafusion_expr:: utils:: merge_schema;
5151use datafusion_expr:: {
5252 Cast , Expr , ExprSchemable , Join , Limit , LogicalPlan , Operator , Projection , Union ,
@@ -513,10 +513,8 @@ impl TreeNodeRewriter for TypeCoercionRewriter<'_> {
513513 . data ;
514514 let expr_type = expr. get_type ( self . schema ) ?;
515515 let subquery_type = new_plan. schema ( ) . field ( 0 ) . data_type ( ) ;
516- if ( expr_type. is_numeric ( )
517- && is_utf8_or_utf8view_or_large_utf8 ( subquery_type) )
518- || ( subquery_type. is_numeric ( )
519- && is_utf8_or_utf8view_or_large_utf8 ( & expr_type) )
516+ if ( expr_type. is_numeric ( ) && subquery_type. is_string ( ) )
517+ || ( subquery_type. is_numeric ( ) && expr_type. is_string ( ) )
520518 {
521519 return plan_err ! (
522520 "expr type {expr_type} can't cast to {subquery_type} in SetComparison"
@@ -890,12 +888,15 @@ fn coerce_frame_bound(
890888
891889fn extract_window_frame_target_type ( col_type : & DataType ) -> Result < DataType > {
892890 if col_type. is_numeric ( )
893- || is_utf8_or_utf8view_or_large_utf8 ( col_type)
894- || matches ! ( col_type, DataType :: List ( _) )
895- || matches ! ( col_type, DataType :: LargeList ( _) )
896- || matches ! ( col_type, DataType :: FixedSizeList ( _, _) )
897- || matches ! ( col_type, DataType :: Null )
898- || matches ! ( col_type, DataType :: Boolean )
891+ || col_type. is_string ( )
892+ || col_type. is_null ( )
893+ || matches ! (
894+ col_type,
895+ DataType :: List ( _)
896+ | DataType :: LargeList ( _)
897+ | DataType :: FixedSizeList ( _, _)
898+ | DataType :: Boolean
899+ )
899900 {
900901 Ok ( col_type. clone ( ) )
901902 } else if is_datetime ( col_type) {
0 commit comments