Repository navigation
fix(bitmap): pad BITOP operands and treat missing keys as empty - #593
Merged
Merged
Conversation
BITOP combined the operands with zip(), so the result was cut to the shortest string, and a missing first key raised a TypeError. Redis pads every operand with zero bytes to the longest one, treats missing keys as empty strings, and deletes the destination when the result is empty.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BITOPcombined the operands withzip(), so the result was cut to the shortest operand, and a missing first key raised a PythonTypeError. Withkey1 = "hello"andkey2 = "10", compared with a real Redis 8.10:BITOP OR dest key1 key2yulloyuBITOP AND dest key1 missingBITOP OR dest missing key1helloTypeErrorBITOP AND dest missing missing2destdeletedTypeErrorBITOP NOT dest missingdestdeletedTypeErrorOperands are now padded with zero bytes to the longest one, missing keys count as empty strings, and an empty result deletes the destination instead of storing
"". The existing test only used operands of the same length. The new test passes against the real server (Strict2/Strict3) and fails on master for FakeStrict2/FakeStrict3.