Closed jiangtao244 closed 3 years ago
Hello, thank you for opening this issue.
Can you explain the problem in more detail? Do you have an example that I can use to reproduce?
Thanks
For example: Now I have ten users, and the number of users is increasing. login_monday = [ 1, 3, 5, 8, 9 ] login_tuesday = [ 1, 2, 4, 6, 8]
I want to get the users login on monday but not login on tuesday. I need to flip login_tuesday and expect [ 0, 3, 5, 7, 9 ], but get [0, 3, 5, 7] by using R.BITOP NOT
Now I have to use a redis transaction to achive this goal:
This's Ugly.
I was able to test this and can confirm this is not the intended behavior.
What do you think about this change? Passing last
as an optional parameter, such as R.BITOP NOT destkey srckey last
?
This would be the expected output:
> R.SETINTARRAY login_monday 1 3 5 8 9
OK
> R.SETINTARRAY login_tuesday 1 2 4 6 8
OK
> R.MAX login_monday
(integer) 9
> R.NOT login_monday
(integer) 9
> R.BITOP NOT not_login_tuesday login_tuesday 9
(integer) 5
> R.BITOP AND final login_monday not_login_tuesday
(integer) 5
> R.GETINTARRAY final
1) (integer) 0
2) (integer) 3
3) (integer) 5
4) (integer) 7
5) (integer) 9
Yes, we can change like this.
Closing this since it seems it was already resolved on #77 and #78
Need to pass “last“” from R.BITOP NOT
https://github.com/aviggiano/redis-roaring/blob/860282da7117562bd9dc38c8ccde57be755b2260/src/data-structure.c#L91