@@ -53,8 +53,7 @@ use datafusion_common::cast::{
53
53
as_timestamp_nanosecond_array, as_timestamp_second_array,
54
54
} ;
55
55
use datafusion_common:: {
56
- exec_err, internal_err, not_impl_err, DataFusionError , Result , ScalarType ,
57
- ScalarValue ,
56
+ exec_err, not_impl_err, DataFusionError , Result , ScalarType , ScalarValue ,
58
57
} ;
59
58
use datafusion_expr:: ColumnarValue ;
60
59
@@ -165,7 +164,7 @@ where
165
164
F : Fn ( & ' a str ) -> Result < O :: Native > ,
166
165
{
167
166
if args. len ( ) != 1 {
168
- return internal_err ! (
167
+ return exec_err ! (
169
168
"{:?} args were supplied but {} takes exactly one argument" ,
170
169
args. len( ) ,
171
170
name
@@ -202,7 +201,7 @@ where
202
201
F2 : Fn ( O :: Native ) -> O :: Native ,
203
202
{
204
203
if args. len ( ) < 2 {
205
- return internal_err ! (
204
+ return exec_err ! (
206
205
"{:?} args were supplied but {} takes 2 or more arguments" ,
207
206
args. len( ) ,
208
207
name
@@ -218,7 +217,7 @@ where
218
217
}
219
218
ColumnarValue :: Scalar ( s) => match s {
220
219
ScalarValue :: Utf8 ( a) | ScalarValue :: LargeUtf8 ( a) => Ok ( Either :: Right ( a) ) ,
221
- other => internal_err ! (
220
+ other => exec_err ! (
222
221
"Unexpected scalar type encountered '{other}' for function '{name}'"
223
222
) ,
224
223
} ,
@@ -420,7 +419,7 @@ fn to_timestamp_impl<T: ArrowTimestampType + ScalarType<i64>>(
420
419
|n| n / factor,
421
420
name,
422
421
) ,
423
- _ => internal_err ! ( "Unsupported 0 argument count for function {name}" ) ,
422
+ _ => exec_err ! ( "Unsupported 0 argument count for function {name}" ) ,
424
423
}
425
424
}
426
425
@@ -1190,7 +1189,7 @@ macro_rules! extract_date_part {
1190
1189
. map( |v| cast( & ( Arc :: new( v) as ArrayRef ) , & DataType :: Float64 ) ) ?)
1191
1190
}
1192
1191
} ,
1193
- datatype => internal_err !( "Extract does not support datatype {:?}" , datatype) ,
1192
+ datatype => exec_err !( "Extract does not support datatype {:?}" , datatype) ,
1194
1193
}
1195
1194
} ;
1196
1195
}
@@ -1316,7 +1315,7 @@ where
1316
1315
let n: i64 = n. into ( ) ;
1317
1316
n as f64 / 1_000_f64
1318
1317
} ) ,
1319
- _ => return internal_err ! ( "Can not convert {:?} to epoch" , array. data_type( ) ) ,
1318
+ _ => return exec_err ! ( "Can not convert {:?} to epoch" , array. data_type( ) ) ,
1320
1319
} ;
1321
1320
Ok ( b)
1322
1321
}
@@ -1331,7 +1330,7 @@ fn validate_to_timestamp_data_types(
1331
1330
// all good
1332
1331
}
1333
1332
_ => {
1334
- return Some ( internal_err ! (
1333
+ return Some ( exec_err ! (
1335
1334
"{name} function unsupported data type at index {}: {}" ,
1336
1335
idx + 1 ,
1337
1336
a. data_type( )
@@ -1346,7 +1345,7 @@ fn validate_to_timestamp_data_types(
1346
1345
/// to_timestamp() SQL function implementation
1347
1346
pub fn to_timestamp_invoke ( args : & [ ColumnarValue ] ) -> Result < ColumnarValue > {
1348
1347
if args. is_empty ( ) {
1349
- return internal_err ! (
1348
+ return exec_err ! (
1350
1349
"to_timestamp function requires 1 or more arguments, got {}" ,
1351
1350
args. len( )
1352
1351
) ;
@@ -1377,7 +1376,7 @@ pub fn to_timestamp_invoke(args: &[ColumnarValue]) -> Result<ColumnarValue> {
1377
1376
) ,
1378
1377
DataType :: Utf8 => to_timestamp ( args) ,
1379
1378
other => {
1380
- internal_err ! (
1379
+ exec_err ! (
1381
1380
"Unsupported data type {:?} for function to_timestamp" ,
1382
1381
other
1383
1382
)
@@ -1388,7 +1387,7 @@ pub fn to_timestamp_invoke(args: &[ColumnarValue]) -> Result<ColumnarValue> {
1388
1387
/// to_timestamp_millis() SQL function implementation
1389
1388
pub fn to_timestamp_millis_invoke ( args : & [ ColumnarValue ] ) -> Result < ColumnarValue > {
1390
1389
if args. is_empty ( ) {
1391
- return internal_err ! (
1390
+ return exec_err ! (
1392
1391
"to_timestamp_millis function requires 1 or more arguments, got {}" ,
1393
1392
args. len( )
1394
1393
) ;
@@ -1413,7 +1412,7 @@ pub fn to_timestamp_millis_invoke(args: &[ColumnarValue]) -> Result<ColumnarValu
1413
1412
) ,
1414
1413
DataType :: Utf8 => to_timestamp_millis ( args) ,
1415
1414
other => {
1416
- internal_err ! (
1415
+ exec_err ! (
1417
1416
"Unsupported data type {:?} for function to_timestamp_millis" ,
1418
1417
other
1419
1418
)
@@ -1424,7 +1423,7 @@ pub fn to_timestamp_millis_invoke(args: &[ColumnarValue]) -> Result<ColumnarValu
1424
1423
/// to_timestamp_micros() SQL function implementation
1425
1424
pub fn to_timestamp_micros_invoke ( args : & [ ColumnarValue ] ) -> Result < ColumnarValue > {
1426
1425
if args. is_empty ( ) {
1427
- return internal_err ! (
1426
+ return exec_err ! (
1428
1427
"to_timestamp_micros function requires 1 or more arguments, got {}" ,
1429
1428
args. len( )
1430
1429
) ;
@@ -1449,7 +1448,7 @@ pub fn to_timestamp_micros_invoke(args: &[ColumnarValue]) -> Result<ColumnarValu
1449
1448
) ,
1450
1449
DataType :: Utf8 => to_timestamp_micros ( args) ,
1451
1450
other => {
1452
- internal_err ! (
1451
+ exec_err ! (
1453
1452
"Unsupported data type {:?} for function to_timestamp_micros" ,
1454
1453
other
1455
1454
)
@@ -1460,7 +1459,7 @@ pub fn to_timestamp_micros_invoke(args: &[ColumnarValue]) -> Result<ColumnarValu
1460
1459
/// to_timestamp_nanos() SQL function implementation
1461
1460
pub fn to_timestamp_nanos_invoke ( args : & [ ColumnarValue ] ) -> Result < ColumnarValue > {
1462
1461
if args. is_empty ( ) {
1463
- return internal_err ! (
1462
+ return exec_err ! (
1464
1463
"to_timestamp_nanos function requires 1 or more arguments, got {}" ,
1465
1464
args. len( )
1466
1465
) ;
@@ -1485,7 +1484,7 @@ pub fn to_timestamp_nanos_invoke(args: &[ColumnarValue]) -> Result<ColumnarValue
1485
1484
) ,
1486
1485
DataType :: Utf8 => to_timestamp_nanos ( args) ,
1487
1486
other => {
1488
- internal_err ! (
1487
+ exec_err ! (
1489
1488
"Unsupported data type {:?} for function to_timestamp_nanos" ,
1490
1489
other
1491
1490
)
@@ -1496,7 +1495,7 @@ pub fn to_timestamp_nanos_invoke(args: &[ColumnarValue]) -> Result<ColumnarValue
1496
1495
/// to_timestamp_seconds() SQL function implementation
1497
1496
pub fn to_timestamp_seconds_invoke ( args : & [ ColumnarValue ] ) -> Result < ColumnarValue > {
1498
1497
if args. is_empty ( ) {
1499
- return internal_err ! (
1498
+ return exec_err ! (
1500
1499
"to_timestamp_seconds function requires 1 or more arguments, got {}" ,
1501
1500
args. len( )
1502
1501
) ;
@@ -1520,7 +1519,7 @@ pub fn to_timestamp_seconds_invoke(args: &[ColumnarValue]) -> Result<ColumnarVal
1520
1519
}
1521
1520
DataType :: Utf8 => to_timestamp_seconds ( args) ,
1522
1521
other => {
1523
- internal_err ! (
1522
+ exec_err ! (
1524
1523
"Unsupported data type {:?} for function to_timestamp_seconds" ,
1525
1524
other
1526
1525
)
@@ -1531,7 +1530,7 @@ pub fn to_timestamp_seconds_invoke(args: &[ColumnarValue]) -> Result<ColumnarVal
1531
1530
/// from_unixtime() SQL function implementation
1532
1531
pub fn from_unixtime_invoke ( args : & [ ColumnarValue ] ) -> Result < ColumnarValue > {
1533
1532
if args. len ( ) != 1 {
1534
- return internal_err ! (
1533
+ return exec_err ! (
1535
1534
"from_unixtime function requires 1 argument, got {}" ,
1536
1535
args. len( )
1537
1536
) ;
@@ -1542,7 +1541,7 @@ pub fn from_unixtime_invoke(args: &[ColumnarValue]) -> Result<ColumnarValue> {
1542
1541
cast_column ( & args[ 0 ] , & DataType :: Timestamp ( TimeUnit :: Second , None ) , None )
1543
1542
}
1544
1543
other => {
1545
- internal_err ! (
1544
+ exec_err ! (
1546
1545
"Unsupported data type {:?} for function from_unixtime" ,
1547
1546
other
1548
1547
)
0 commit comments