sabbey37 commented on a change in pull request #6573:
URL: https://github.com/apache/geode/pull/6573#discussion_r647650393



##########
File path: 
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/executor/sortedset/ZAddExecutor.java
##########
@@ -46,11 +45,17 @@ public RedisResponse executeCommand(Command command, 
ExecutionHandlerContext con
       return RedisResponse.error(zAddExecutorState.exceptionMessage);
     }
 
-    long retVal = redisSortedSetCommands.zadd(command.getKey(),
+    Object retVal = redisSortedSetCommands.zadd(command.getKey(),
         new ArrayList<>(commandElements.subList(optionsFoundCount + 2, 
commandElements.size())),
         makeOptions(zAddExecutorState));
+    if (zAddExecutorState.incrFound) {
+      if (retVal == null) {
+        return RedisResponse.nil();
+      }
+      return RedisResponse.string((byte[]) retVal);

Review comment:
       I'm not sure that there are.  I ran a few of the zset.tcl tests against 
the current implementation (`test "ZINCRBY return value"`, `test "ZINCRBY - 
increment and decrement`, and `test "ZINCRBY - can create a new sorted set`.. 
and a few others), but they all passed.
   
   The difference is obvious on the CLI, here's a bulk string returned from 
native Redis:
   ```
   127.0.0.1:6379> zadd a incr ch 1 a
   "3"
   ```
   
   Here's a simple string returned by us:
   ```
   127.0.0.1:6380> zadd a incr 1 a
   1
   ```
   We could write tests at a lower level, but I'm not sure if it's super 
valuable given that clients are able to handle either one in the same fashion.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to