WinkerDu opened a new pull request, #2610:
URL: https://github.com/apache/arrow-datafusion/pull/2610
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
Closes #2609 .
# Rationale for this change
There is bug when binary mathematical operators `+`, `-`, `*`, `/`, `%` work
with literal `NULL`
**To reproduce**
```
> select column1 + NULL from (VALUES (1, 2.3), (2, 5.4)) as t
Plan("'Int64 + Null' can't be evaluated because there isn't a common type to
coerce the types to")
```
Postgres works like
```
# select column1 + NULL from (VALUES (1, 2.3), (2, 5.4)) as t;
?column?
----------
(2 rows)
```
# What changes are included in this PR?
- Adjusts `mathematics_numerical_coercion` in `binary_rule.rs`, make it work
well on condition that at most one side of lhs or rhs is NULL
- Enhances `compute_op_scalar` macro in `binary.rs` to produce NULL array
when scalar value is `NULL`
# Are there any user-facing changes?
No.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]