@@ -529,7 +529,7 @@ fn general_except<OffsetSize: OffsetSizeTrait>(
529529
530530pub fn array_except ( args : & [ ArrayRef ] ) -> Result < ArrayRef > {
531531 if args. len ( ) != 2 {
532- return internal_err ! ( "array_except needs two arguments" ) ;
532+ return exec_err ! ( "array_except needs two arguments" ) ;
533533 }
534534
535535 let array1 = & args[ 0 ] ;
@@ -894,7 +894,7 @@ pub fn gen_range(args: &[ArrayRef]) -> Result<ArrayRef> {
894894 as_int64_array ( & args[ 1 ] ) ?,
895895 Some ( as_int64_array ( & args[ 2 ] ) ?) ,
896896 ) ,
897- _ => return internal_err ! ( "gen_range expects 1 to 3 arguments" ) ,
897+ _ => return exec_err ! ( "gen_range expects 1 to 3 arguments" ) ,
898898 } ;
899899
900900 let mut values = vec ! [ ] ;
@@ -948,7 +948,7 @@ pub fn array_sort(args: &[ArrayRef]) -> Result<ArrayRef> {
948948 nulls_first : order_nulls_first ( nulls_first) ?,
949949 } )
950950 }
951- _ => return internal_err ! ( "array_sort expects 1 to 3 arguments" ) ,
951+ _ => return exec_err ! ( "array_sort expects 1 to 3 arguments" ) ,
952952 } ;
953953
954954 let list_array = as_list_array ( & args[ 0 ] ) ?;
@@ -994,15 +994,15 @@ fn order_desc(modifier: &str) -> Result<bool> {
994994 match modifier. to_uppercase ( ) . as_str ( ) {
995995 "DESC" => Ok ( true ) ,
996996 "ASC" => Ok ( false ) ,
997- _ => internal_err ! ( "the second parameter of array_sort expects DESC or ASC" ) ,
997+ _ => exec_err ! ( "the second parameter of array_sort expects DESC or ASC" ) ,
998998 }
999999}
10001000
10011001fn order_nulls_first ( modifier : & str ) -> Result < bool > {
10021002 match modifier. to_uppercase ( ) . as_str ( ) {
10031003 "NULLS FIRST" => Ok ( true ) ,
10041004 "NULLS LAST" => Ok ( false ) ,
1005- _ => internal_err ! (
1005+ _ => exec_err ! (
10061006 "the third parameter of array_sort expects NULLS FIRST or NULLS LAST"
10071007 ) ,
10081008 }
@@ -1208,7 +1208,7 @@ pub fn array_empty(args: &[ArrayRef]) -> Result<ArrayRef> {
12081208 match array_type {
12091209 DataType :: List ( _) => array_empty_dispatch :: < i32 > ( & args[ 0 ] ) ,
12101210 DataType :: LargeList ( _) => array_empty_dispatch :: < i64 > ( & args[ 0 ] ) ,
1211- _ => internal_err ! ( "array_empty does not support type '{array_type:?}'." ) ,
1211+ _ => exec_err ! ( "array_empty does not support type '{array_type:?}'." ) ,
12121212 }
12131213}
12141214
@@ -1598,7 +1598,9 @@ fn array_remove_internal(
15981598 let list_array = array. as_list :: < i64 > ( ) ;
15991599 general_remove :: < i64 > ( list_array, element_array, arr_n)
16001600 }
1601- _ => internal_err ! ( "array_remove_all expects a list array" ) ,
1601+ array_type => {
1602+ exec_err ! ( "array_remove_all does not support type '{array_type:?}'." )
1603+ }
16021604 }
16031605}
16041606
@@ -2260,10 +2262,7 @@ pub fn array_length(args: &[ArrayRef]) -> Result<ArrayRef> {
22602262 match & args[ 0 ] . data_type ( ) {
22612263 DataType :: List ( _) => array_length_dispatch :: < i32 > ( args) ,
22622264 DataType :: LargeList ( _) => array_length_dispatch :: < i64 > ( args) ,
2263- _ => internal_err ! (
2264- "array_length does not support type '{:?}'" ,
2265- args[ 0 ] . data_type( )
2266- ) ,
2265+ array_type => exec_err ! ( "array_length does not support type '{array_type:?}'" ) ,
22672266 }
22682267}
22692268
@@ -2288,11 +2287,8 @@ pub fn array_dims(args: &[ArrayRef]) -> Result<ArrayRef> {
22882287 . map ( compute_array_dims)
22892288 . collect :: < Result < Vec < _ > > > ( ) ?
22902289 }
2291- _ => {
2292- return exec_err ! (
2293- "array_dims does not support type '{:?}'" ,
2294- args[ 0 ] . data_type( )
2295- ) ;
2290+ array_type => {
2291+ return exec_err ! ( "array_dims does not support type '{array_type:?}'" ) ;
22962292 }
22972293 } ;
22982294
@@ -2441,7 +2437,7 @@ pub fn array_has_any(args: &[ArrayRef]) -> Result<ArrayRef> {
24412437 DataType :: LargeList ( _) => {
24422438 general_array_has_dispatch :: < i64 > ( & args[ 0 ] , & args[ 1 ] , ComparisonType :: Any )
24432439 }
2444- _ => internal_err ! ( "array_has_any does not support type '{array_type:?}'." ) ,
2440+ _ => exec_err ! ( "array_has_any does not support type '{array_type:?}'." ) ,
24452441 }
24462442}
24472443
@@ -2460,7 +2456,7 @@ pub fn array_has_all(args: &[ArrayRef]) -> Result<ArrayRef> {
24602456 DataType :: LargeList ( _) => {
24612457 general_array_has_dispatch :: < i64 > ( & args[ 0 ] , & args[ 1 ] , ComparisonType :: All )
24622458 }
2463- _ => internal_err ! ( "array_has_all does not support type '{array_type:?}'." ) ,
2459+ _ => exec_err ! ( "array_has_all does not support type '{array_type:?}'." ) ,
24642460 }
24652461}
24662462
@@ -2543,7 +2539,7 @@ pub fn string_to_array<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef
25432539 } ) ;
25442540 }
25452541 _ => {
2546- return internal_err ! (
2542+ return exec_err ! (
25472543 "Expect string_to_array function to take two or three parameters"
25482544 )
25492545 }
@@ -2611,7 +2607,7 @@ pub fn array_distinct(args: &[ArrayRef]) -> Result<ArrayRef> {
26112607 let array = as_large_list_array ( & args[ 0 ] ) ?;
26122608 general_array_distinct ( array, field)
26132609 }
2614- _ => internal_err ! ( "array_distinct only support list array " ) ,
2610+ array_type => exec_err ! ( "array_distinct does not support type '{array_type:?}' " ) ,
26152611 }
26162612}
26172613
0 commit comments