mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-29 04:37:00 +00:00
since "token()" computes the token for a given partition key, if we pass the key of the wrong type, it should reject. in this change, * we validate the keys before returning the "token()" function. * drop the "xfail" decorator from two of the tests. they pass now after this fix. * change the tests which previously passed the wrong number of arguments containing null to "token()" and expect it to return null, so they verify that "token()" should reject these arguments with the expected error message. Fixes #10448 Signed-off-by: Kefu Chai <kefu.chai@scylladb.com> Closes #12991
28 lines
1.1 KiB
Plaintext
28 lines
1.1 KiB
Plaintext
> -- single null value
|
|
> CREATE KEYSPACE reproducer WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
|
|
OK
|
|
> CREATE TABLE reproducer.t(pk int PRIMARY KEY, v int);
|
|
OK
|
|
> INSERT INTO reproducer.t (pk) VALUES (1);
|
|
OK
|
|
> SELECT TOKEN(v) FROM reproducer.t;
|
|
+-------------------+
|
|
| system.token(v) |
|
|
|-------------------|
|
|
| null |
|
|
+-------------------+
|
|
>
|
|
> -- multiple null values
|
|
> CREATE TABLE reproducer.t2(pk int PRIMARY KEY, a int, b int);
|
|
OK
|
|
> INSERT INTO reproducer.t2 (pk) VALUES (1);
|
|
OK
|
|
> SELECT TOKEN(pk, a, b) FROM reproducer.t2;
|
|
Error from server: code=2200 [Invalid query] message="Invalid number of arguments in call to function system.token: 1 required but 3 provided"
|
|
> SELECT TOKEN(pk, b) FROM reproducer.t2;
|
|
Error from server: code=2200 [Invalid query] message="Invalid number of arguments in call to function system.token: 1 required but 2 provided"
|
|
> SELECT TOKEN(a, b) FROM reproducer.t2;
|
|
Error from server: code=2200 [Invalid query] message="Invalid number of arguments in call to function system.token: 1 required but 2 provided"
|
|
>
|
|
> DROP KEYSPACE reproducer;OK
|