"vscode:/vscode.git/clone" did not exist on "d71478a889935382f3bf8b9a39ab073eba0a856a"
Commit 521ddcce authored by antirez's avatar antirez
Browse files

Fix for ZUNIONSTORE bug when there is an empty set among input sets. Regression test added.

parent 330c90b0
......@@ -1550,7 +1550,7 @@ void zunionInterGenericCommand(redisClient *c, robj *dstkey, int op) {
}
} else if (op == REDIS_OP_UNION) {
for (i = 0; i < setnum; i++) {
if (zuiLength(&src[0]) == 0)
if (zuiLength(&src[i]) == 0)
continue;
while (zuiNext(&src[i],&zval)) {
......
......@@ -353,6 +353,14 @@ start_server {tags {"zset"}} {
assert_equal 0 [r exists dst_key]
}
test "ZUNIONSTORE with empty set - $encoding" {
r del zseta zsetb
r zadd zseta 1 a
r zadd zseta 2 b
r zunionstore zsetc 2 zseta zsetb
r zrange zsetc 0 -1 withscores
} {a 1 b 2}
test "ZUNIONSTORE basics - $encoding" {
r del zseta zsetb zsetc
r zadd zseta 1 a
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment