Nagato-Yuzuru commented on issue #11596:
URL: https://github.com/apache/datafusion/issues/11596#issuecomment-5232788766
I discovered `and_or` is also incorrect here. DataFusion's three-valued bool
`nulls_first` consistency check is not sound.
NULL does not always propagate. `null AND false = false`.
```
DataFusion CLI v54.1.0
> WITH v(x) AS (VALUES (true), (false), (NULL))
SELECT a.x AS a,
b.x AS b,
a.x AND b.x AS and_,
a.x OR b.x AS or_
FROM v a, v b
ORDER BY 1 NULLS LAST, 2 NULLS LAST;
+-------+-------+-------+-------+
| a | b | and_ | or_ |
+-------+-------+-------+-------+
| false | false | false | false |
| false | true | false | true |
| false | NULL | false | NULL |
| true | false | false | true |
| true | true | true | true |
| true | NULL | NULL | true |
| NULL | false | false | NULL |
| NULL | true | NULL | true |
| NULL | NULL | NULL | NULL |
+-------+-------+-------+-------+
9 row(s) fetched.
```
Counterexample:
`a = [null, null, false, true]`, `b = [false, true, true, true]`, both ASC
NULLS FIRST. `a AND b = [false, null, false, true]` not sorted.
Will fix in the same PR.
--
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]