nullIf return now the correct result when both arguments are constants#6446
Conversation
|
Ok. PS. For reference: http://sqlfiddle.com/#!9/0a28f18/361 |
|
Something is wrong: |
|
Ok weird, thanks ! I will take a look |
|
@alexey-milovidov How is exactly the configuration you used for your test ? I tried both on this branch and on the latest Can you provide some input about it ? I really tried as much as I can to reproduce the bug, without success :/ |
|
clang, debug build. |
|
Previous implementation was correct in terms of idea but technically wrong. |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
For changelog. Remove if this is non-significant change.
Category (leave one):
Short description (up to few sentences):
Resolve a bug with
nullIffunction when we send aNULLargument on the second argument.Detailed description (optional):
Previously,
SELECT nullIf(1, NULL)returnedNULLwhen both side were constants. (the bugs weren't reproducible when one of this arguments were not constant).Changing the logic of the function from
if(equals(col_1, col_2), NULL, col_1)toif(notEquals(col_1, col_2), col_1, NULL)seem to fix the problem.