Skip to content

Conversation

@seawinde
Copy link
Contributor

Proposed changes

commitId: 5d4ad02
pr: #39629

…ns null_unsafe equals expression (apache#39629)

Fix result wrong when query rewrite by mv if query contains null_unsafe
equals expression and the expression both side is slot
table orders data is as following:

    (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 

select count(*), o_orderstatus, o_comment
            from orders
            group by
            o_orderstatus, o_comment;

query is as following:

           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

+----------+---------------+-----------+
| count(*) | o_orderstatus | o_comment |
+----------+---------------+-----------+
|        1 | NULL          | yy        |
|        1 | o             | mm        |
|        2 | o             | mi        |
|        4 | o             | yy        |
+----------+---------------+-----------+
@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@seawinde
Copy link
Contributor Author

run buildall

@seawinde
Copy link
Contributor Author

run buildall

@yiguolei yiguolei merged commit c5d9e17 into apache:branch-2.1 Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants