diff --git a/core/src/execution/datafusion/planner.rs b/core/src/execution/datafusion/planner.rs index 6c7ea0de4..cc5943093 100644 --- a/core/src/execution/datafusion/planner.rs +++ b/core/src/execution/datafusion/planner.rs @@ -1382,7 +1382,7 @@ impl PhysicalPlanner { impl From for ExecutionError { fn from(value: DataFusionError) -> Self { - ExecutionError::DataFusionError(value.to_string()) + ExecutionError::DataFusionError(value.message().to_string()) } } @@ -1554,6 +1554,7 @@ mod tests { spark_operator, }; + use crate::execution::operators::ExecutionError; use spark_expression::expr::ExprStruct::*; use spark_operator::{operator::OpStruct, Operator}; @@ -1743,6 +1744,14 @@ mod tests { assert!(output.is_empty()); } + #[tokio::test()] + async fn from_datafusion_error_to_comet() { + let err_msg = "exec error"; + let err = datafusion_common::DataFusionError::Execution(err_msg.to_string()); + let comet_err: ExecutionError = err.into(); + assert_eq!(comet_err.to_string(), "Error from DataFusion: exec error."); + } + // Creates a filter operator which takes an `Int32Array` and selects rows that are equal to // `value`. fn create_filter(child_op: spark_operator::Operator, value: i32) -> spark_operator::Operator { diff --git a/core/src/execution/operators/mod.rs b/core/src/execution/operators/mod.rs index 5d05fdb8d..13a0d9627 100644 --- a/core/src/execution/operators/mod.rs +++ b/core/src/execution/operators/mod.rs @@ -38,19 +38,19 @@ pub use copy::*; pub enum ExecutionError { /// Simple error #[allow(dead_code)] - #[error("General execution error with reason {0}.")] + #[error("General execution error with reason: {0}.")] GeneralError(String), /// Error when deserializing an operator. - #[error("Fail to deserialize to native operator with reason {0}.")] + #[error("Fail to deserialize to native operator with reason: {0}.")] DeserializeError(String), /// Error when processing Arrow array. - #[error("Fail to process Arrow array with reason {0}.")] + #[error("Fail to process Arrow array with reason: {0}.")] ArrowError(String), /// DataFusion error - #[error("Error from DataFusion {0}.")] + #[error("Error from DataFusion: {0}.")] DataFusionError(String), }