dice icon indicating copy to clipboard operation
dice copied to clipboard

Add documentation for command `ZRANGE`

Open apoorvyadav1111 opened this issue 1 year ago • 9 comments

The documentation of the command ZRANGE is absent in the docs. We need your help to ensure that the documentation is complete, correct, and consistent. Completing this issue will give you much-needed exposure to how the command is implemented and the different parameters it accepts. Hence, this is a great way to build a good understanding of the project and its functionality. While still making a significant contribution. Here's what you need to do:

Go through the documentation of the command and run all the examples, making sure they all work as expected If the same command is present in Redis, then the expected output of the DiceDB command is the same as the Redis output If the command is not in Redis, then as per your judgment, raise an issue with this template or fix the documentation and raise a pull request. The documentation should contain the following sections in the following order short and concise introduction paragraph about the command covering what it does Syntax Parameters: List all the parameters the command accepts, and ignore the section if there are no parameters Return values: List all possible return values and under what condition Behaviour: Describe the behavior of the command, what it does, how it does it, some internal specifics if any Errors: List all possible errors the command can throw and under what condition Examples: List all possible examples of the command and the expected output. Assume CLI implementation Note: The title of the sections should be the exact strings mentioned above, like "Examples", "Return values", etc. Note: The description of the command in Frontmatter of the command.md file is the first paragraph (introduction) of the command.

Go through the DiceDB/dice repository and explore the command implementation

to understand all possible return values to understand all possible error values and conditions to understand different parameters the command accepts Please use the documentation of the SET command as the reference point and structure the documentation of this command in a very similar way, including the following points

if you see any "Conclusion" section, remove it the headers (h1, h2, h3) should be appropriately used the CLI prompt should be 127.0.0.1:7379> and not anything else Use markdown tables for parameters and return values (ref SET command documentation) wrap any command or paramter in backticks (`) to highlight them the section header should be capitalize as used in the SET command documentation If you find any inconsistencies, please fix the documentation and raise the PR. The core idea of this exercise is to ensure that the documentation is consistent, correct, and complete.

Make sure you comment on the other issues you created (if any) as a comment on this issue and also any PR (if any) that you created. Thank you for picking this up and contributing to the DiceDB. It means a ton.

Please refer to the following files for sample structure:

docs/command_docs_template.md
docs/sample_command_docs.md

apoorvyadav1111 avatar Nov 14 '24 04:11 apoorvyadav1111

Hey @apoorvyadav1111 can you please assign me this issue?

gauravrp avatar Nov 14 '24 04:11 gauravrp

Assigned @gauravrp 🚀

apoorvyadav1111 avatar Nov 14 '24 04:11 apoorvyadav1111

Hi @apoorvyadav1111 , I'm interested in picking up this issue.

jonathanalvares9009 avatar Nov 27 '24 03:11 jonathanalvares9009

Since there hasn't been any activity on ticket, assigning it to @jonathanalvares9009.

lucifercr07 avatar Nov 27 '24 07:11 lucifercr07

I found some issues while testing mainly that BYSCORE and BYLEX support is not implemented for this command

jonathanalvares9009 avatar Dec 01 '24 07:12 jonathanalvares9009

Setup Command

ZADD leaderboard 50 "Alice" 70 "Bob" 60 "Charlie" 80 "Dave"

Commands and Observations

  1. ZRANGE leaderboard 0 0

Redis: Returns the lowest score entry ("Alice") DiceDB: Matches Redis behavior.

  1. ZRANGE leaderboard -1 -1

Redis: Returns the highest score entry ("Dave") DiceDB: Matches Redis behavior.

  1. ZRANGE leaderboard 0 01

Redis: (error) ERR value is not an integer or out of range DiceDB: Command succeeds unexpectedly.

  1. ZRANGE leaderboard -1 0

Redis: Returns an empty array. DiceDB: Produces no output.

  1. ZRANGE leaderboard 1 0

Redis: Returns an empty array. DiceDB: Produces no output.

  1. ZRANGE leaderboard (60 80 BYSCORE

Redis: Executes correctly, returning entries with scores between 60 and 80, exclusive of 60. DiceDB: Error: ERR syntax error

  1. ZRANGE leaderboard (60 (80 BYSCORE

Redis: Executes correctly, returning entries with scores strictly between 60 and 80. DiceDB: Error: ERR syntax error

  1. ZRANGE leaderboard [a [z BYLEX

Redis: Executes correctly, returning entries between lexical ranges. DiceDB: Error: ERR syntax error

  1. ZRANGE leaderboard 0 3 WITHSCORES REV

Redis: Returns entries in descending score order with scores. DiceDB: Matches Redis behavior.

  1. ZRANGE random 0 2 (key that is not in the cache)

Redis: Returns (empty array) DiceDB: Produces no output.

  1. ZRANGE leaderboard (1 +inf BYSCORE LIMIT 0 2

Redis: Returns up to 2 entries with scores greater than 1. DiceDB: Error: ERR syntax error

I believe Error: ERR syntax error means not implemented. I'm open to implementing the missing parts (new to Golang will take me a lot of time tho).

jonathanalvares9009 avatar Dec 01 '24 07:12 jonathanalvares9009

Tagging @lucifercr07 @apoorvyadav1111 ^

jonathanalvares9009 avatar Dec 02 '24 09:12 jonathanalvares9009

@jonathanalvares9009 Thanks for finding bugs in ZRANGE. Could you please create a separate issue for this? Also if you would like to take that up as well, please let me know and I will assign that issue to you.

apoorvyadav1111 avatar Dec 02 '24 16:12 apoorvyadav1111

hey is this issue fixed ? can you assign this to me, would love to work on this

akhilk2802 avatar Dec 15 '24 18:12 akhilk2802