alamb commented on a change in pull request #8076:
URL: https://github.com/apache/arrow/pull/8076#discussion_r480399982
##########
File path: rust/datafusion/src/execution/physical_plan/expressions.rs
##########
@@ -991,48 +991,36 @@ impl fmt::Display for BinaryExpr {
}
}
-// Returns a formatted error about being impossible to coerce types for the
binary operator.
-fn coercion_error<T>(
- lhs_type: &DataType,
- op: &Operator,
- rhs_type: &DataType,
-) -> Result<T> {
+// Returns a formatted error about being impossible to coerce types to a
common type
+fn coercion_error<T>(lhs_type: &DataType, rhs_type: &DataType) -> Result<T> {
Err(ExecutionError::General(
format!(
- "The binary operator '{}' can't evaluate with lhs = '{:?}' and rhs
= '{:?}'",
Review comment:
I guess I was thinking about the error from the user's perspective
rather than the implementation. If I were a user and I got this error message,
I want to know what part of my query / expression to fix.
For example, if I had `(A + B) - (C * D)` and I got "can't coerce int to
float" error I am not sure I would know if the problem was with `A + B`or with
`C * D` or with the overall difference. While the ideal error message would
perhaps include an offset and a partial output of the original string, but
having the operator name would make it easier to track down what I needed to do
to fix my query
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]