Weijun-H commented on code in PR #15209: URL: https://github.com/apache/datafusion/pull/15209#discussion_r1994893409
########## datafusion/sql/src/expr/unary_op.rs: ########## @@ -45,7 +45,13 @@ impl<S: ContextProvider> SqlToRel<'_, S> { { Ok(operand) } else { - plan_err!("Unary operator '+' only supports numeric, interval and timestamp types") + plan_err!("Unary operator '+' only supports numeric, interval and timestamp types").map_err(|e| { + let spans = operand.spans(); + let span = if let Some(s) = spans.as_ref() { s.first() } else { None }; + let diagnostic = + Diagnostic::new_error("Unary operator '+' only supports numeric, interval and timestamp types".to_string(), span); + e.with_diagnostic(diagnostic) Review Comment: Could we add a note or help here, such as `Try using arrow_cast to convert the value to a numeric, interval, or timestamp type`? -- 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