You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ma...@apache.org on 2023/01/25 20:33:27 UTC

[cassandra] 09/27: Ninja for CASSANDRA-17719: Adder/Substraction should return NULL if either the current or the user value are NULL

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

maedhroz pushed a commit to branch cep-15-accord
in repository https://gitbox.apache.org/repos/asf/cassandra.git

commit 436638c1a55edba06a6737fc528f703f39c76ace
Author: David Capwell <dc...@apache.org>
AuthorDate: Mon Dec 12 15:50:29 2022 -0800

    Ninja for CASSANDRA-17719: Adder/Substraction should return NULL if either the current or the user value are NULL
---
 src/java/org/apache/cassandra/cql3/Constants.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/java/org/apache/cassandra/cql3/Constants.java b/src/java/org/apache/cassandra/cql3/Constants.java
index 068a04035b..108073d5b2 100644
--- a/src/java/org/apache/cassandra/cql3/Constants.java
+++ b/src/java/org/apache/cassandra/cql3/Constants.java
@@ -536,7 +536,7 @@ public abstract class Constants
                 @SuppressWarnings("unchecked") NumberType<Number> type = (NumberType<Number>) column.type;
                 ByteBuffer increment = t.bindAndGet(params.options);
                 if (increment == null)
-                    throw new InvalidRequestException("Invalid null value for number increment");
+                    return;
                 ByteBuffer current = getCurrentCellBuffer(partitionKey, params);
                 if (current == null)
                     return;
@@ -546,6 +546,8 @@ public abstract class Constants
             else if (column.type instanceof StringType)
             {
                 ByteBuffer append = t.bindAndGet(params.options);
+                if (append == null)
+                    return;
                 ByteBuffer current = getCurrentCellBuffer(partitionKey, params);
                 if (current == null)
                     return;
@@ -590,7 +592,7 @@ public abstract class Constants
                 NumberType<?> type = (NumberType<?>) column.type;
                 ByteBuffer bytes = t.bindAndGet(params.options);
                 if (bytes == null)
-                    throw new InvalidRequestException("Invalid null value for number decrement");
+                    return;
                 ByteBuffer current = getCurrentCellBuffer(partitionKey, params);
                 if (current == null)
                     return;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org