From ff013e24559850541c54cf5d254922649ef37d8c Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Thu, 9 Mar 2023 00:41:14 +0100 Subject: [PATCH] minor: improve error style (#5510) --- datafusion/core/tests/simplification.rs | 5 +---- datafusion/optimizer/src/simplify_expressions/context.rs | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/datafusion/core/tests/simplification.rs b/datafusion/core/tests/simplification.rs index f6b944b50448..434a0ddbf1e9 100644 --- a/datafusion/core/tests/simplification.rs +++ b/datafusion/core/tests/simplification.rs @@ -51,10 +51,7 @@ impl SimplifyInfo for MyInfo { } fn get_data_type(&self, expr: &Expr) -> Result { - match expr.get_type(&self.schema) { - Ok(expr_data_type) => Ok(expr_data_type), - Err(e) => Err(e), - } + expr.get_type(&self.schema) } } diff --git a/datafusion/optimizer/src/simplify_expressions/context.rs b/datafusion/optimizer/src/simplify_expressions/context.rs index b6e3f07b29b3..0fe1e6ae81e8 100644 --- a/datafusion/optimizer/src/simplify_expressions/context.rs +++ b/datafusion/optimizer/src/simplify_expressions/context.rs @@ -129,10 +129,7 @@ impl<'a> SimplifyInfo for SimplifyContext<'a> { /// Returns data type of this expr needed for determining optimized int type of a value fn get_data_type(&self, expr: &Expr) -> Result { if self.schemas.len() == 1 { - match expr.get_type(&self.schemas[0]) { - Ok(expr_data_type) => Ok(expr_data_type), - Err(e) => Err(e), - } + expr.get_type(&self.schemas[0]) } else { Err(DataFusionError::Internal( "The expr has more than one schema, could not determine data type"