andygrove commented on code in PR #471:
URL: https://github.com/apache/datafusion-comet/pull/471#discussion_r1616099527


##########
core/src/execution/datafusion/planner.rs:
##########
@@ -566,8 +567,23 @@ impl PhysicalPlanner {
                 Ok(Arc::new(NotExpr::new(child)))
             }
             ExprStruct::Negative(expr) => {
-                let child = self.create_expr(expr.child.as_ref().unwrap(), 
input_schema)?;
-                Ok(Arc::new(NegativeExpr::new(child)))
+                let child: Arc<dyn PhysicalExpr> =
+                    self.create_expr(expr.child.as_ref().unwrap(), 
input_schema.clone())?;
+                let eval_mode = match expr.eval_mode.as_str() {
+                    "ANSI" => EvalMode::Ansi,
+                    "TRY" => EvalMode::Try,
+                    "LEGACY" => EvalMode::Legacy,
+                    other => {
+                        return Err(ExecutionError::GeneralError(format!(
+                            "Invalid EvalMode: \"{other}\""
+                        )))
+                    }
+                };
+                let result = negative::create_negate_expr(child, eval_mode);
+                match result {
+                    Ok(expr) => Ok(expr),
+                    Err(e) => Err(ExecutionError::GeneralError(e.to_string())),
+                }

Review Comment:
   I think you could use `map_err` here rather than have a match statement for 
changing the error.



-- 
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