lyne7-sc opened a new issue, #24246:
URL: https://github.com/apache/datafusion/issues/24246
### Describe the bug
Some expression simplification rules do not preserve SQL NULL semantics,
which can produce incorrect results for nullable inputs.
For example:
- log / power identities
- Bitwise XOR cancellation
- IN / NOT IN set simplification
- array_has simplification to IN
### To Reproduce
```sql
SELECT
log(a, 1.0) AS log_one,
power(a, 0.0) AS power_zero,
i XOR i AS self_xor,
i IN (1) AND i IN (2) AS in_and,
i NOT IN (1) OR i NOT IN (2) AS not_in_or,
array_has([i, 1], 2) AS array_has_two
FROM (VALUES (NULL::DOUBLE, NULL::INT)) AS t(a, i);
```
### Expected behavior
Actual output:
```
log_one power_zero self_xor in_and not_in_or array_has_two
0.0 1.0 0 false true NULL
```
Expected output:
```
log_one power_zero self_xor in_and not_in_or array_has_two
NULL NULL NULL NULL NULL false
```
### Additional context
_No response_
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]