sorted set bugs
ZADD foo 0 one_a
ZADD foo 0 two_a
ZADD foo 0 two_b
ZADD foo 0 three_a
ZRANGEBYLEX foo - + LIMIT 1 2
expected : two_a, two_b
ZADD foo inf e1
ZADD bar -inf e1 0.0 e2
ZUNIONSTORE baz 3 foo bar foo
ZSCORE baz e1
expected "0"
ZADD foo inf x
ZADD foo2 inf x
ZUNIONSTORE bar 2 foo foo2 WEIGHTS 1.0 0.0
ZSCORE bar x
expected "inf"
Also,
ZADD a 1 a1 2 a2 1 a3
ZADD b 2 a1 2 a2 2 a3
ZADD c 6 a1 5 a3 4 a4
ZINTER 3 a b c
ZINTER 3 a b c WITHSCORES
ZINTER 3 a b c AGGREGATE MAX WITHSCORES
ZINTER 3 a b c AGGREGATE MIN WITHSCORES
expected ("a1","1"),("a3","1") , i.e a1 first and then a3
About (2) You had a mistake, it's 0 on Redis.
Nonetheless we cannot achieve the same behavior in a simple way.
The only rule Redis has is that nan turns into 0.0. https://github.com/redis/redis/blob/60f22ca830c59a630b4156b112f5e73ce75adc64/src/t_zset.c#L2419
And this is not commutative.
For example:
inf + inf - inf = inf - inf = nan = 0.0
inf - inf + inf = nan + inf = 0 + inf = inf
Internally, they sort the sets by size and then apply the operations. We can't do it in the same order having multiple shards, as that would require us to store all union/merge conflicts
About (1). You have a mistake, it's
- "three_a"
- "two_a"
on Redis (and alphabetically if to verify manually)
are these fixed @dranikpg ?