This is an automated email from the ASF dual-hosted git repository.

hulk pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new daece9e6 ZUNION arity should be -3 instread of -4 (#1589)
daece9e6 is described below

commit daece9e688d6bbd16ae402444caf8d31225cc795
Author: Binbin <[email protected]>
AuthorDate: Thu Jul 13 18:13:31 2023 +0800

    ZUNION arity should be -3 instread of -4 (#1589)
    
    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"
    ```
---
 src/commands/cmd_zset.cc                 | 2 +-
 tests/gocase/unit/type/zset/zset_test.go | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/commands/cmd_zset.cc b/src/commands/cmd_zset.cc
index 18dbc22b..1b76974a 100644
--- a/src/commands/cmd_zset.cc
+++ b/src/commands/cmd_zset.cc
@@ -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
diff --git a/tests/gocase/unit/type/zset/zset_test.go 
b/tests/gocase/unit/type/zset/zset_test.go
index 741ceda6..e3d38f08 100644
--- a/tests/gocase/unit/type/zset/zset_test.go
+++ b/tests/gocase/unit/type/zset/zset_test.go
@@ -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"},

Reply via email to