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

twice 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 8b542005 JSON: Fix arity of JSON.SET (#1849)
8b542005 is described below

commit 8b542005c6aeb5c42f8895638798e3e450f35c76
Author: mwish <[email protected]>
AuthorDate: Sun Oct 22 09:02:06 2023 +0800

    JSON: Fix arity of JSON.SET (#1849)
    
    Co-authored-by: Twice <[email protected]>
---
 src/commands/cmd_json.cc                 | 2 +-
 tests/gocase/unit/type/json/json_test.go | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/commands/cmd_json.cc b/src/commands/cmd_json.cc
index 2c0fb0c6..6b5445c7 100644
--- a/src/commands/cmd_json.cc
+++ b/src/commands/cmd_json.cc
@@ -148,7 +148,7 @@ class CommandJsonType : public Commander {
   }
 };
 
-REDIS_REGISTER_COMMANDS(MakeCmdAttr<CommandJsonSet>("json.set", -3, "write", 
1, 1, 1),
+REDIS_REGISTER_COMMANDS(MakeCmdAttr<CommandJsonSet>("json.set", 4, "write", 1, 
1, 1),
                         MakeCmdAttr<CommandJsonGet>("json.get", -2, 
"read-only", 1, 1, 1),
                         MakeCmdAttr<CommandJsonType>("json.type", -2, 
"read-only", 1, 1, 1),
                         MakeCmdAttr<CommandJsonArrAppend>("json.arrappend", 
-4, "write", 1, 1, 1), );
diff --git a/tests/gocase/unit/type/json/json_test.go 
b/tests/gocase/unit/type/json/json_test.go
index b86e343f..5a60ee02 100644
--- a/tests/gocase/unit/type/json/json_test.go
+++ b/tests/gocase/unit/type/json/json_test.go
@@ -37,6 +37,7 @@ func TestJson(t *testing.T) {
        defer func() { require.NoError(t, rdb.Close()) }()
 
        t.Run("JSON.SET and JSON.GET basics", func(t *testing.T) {
+               require.Error(t, rdb.Do(ctx, "JSON.SET", "a").Err())
                require.NoError(t, rdb.Do(ctx, "JSON.SET", "a", "$", ` {"x":1, 
"y":2} `).Err())
                require.Equal(t, rdb.Do(ctx, "JSON.GET", "a").Val(), 
`{"x":1,"y":2}`)
 

Reply via email to