seawinde opened a new pull request, #39629:
URL: https://github.com/apache/doris/pull/39629
## Proposed changes
Fix result wrong when query rewrite by mv if query contains null_unsafe
equals expression
table orders data is as following:
```sql
(null, 1, 'o', 9.5, '2023-12-08', 'a', 'b', 1, 'yy'),
(1, null, 'o', 10.5, '2023-12-08', 'a', 'b', 1, 'yy'),
(2, 1, null, 11.5, '2023-12-09', 'a', 'b', 1, 'yy'),
(3, 1, 'o', null, '2023-12-10', 'a', 'b', 1, 'yy'),
(3, 1, 'o', 33.5, null, 'a', 'b', 1, 'yy'),
(4, 2, 'o', 43.2, '2023-12-11', null,'d',2, 'mm'),
(5, 2, 'o', 56.2, '2023-12-12', 'c',null, 2, 'mi'),
(5, 2, 'o', 1.2, '2023-12-12', 'c','d', null, 'mi');
```
such as mv def is
```sq
select count(*), o_orderstatus, o_comment
from orders
group by
o_orderstatus, o_comment;
```
query is as following:
```sql
select count(*), o_orderstatus, o_comment
from orders
where o_orderstatus = o_orderstatus
group by
o_orderstatus, o_comment;
```
after rewrite by materialized view, the result is wrong as following, the
row contains null should not appear
```sql
+----------+---------------+-----------+
| count(*) | o_orderstatus | o_comment |
+----------+---------------+-----------+
| 1 | NULL | yy |
| 1 | o | mm |
| 2 | o | mi |
| 4 | o | yy |
+----------+---------------+-----------+
```
the pr fix 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: [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]