dice icon indicating copy to clipboard operation
dice copied to clipboard

Inconsistent `ZRANGE`

Open vanshavenger opened this issue 1 year ago • 4 comments

          ## 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).

Originally posted by @jonathanalvares9009 in https://github.com/DiceDB/dice/issues/1284#issuecomment-2509608179

vanshavenger avatar Dec 22 '24 16:12 vanshavenger

@apoorvyadav1111 @lucifercr07 Kindly asign me this.

I have a PR ready for the BYScores, BYLEx, and soe other missing things in ZRNAGE and all the above things are working correctly.

vanshavenger avatar Dec 22 '24 16:12 vanshavenger

Also please let me know if i should go ahead and add or update ZRANGE docs too.

vanshavenger avatar Dec 22 '24 16:12 vanshavenger

@vanshavenger assigned, thanks for contributing. Please update the docs if required.

lucifercr07 avatar Dec 23 '24 05:12 lucifercr07

#1396

vanshavenger avatar Dec 25 '24 17:12 vanshavenger