dice icon indicating copy to clipboard operation
dice copied to clipboard

Add support for different options of `ZADD` command

Open JyotinderSingh opened this issue 1 year ago • 10 comments

Add support for the different options of ZADD command in DiceDB similar to the ZADD command in Redis. Please refer to the following commit in Redis to understand the implementation specifics - source.

The following options need to be supported:

ZADD supports a list of options, specified after the name of the key and before the first score argument. Options are: XX: Only update elements that already exist. Don't add new elements. NX: Only add new elements. Don't update already existing elements. LT: Only update existing elements if the new score is less than the current score. This flag doesn't prevent adding new elements. GT: Only update existing elements if the new score is greater than the current score. This flag doesn't prevent adding new elements. CH: Modify the return value from the number of new elements added, to the total number of elements changed (CH is an abbreviation of changed). Changed elements are new elements added and elements already existing for which the score was updated. So elements specified in the command line having the same score as they had in the past are not counted. Note: normally the return value of ZADD only counts the number of new elements added. INCR: When this option is specified ZADD acts like ZINCRBY. Only one score-element pair can be specified in this mode. Note: The GT, LT and NX options are mutually exclusive.

Write unit and integration tests for the command referring to the tests written in the Redis codebase 7.2.5. For integration tests, you can refer to the tests folder. Note: they have used TCL for the test suite, and we need to port that to our way of writing integration tests using the relevant helper methods. Please refer to our tests directory.

For the command, benchmark the code and measure the time taken and memory allocs using benchmem and try to keep them to the bare minimum.

JyotinderSingh avatar Sep 28 '24 04:09 JyotinderSingh

Please assign this to me. Thanks

rushabhk04 avatar Sep 28 '24 04:09 rushabhk04

Hey, Let me know if I can work on this one. Thanks

swaingotnochill avatar Sep 28 '24 04:09 swaingotnochill

Heyy, can i work on this

advaittrivedi1122 avatar Sep 28 '24 04:09 advaittrivedi1122

Please assign this to me. Thanks

Assigned

JyotinderSingh avatar Sep 28 '24 05:09 JyotinderSingh

This issue is now unblocked, #760 is now merged.

JyotinderSingh avatar Sep 28 '24 09:09 JyotinderSingh

Hello @rushabhk04,

There has been no activity on this issue for the past 5 days. It would be awesome if you keep posting updates to this issue so that we know you are actively working on it.

We are really eager to close this issue at the earliest, hence if we continue to see the inactivity, we will have to reassign the issue to someone else. We are doing this to ensure that the project maintains its momentum and others are not blocked on this work.

Just drop a comment with the current status of the work or share any issues you are facing. We can always chip in to help you out.

Thanks again.

arpitbbhayani avatar Oct 03 '24 14:10 arpitbbhayani

Hello @arpitbbhayani @JyotinderSingh

I am working on this issue, I could implement 3 commands but am getting errors for the last two, so I'm trying to solve that. By next week, I'll raise a PR for this.

Thanks

rushabhk04 avatar Oct 04 '24 03:10 rushabhk04

Hello @rushabhk04,

There has been no activity on this issue for the past 5 days. It would be awesome if you keep posting updates to this issue so that we know you are actively working on it.

We are really eager to close this issue at the earliest, hence if we continue to see the inactivity, we will have to reassign the issue to someone else. We are doing this to ensure that the project maintains its momentum and others are not blocked on this work.

Just drop a comment with the current status of the work or share any issues you are facing. We can always chip in to help you out.

Thanks again.

arpitbbhayani avatar Oct 09 '24 02:10 arpitbbhayani

Hello Team, I will raise PR by Sunday. Thanks

rushabhk04 avatar Oct 12 '24 03:10 rushabhk04

Hi, @rushabhk04. Any updates on this one? I am working on #1129 which depends on this.

c-harish avatar Oct 20 '24 09:10 c-harish