jayzhan211 commented on code in PR #11978:
URL: https://github.com/apache/datafusion/pull/11978#discussion_r1717949118


##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -627,15 +629,34 @@ impl<'a> ConstEvaluator<'a> {
             return ConstSimplifyResult::NotSimplified(s);
         }
 
+        let start_type = match expr.get_type(&self.input_schema) {
+            Ok(t) => t,
+            Err(err) => return ConstSimplifyResult::SimplifyRuntimeError(err, 
expr),
+        };
+
         let phys_expr =
             match create_physical_expr(&expr, &self.input_schema, 
self.execution_props) {
                 Ok(e) => e,
                 Err(err) => return 
ConstSimplifyResult::SimplifyRuntimeError(err, expr),
             };
+
         let col_val = match phys_expr.evaluate(&self.input_batch) {
             Ok(v) => v,
             Err(err) => return ConstSimplifyResult::SimplifyRuntimeError(err, 
expr),
         };
+
+        // TODO(@notfilippo): a fix for the select_arrow_cast error
+        let end_type = col_val.data_type();
+        if end_type.logically_eq(&start_type) && start_type != end_type {
+            return ConstSimplifyResult::SimplifyRuntimeError(
+                DataFusionError::Execution(format!(

Review Comment:
   we could use `exec_err`



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to