You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by tw...@apache.org on 2022/11/10 16:27:27 UTC

[incubator-kvrocks] 01/01: Remove HRANGE command from table due to #1082

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

twice pushed a commit to branch 2.2
in repository https://gitbox.apache.org/repos/asf/incubator-kvrocks.git

commit c84c41ef57924a2d90d4ac4965eab2e573d690d2
Author: PragmaTwice <tw...@gmail.com>
AuthorDate: Fri Nov 11 00:15:42 2022 +0800

    Remove HRANGE command from table due to #1082
---
 src/commands/redis_cmd.cc                |  1 -
 tests/gocase/unit/type/hash/hash_test.go | 50 --------------------------------
 2 files changed, 51 deletions(-)

diff --git a/src/commands/redis_cmd.cc b/src/commands/redis_cmd.cc
index c5817e80..95415c7b 100644
--- a/src/commands/redis_cmd.cc
+++ b/src/commands/redis_cmd.cc
@@ -5998,7 +5998,6 @@ const CommandAttributes redisCommandTable[]{
     MakeCmdAttr<CommandHVals>("hvals", 2, "read-only", 1, 1, 1),
     MakeCmdAttr<CommandHGetAll>("hgetall", 2, "read-only", 1, 1, 1),
     MakeCmdAttr<CommandHScan>("hscan", -3, "read-only", 1, 1, 1),
-    MakeCmdAttr<CommandHRange>("hrange", -4, "read-only", 1, 1, 1),
 
     MakeCmdAttr<CommandLPush>("lpush", -3, "write", 1, 1, 1),
     MakeCmdAttr<CommandRPush>("rpush", -3, "write", 1, 1, 1),
diff --git a/tests/gocase/unit/type/hash/hash_test.go b/tests/gocase/unit/type/hash/hash_test.go
index 8ffb6a89..eedaf363 100644
--- a/tests/gocase/unit/type/hash/hash_test.go
+++ b/tests/gocase/unit/type/hash/hash_test.go
@@ -613,55 +613,5 @@ func TestHash(t *testing.T) {
 			}
 		})
 
-		kvArray := []string{"a", "a", "b", "b", "c", "c", "d", "d", "e", "e", "key1", "value1", "key2", "value2", "key3", "value3", "key10", "value10", "z", "z", "x", "x"}
-		t.Run("HRange normal situation ", func(t *testing.T) {
-			require.NoError(t, rdb.Del(ctx, "hashkey").Err())
-			require.NoError(t, rdb.HMSet(ctx, "hashkey", kvArray).Err())
-			require.EqualValues(t, []interface{}{"key1", "value1", "key10", "value10"}, rdb.Do(ctx, "HRange", "hashkey", "key1", "key2", "limit", 100).Val())
-			require.EqualValues(t, []interface{}{"key1", "value1", "key10", "value10", "key2", "value2"}, rdb.Do(ctx, "HRange", "hashkey", "key1", "key3", "limit", 100).Val())
-		})
-
-		t.Run("HRange stop <= start", func(t *testing.T) {
-			require.NoError(t, rdb.Del(ctx, "hashkey").Err())
-			require.NoError(t, rdb.HMSet(ctx, "hashkey", kvArray).Err())
-			require.EqualValues(t, []interface{}{}, rdb.Do(ctx, "HRange", "hashkey", "key2", "key1", "limit", 100).Val())
-			require.EqualValues(t, []interface{}{}, rdb.Do(ctx, "HRange", "hashkey", "key1", "key1", "limit", 100).Val())
-		})
-
-		t.Run("HRange limit", func(t *testing.T) {
-			require.NoError(t, rdb.Del(ctx, "hashkey").Err())
-			require.NoError(t, rdb.HMSet(ctx, "hashkey", kvArray).Err())
-			require.EqualValues(t, []interface{}{"a", "a", "b", "b"}, rdb.Do(ctx, "HRange", "hashkey", "a", "z", "limit", 2).Val())
-			require.EqualValues(t, []interface{}{"a", "a", "b", "b", "c", "c", "d", "d", "e", "e", "key1", "value1", "key10", "value10", "key2", "value2", "key3", "value3", "x", "x", "z", "z"}, rdb.Do(ctx, "HRange", "hashkey", "a", "zzz", "limit", 10000).Val())
-		})
-
-		t.Run("HRange limit is negative", func(t *testing.T) {
-			require.NoError(t, rdb.Del(ctx, "hashkey").Err())
-			require.NoError(t, rdb.HMSet(ctx, "hashkey", kvArray).Err())
-			require.EqualValues(t, []interface{}{}, rdb.Do(ctx, "HRange", "hashkey", "a", "z", "limit", -100).Val())
-			require.EqualValues(t, []interface{}{}, rdb.Do(ctx, "HRange", "hashkey", "a", "z", "limit", 0).Val())
-		})
-
-		t.Run("HRange nonexistent key", func(t *testing.T) {
-			require.NoError(t, rdb.Del(ctx, "hashkey").Err())
-			require.EqualValues(t, []interface{}{}, rdb.Do(ctx, "HRange", "hashkey", "a", "z", "limit", 10000).Val())
-			require.EqualValues(t, []interface{}{}, rdb.Do(ctx, "HRange", "hashkey", "a", "z", "limit", 10000).Val())
-		})
-
-		t.Run("HRange limit typo", func(t *testing.T) {
-			require.NoError(t, rdb.Del(ctx, "hashkey").Err())
-			require.NoError(t, rdb.HMSet(ctx, "hashkey", kvArray).Err())
-			require.ErrorContains(t, rdb.Do(ctx, "HRange", "hashkey", "a", "z", "limitzz", 10000).Err(), "ERR syntax")
-		})
-
-		t.Run("HRange wrong number of arguments", func(t *testing.T) {
-			require.NoError(t, rdb.Del(ctx, "hashkey").Err())
-			require.NoError(t, rdb.HMSet(ctx, "hashkey", kvArray).Err())
-			require.ErrorContains(t, rdb.Do(ctx, "HRange", "hashkey", "a", "z", "limit", 10000, "a").Err(), "wrong number of arguments")
-			require.ErrorContains(t, rdb.Do(ctx, "HRange", "hashkey", "a", "z", "limit").Err(), "wrong number of arguments")
-			require.ErrorContains(t, rdb.Do(ctx, "HRange", "hashkey", "a").Err(), "wrong number of arguments")
-			require.ErrorContains(t, rdb.Do(ctx, "HRange", "hashkey").Err(), "wrong number of arguments")
-			require.ErrorContains(t, rdb.Do(ctx, "HRange").Err(), "wrong number of arguments")
-		})
 	}
 }