You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2022/10/07 19:43:09 UTC
[arrow-datafusion] branch master updated: Remove dead code in `UnwrapCastExprRewriter` that may mask errors (#3703)
This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new 4dd4d43ab Remove dead code in `UnwrapCastExprRewriter` that may mask errors (#3703)
4dd4d43ab is described below
commit 4dd4d43abc12f4419156c877f48348ce55e480c7
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Fri Oct 7 15:43:03 2022 -0400
Remove dead code in `UnwrapCastExprRewriter` that may mask errors (#3703)
* Remove dead check
* Further simplify
---
datafusion/optimizer/src/unwrap_cast_in_comparison.rs | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/datafusion/optimizer/src/unwrap_cast_in_comparison.rs b/datafusion/optimizer/src/unwrap_cast_in_comparison.rs
index 542c29bd7..8392e28a9 100644
--- a/datafusion/optimizer/src/unwrap_cast_in_comparison.rs
+++ b/datafusion/optimizer/src/unwrap_cast_in_comparison.rs
@@ -155,15 +155,9 @@ impl ExprRewriter for UnwrapCastExprRewriter {
Expr::BinaryExpr { left, op, right } => {
let left = left.as_ref().clone();
let right = right.as_ref().clone();
- let left_type = left.get_type(&self.schema);
- let right_type = right.get_type(&self.schema);
- // can't get the data type, just return the expr
- if left_type.is_err() || right_type.is_err() {
- return Ok(expr.clone());
- }
+ let left_type = left.get_type(&self.schema)?;
+ let right_type = right.get_type(&self.schema)?;
// Because the plan has been done the type coercion, the left and right must be equal
- let left_type = left_type?;
- let right_type = right_type?;
if is_support_data_type(&left_type)
&& is_support_data_type(&right_type)
&& is_comparison_op(op)