Skip to content

Commit

Permalink
ZUNION arity should be -3 instread of -4 (#1589)
Browse files Browse the repository at this point in the history
before:
```
127.0.0.1:6666> zunion 1 zset
(error) ERR wrong number of arguments
```

after:
```
127.0.0.1:6666> zunion 1 zset
(empty array)

127.0.0.1:6666> zunion 1 zset
1) "a"
2) "b"
3) "c"
```
  • Loading branch information
enjoy-binbin authored Jul 13, 2023
1 parent 94df83d commit daece9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/commands/cmd_zset.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,6 @@ REDIS_REGISTER_COMMANDS(MakeCmdAttr<CommandZAdd>("zadd", -4, "write", 1, 1, 1),
MakeCmdAttr<CommandZMScore>("zmscore", -3, "read-only", 1, 1, 1),
MakeCmdAttr<CommandZScan>("zscan", -3, "read-only", 1, 1, 1),
MakeCmdAttr<CommandZUnionStore>("zunionstore", -4, "write", CommandZUnionStore::Range),
MakeCmdAttr<CommandZUnion>("zunion", -4, "read-only", CommandZUnion::Range), )
MakeCmdAttr<CommandZUnion>("zunion", -3, "read-only", CommandZUnion::Range), )

} // namespace redis
3 changes: 3 additions & 0 deletions tests/gocase/unit/type/zset/zset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,9 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx context.Context, encoding s
})

t.Run(fmt.Sprintf("ZUNION basics - %s", encoding), func(t *testing.T) {
rdb.Del(ctx, "zseta")
require.NoError(t, rdb.Do(ctx, "zunion", 1, "zseta").Err())

createZset(rdb, ctx, "zseta", []redis.Z{
{Score: 1, Member: "a"},
{Score: 2, Member: "b"},
Expand Down

0 comments on commit daece9e

Please sign in to comment.