@@ -129,9 +129,7 @@ pub enum DataFusionError {
129
129
/// Errors originating from outside DataFusion's core codebase.
130
130
///
131
131
/// For example, a custom S3Error from the crate datafusion-objectstore-s3
132
- ///
133
- /// 2nd argument is for optional backtrace
134
- External ( GenericError , Option < String > ) ,
132
+ External ( GenericError ) ,
135
133
/// Error with additional context
136
134
Context ( String , Box < DataFusionError > ) ,
137
135
/// Errors from either mapping LogicalPlans to/from Substrait plans
@@ -294,7 +292,7 @@ impl From<DataFusionError> for ArrowError {
294
292
fn from ( e : DataFusionError ) -> Self {
295
293
match e {
296
294
DataFusionError :: ArrowError ( e, _) => e,
297
- DataFusionError :: External ( e, _ ) => ArrowError :: ExternalError ( e) ,
295
+ DataFusionError :: External ( e) => ArrowError :: ExternalError ( e) ,
298
296
other => ArrowError :: ExternalError ( Box :: new ( other) ) ,
299
297
}
300
298
}
@@ -355,7 +353,7 @@ impl From<GenericError> for DataFusionError {
355
353
unreachable ! ( )
356
354
}
357
355
} else {
358
- DataFusionError :: External ( err, None )
356
+ DataFusionError :: External ( err)
359
357
}
360
358
}
361
359
}
@@ -388,7 +386,7 @@ impl Error for DataFusionError {
388
386
DataFusionError :: Execution ( _) => None ,
389
387
DataFusionError :: ExecutionJoin ( e, _) => Some ( e) ,
390
388
DataFusionError :: ResourcesExhausted ( _) => None ,
391
- DataFusionError :: External ( e, _ ) => Some ( e. as_ref ( ) ) ,
389
+ DataFusionError :: External ( e) => Some ( e. as_ref ( ) ) ,
392
390
DataFusionError :: Context ( _, e) => Some ( e. as_ref ( ) ) ,
393
391
DataFusionError :: Substrait ( _) => None ,
394
392
DataFusionError :: Diagnostic ( _, e) => Some ( e. as_ref ( ) ) ,
@@ -522,7 +520,7 @@ impl DataFusionError {
522
520
DataFusionError :: ResourcesExhausted ( _) => {
523
521
"Resources exhausted: "
524
522
}
525
- DataFusionError :: External ( _, _ ) => "External error: " ,
523
+ DataFusionError :: External ( _) => "External error: " ,
526
524
DataFusionError :: Context ( _, _) => "" ,
527
525
DataFusionError :: Substrait ( _) => "Substrait error: " ,
528
526
DataFusionError :: Diagnostic ( _, _) => "" ,
@@ -567,10 +565,7 @@ impl DataFusionError {
567
565
Cow :: Owned ( format ! ( "{desc}{backtrace}" ) )
568
566
}
569
567
DataFusionError :: ResourcesExhausted ( ref desc) => Cow :: Owned ( desc. to_string ( ) ) ,
570
- DataFusionError :: External ( ref desc, ref backtrace) => {
571
- let backtrace = backtrace. clone ( ) . unwrap_or_else ( || "" . to_owned ( ) ) ;
572
- Cow :: Owned ( format ! ( "{desc}{backtrace}" ) )
573
- }
568
+ DataFusionError :: External ( ref desc) => Cow :: Owned ( desc. to_string ( ) ) ,
574
569
#[ cfg( feature = "object_store" ) ]
575
570
DataFusionError :: ObjectStore ( ref desc) => Cow :: Owned ( desc. to_string ( ) ) ,
576
571
DataFusionError :: Context ( ref desc, ref err) => {
@@ -923,11 +918,7 @@ macro_rules! schema_err {
923
918
#[ macro_export]
924
919
macro_rules! external_datafusion_err {
925
920
( $CONVERTIBLE_TO_ERR: expr $( ; diagnostic = $DIAG: expr) ?) => { {
926
- let err = $crate:: error:: DataFusionError :: External (
927
- // covert input to GenericError
928
- $crate:: error:: GenericError :: from( $CONVERTIBLE_TO_ERR) ,
929
- Some ( $crate:: error:: DataFusionError :: get_back_trace( ) )
930
- ) ;
921
+ let err = $crate:: error:: DataFusionError :: External ( $crate:: error:: GenericError :: from( $CONVERTIBLE_TO_ERR) ) . context( $crate:: error:: DataFusionError :: get_back_trace( ) ) ;
931
922
$(
932
923
let err = err. with_diagnostic( $DIAG) ;
933
924
) ?
@@ -1099,20 +1090,16 @@ mod test {
1099
1090
) ;
1100
1091
1101
1092
do_root_test (
1102
- DataFusionError :: External (
1103
- Box :: new ( DataFusionError :: ResourcesExhausted ( "foo" . to_string ( ) ) ) ,
1104
- None ,
1105
- ) ,
1093
+ DataFusionError :: External ( Box :: new ( DataFusionError :: ResourcesExhausted (
1094
+ "foo" . to_string ( ) ,
1095
+ ) ) ) ,
1106
1096
DataFusionError :: ResourcesExhausted ( "foo" . to_string ( ) ) ,
1107
1097
) ;
1108
1098
1109
1099
do_root_test (
1110
- DataFusionError :: External (
1111
- Box :: new ( ArrowError :: ExternalError ( Box :: new (
1112
- DataFusionError :: ResourcesExhausted ( "foo" . to_string ( ) ) ,
1113
- ) ) ) ,
1114
- None ,
1115
- ) ,
1100
+ DataFusionError :: External ( Box :: new ( ArrowError :: ExternalError ( Box :: new (
1101
+ DataFusionError :: ResourcesExhausted ( "foo" . to_string ( ) ) ,
1102
+ ) ) ) ) ,
1116
1103
DataFusionError :: ResourcesExhausted ( "foo" . to_string ( ) ) ,
1117
1104
) ;
1118
1105
@@ -1127,22 +1114,16 @@ mod test {
1127
1114
) ;
1128
1115
1129
1116
do_root_test (
1130
- DataFusionError :: External (
1131
- Box :: new ( Arc :: new ( DataFusionError :: ResourcesExhausted (
1132
- "foo" . to_string ( ) ,
1133
- ) ) ) ,
1134
- None ,
1135
- ) ,
1117
+ DataFusionError :: External ( Box :: new ( Arc :: new (
1118
+ DataFusionError :: ResourcesExhausted ( "foo" . to_string ( ) ) ,
1119
+ ) ) ) ,
1136
1120
DataFusionError :: ResourcesExhausted ( "foo" . to_string ( ) ) ,
1137
1121
) ;
1138
1122
1139
1123
do_root_test (
1140
- DataFusionError :: External (
1141
- Box :: new ( Arc :: new ( ArrowError :: ExternalError ( Box :: new (
1142
- DataFusionError :: ResourcesExhausted ( "foo" . to_string ( ) ) ,
1143
- ) ) ) ) ,
1144
- None ,
1145
- ) ,
1124
+ DataFusionError :: External ( Box :: new ( Arc :: new ( ArrowError :: ExternalError (
1125
+ Box :: new ( DataFusionError :: ResourcesExhausted ( "foo" . to_string ( ) ) ) ,
1126
+ ) ) ) ) ,
1146
1127
DataFusionError :: ResourcesExhausted ( "foo" . to_string ( ) ) ,
1147
1128
) ;
1148
1129
}
0 commit comments