alan910127 commented on issue #14433: URL: https://github.com/apache/datafusion/issues/14433#issuecomment-2662141685
I've found that the relevant code is in `datafusion/optimizer/src/analyzer/type_coercion.rs`. However, there's another issue: the `Expr::Not` match arm calls `get_casted_expr_for_bool_op`, which converts the expression into `Operator::IsDistinctFrom` via `BinaryTypeCoercer`. This transformation attaches a diagnostic, which is handled by [[this commit](https://github.com/apache/datafusion/pull/13664/commits/b4df859a5455821563fb3ea0aaa0e179339e6951#diff-6a4f9c80dc5745ba52e3904af1db358441846f360365f080d8b415130b5d0e23)](https://github.com/apache/datafusion/pull/13664/commits/b4df859a5455821563fb3ea0aaa0e179339e6951#diff-6a4f9c80dc5745ba52e3904af1db358441846f360365f080d8b415130b5d0e23). I see two possible approaches to resolving this: 1. Handle the incompatible types error early in `Expr::Not`, but this would scatter type-checking logic throughout the codebase. 2. Use the last diagnostic instead of the first, but this would break the locality principle of keeping diagnostics near the error and might affect existing behavior. Do you have any thoughts on this? -- 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