This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 50135e8c03 Use thiserror to implement the From trait for 
DFSqlLogicTestError (#6924)
50135e8c03 is described below

commit 50135e8c039b82d32b57db12ca06d789e9cbea4c
Author: Jonah Gao <[email protected]>
AuthorDate: Thu Jul 13 02:21:02 2023 +0800

    Use thiserror to implement the From trait for DFSqlLogicTestError (#6924)
---
 .../sqllogictests/src/engines/datafusion/error.rs  | 32 +++-------------------
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git 
a/datafusion/core/tests/sqllogictests/src/engines/datafusion/error.rs 
b/datafusion/core/tests/sqllogictests/src/engines/datafusion/error.rs
index ed6d1eda17..5bb40aca2a 100644
--- a/datafusion/core/tests/sqllogictests/src/engines/datafusion/error.rs
+++ b/datafusion/core/tests/sqllogictests/src/engines/datafusion/error.rs
@@ -28,45 +28,21 @@ pub type Result<T, E = DFSqlLogicTestError> = 
std::result::Result<T, E>;
 pub enum DFSqlLogicTestError {
     /// Error from sqllogictest-rs
     #[error("SqlLogicTest error(from sqllogictest-rs crate): {0}")]
-    SqlLogicTest(TestError),
+    SqlLogicTest(#[from] TestError),
     /// Error from datafusion
     #[error("DataFusion error: {0}")]
-    DataFusion(DataFusionError),
+    DataFusion(#[from] DataFusionError),
     /// Error returned when SQL is syntactically incorrect.
     #[error("SQL Parser error: {0}")]
-    Sql(ParserError),
+    Sql(#[from] ParserError),
     /// Error from arrow-rs
     #[error("Arrow error: {0}")]
-    Arrow(ArrowError),
+    Arrow(#[from] ArrowError),
     /// Generic error
     #[error("Other Error: {0}")]
     Other(String),
 }
 
-impl From<TestError> for DFSqlLogicTestError {
-    fn from(value: TestError) -> Self {
-        DFSqlLogicTestError::SqlLogicTest(value)
-    }
-}
-
-impl From<DataFusionError> for DFSqlLogicTestError {
-    fn from(value: DataFusionError) -> Self {
-        DFSqlLogicTestError::DataFusion(value)
-    }
-}
-
-impl From<ParserError> for DFSqlLogicTestError {
-    fn from(value: ParserError) -> Self {
-        DFSqlLogicTestError::Sql(value)
-    }
-}
-
-impl From<ArrowError> for DFSqlLogicTestError {
-    fn from(value: ArrowError) -> Self {
-        DFSqlLogicTestError::Arrow(value)
-    }
-}
-
 impl From<String> for DFSqlLogicTestError {
     fn from(value: String) -> Self {
         DFSqlLogicTestError::Other(value)

Reply via email to