You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/06/01 17:12:37 UTC

[GitHub] [geode] sabbey37 commented on a change in pull request #6534: GEODE-9306: support ZINCRBY command

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



##########
File path: geode-apis-compatible-with-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/sortedset/AbstractZIncrByIntegrationTest.java
##########
@@ -0,0 +1,272 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.redis.internal.executor.sortedset;
+
+import static java.lang.Double.NEGATIVE_INFINITY;
+import static java.lang.Double.POSITIVE_INFINITY;
+import static org.apache.geode.redis.RedisCommandArgumentsTestHelper.assertExactNumberOfArgs;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+import com.google.common.util.concurrent.AtomicDouble;
+import org.assertj.core.data.Offset;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import redis.clients.jedis.HostAndPort;
+import redis.clients.jedis.JedisCluster;
+import redis.clients.jedis.Protocol;
+
+import org.apache.geode.redis.ConcurrentLoopingThreads;
+import org.apache.geode.redis.RedisIntegrationTest;
+import org.apache.geode.redis.internal.RedisConstants;
+
+public abstract class AbstractZIncrByIntegrationTest implements RedisIntegrationTest {

Review comment:
       Could we also add a test for this not a number error? From native Redis:
   ```
   zincrby blue infinity a
   "inf"
   zincrby blue -infinity a
   (error) ERR resulting score is not a number (NaN)
   ```
   
   It looks like native redis uses this [`isnan` method ](http://www.qnx.com/developers/docs/6.3.2/neutrino/lib_ref/i/isnan.html) to determine whether or not to return this error:
   
   ```
     int retval = zsetAdd(zobj, score, ele, &retflags, &newscore);
           if (retval == 0) {
               addReplyError(c,nanerr);
               goto cleanup;
           }
   ```
   From `zsetAdd`:
   
   ```
   if (isnan(score)) {
                       *flags |= ZADD_NAN;
                       return 0;
                   }
   ```




-- 
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:
users@infra.apache.org