alamb opened a new issue #1642: URL: https://github.com/apache/arrow-datafusion/issues/1642
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** Improve DataFusion error conversions Now that @matthewmturner made a DataFusionError::External https://github.com/apache/arrow-datafusion/pull/1541 , the story for converting back and forth to ArrowErrors is much better ❤️ However, I really want to be able to use `?` in functions that return an `ArrowError` or a `DataFusionError`]k Specifically, I want the following two cases to work ( ```rust /// Model what happens when implementing SendableRecrordBatchStream: /// DataFusion code needs to return an ArrowError fn return_arrow_error() -> arrow::error::Result<()> { // Expect the '?' to work let _foo = Err(DataFusionError::Internal("foo".to_string()))?; Ok(()) } /// Model what happens when using arrow kernels in DataFusion /// code: need to turn an ArrowError into a DataFusionError fn return_datafusion_error() -> crate::error::Result<()> { // Expect the '?' to work let _bar = Err(ArrowError::SchemaError("bar".to_string()))?; Ok(()) } ``` Unfortunately, the first example (converting a DataFusionError to an `ArrowError`) produces a compilation error: ``` error[E0277]: `?` couldn't convert the error to `arrow::error::ArrowError` --> datafusion/src/error.rs:184:69 | 182 | fn return_arrow_error() -> arrow::error::Result<()> { | ------------------------ expected `arrow::error::ArrowError` because of this 183 | // Expect the '?' to work 184 | let _foo = Err(DataFusionError::Internal("foo".to_string()))?; | ^ the trait `From<error::DataFusionError>` is not implemented for `arrow::error::ArrowError` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait = help: the following implementations were found: <arrow::error::ArrowError as From<FromUtf8Error>> <arrow::error::ArrowError as From<IntoInnerError<W>>> <arrow::error::ArrowError as From<csv::error::Error>> <arrow::error::ArrowError as From<serde_json::error::Error>> <arrow::error::ArrowError as From<std::io::Error>> = note: required because of the requirements on the impl of `FromResidual<std::result::Result<Infallible, error::DataFusionError>>` for `std::result::Result<(), arrow::error::ArrowError>` ``` **Describe the solution you'd like** Add the appropriate conversion method **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
