Fix bucket pruning when value is null and the predicate is 'IS NULL'.#14276
Fix bucket pruning when value is null and the predicate is 'IS NULL'.#14276rongrong merged 1 commit intoprestodb:masterfrom
Conversation
53677ad to
8f17ad1
Compare
presto-spi/src/main/java/com/facebook/presto/spi/predicate/TupleDomain.java
Outdated
Show resolved
Hide resolved
8f17ad1 to
b40b151
Compare
mbasmanova
left a comment
There was a problem hiding this comment.
@kaikalur The fix looks good, but the test should go into TestTupleDomain.
|
I disagree and I generally dislike unit tests. In fact, that function should not even be in there. They should have just called the other function that gives a map and extracted it. Too many ways to do the same thing is just bad. |
Also, what if someone found a way to do this bucket pruning different way and missed the same thing. We will miss it again. This test is good like here. |
|
one more test case |
It should be 1 because IN uses equality and key in (null,1) is same as key in (1). But good catch about missing test though! |
b40b151 to
84ac3c6
Compare
There was a problem hiding this comment.
nits: space after comma in NULL,1.
|
@kaikalur might be a good idea to also add unit test to |
It hurts me to do it :) and I'm also principally against unit testing. If you ask me, this function does not belong here in this class. |
|
This is not good enough :( fails |
|
@mbasmanova can you check if this new fix works better? It fixed the failed test. I couldn't find an API that gives me a value for null so just adding null when it's nullAllowed seems to have fixed it. |
84ac3c6 to
eff8c76
Compare
mbasmanova
left a comment
There was a problem hiding this comment.
@kaikalur The new fix looks fine, but this kind of low-level changes really required a unit test. Without one it is not possible to fully understand whether all the possible scenarios are implemented correctly.
eff8c76 to
973b1b1
Compare
When filtering in buckets with matching values, handle NULL properly.