Files
scylladb/test/cql/token_from_null_test.cql
Aleksandra Martyniuk bf34589fc1 cql3: create tokens out of null values properly
Method reponsible for creating a token of given values is not meant to be
used with empty optionals. Thus, having requested a token of the columns
containing null values resulted with an exception being thrown. This kind
of behaviour was not compatible with the one applied in cassandra.

To fix this, before the computation of a token, it is checked whether
no null value is contained. If any value in the processed vector is null,
null value is returned.

Fixes:  #10594

Closes #10942
2022-07-04 10:42:23 +02:00

14 lines
530 B
SQL

-- single null value
CREATE KEYSPACE reproducer WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
CREATE TABLE reproducer.t(pk int PRIMARY KEY, v int);
INSERT INTO reproducer.t (pk) VALUES (1);
SELECT TOKEN(v) FROM reproducer.t;
-- multiple null values
CREATE TABLE reproducer.t2(pk int PRIMARY KEY, a int, b int);
INSERT INTO reproducer.t2 (pk) VALUES (1);
SELECT TOKEN(pk, a, b) FROM reproducer.t2;
SELECT TOKEN(pk, b) FROM reproducer.t2;
SELECT TOKEN(a, b) FROM reproducer.t2;
DROP KEYSPACE reproducer;