Inconsistent `BITOP`: BITOP throws error for strings
The command BITOP is not consistent with Redis implementation. Here are the steps to reproduce the issue
SET key1 "foobar"
SET key2 "abcdef"
Here's the output I observed in Redis v7.2.5
redis> BITOP AND dest key1 key2
(integer) 6
and here's the output I observed in DiceDB's latest commit of the master branch
127.0.0.1:7379> BITOP AND dest key1 key2
(error) ERR value is not a valid byte array
Make the implementation consistent with the Redis implementation. Make sure you are using Redis version 7.2.5 as a reference for the command implementation and to setup Redis
@apoorvyadav1111 We are not handling case for string and integer here, we are only checking for ByteArray type and encoding. https://github.com/DiceDB/dice/blob/7d9c309289c41492a66140e47efce85b9f549597/core/eval.go#L1789
This is same issue as we have in SETBIT. I have raised PR for SETBBIT https://github.com/DiceDB/dice/pull/409 . We can do similar with BITOP.
@kushal0511-not , yea,I stumbled upon this while working on adding validations for all the commands in case they access a SET data structure. I was wanted to add an issue for it to be officially tracked.
Would you be working on this? I can work on this if #413 is accepted or if someone would like to take this one up.
@apoorvyadav1111 Feel free to take this if #413 is accepted.
Hi @JyotinderSingh, Please assign this to me.
Thanks, Apoorv
Hi @JyotinderSingh, Please assign this to me.
Thanks,
Apoorv
Thanks for picking this up Apoorv, assigned.