You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/30 15:23:05 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4437: feat: `DataFusionError::find_root`

alamb commented on code in PR #4437:
URL: https://github.com/apache/arrow-datafusion/pull/4437#discussion_r1036108112


##########
datafusion/common/src/error.rs:
##########
@@ -333,8 +334,101 @@ impl From<DataFusionError> for io::Error {
     }
 }
 
+/// Helper for [`DataFusionError::find_root`].
+enum OtherErr<'a> {
+    Arrow(&'a ArrowError),
+    Dyn(&'a (dyn std::error::Error + Send + Sync + 'static)),
+}
+
+impl DataFusionError {
+    /// Get underlying error.

Review Comment:
   ```suggestion
       /// Get deepest underlying [`DataFusionError`]
       ///
       /// [`DatafusionError`]s sometimes form a chain, such as `DatafusionError::ArrowError()` in order to conform
       /// to the correct error signature. Thus sometimes there is a chain several layers deep that can obscure the
       /// original error. This function finds the lowest level DataFusionError possible.
       ///
       /// For example,  `find_root` will return`DataFusionError::ResourceExhausted` given the input
       /// ```text
       /// DataFusionError::ArrowError
       ///   ArrowError::External
       ///    Box(DataFusionError::Context)
       ///      DataFusionError::ResourceExhausted
       /// ```
   ```



##########
datafusion/common/src/error.rs:
##########
@@ -353,6 +447,61 @@ mod test {
         assert_eq!(res.to_string(), "Arrow error: Schema error: bar");
     }
 
+    #[test]
+    fn test_find_root_error() {

Review Comment:
   👍 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org