andygrove commented on code in PR #500: URL: https://github.com/apache/datafusion-comet/pull/500#discussion_r1627772796
########## core/src/execution/datafusion/planner.rs: ########## @@ -492,7 +494,18 @@ impl PhysicalPlanner { let child = self.create_expr(expr.child.as_ref().unwrap(), input_schema.clone())?; let return_type = child.data_type(&input_schema)?; let args = vec![child]; - let scalar_def = ScalarFunctionDefinition::UDF(math::abs()); + let eval_mode = match spark_expression::EvalMode::try_from(expr.eval_mode)? { + spark_expression::EvalMode::Legacy => EvalMode::Legacy, + spark_expression::EvalMode::Ansi => EvalMode::Ansi, + spark_expression::EvalMode::Try => { + return Err(ExecutionError::GeneralError( + "Invalid EvalMode: \"TRY\"".to_string(), + )) + } + }; Review Comment: I see that we have this code block duplicated for `abs` and `cast` now. Perhaps this could be extracted into a function. Another option would be to implement `TryFrom` or `TryInto` for this conversion. -- 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