From: Konstantin Osipov <
kos...@scylladb.com>
Committer: Konstantin Osipov <
kos...@scylladb.com>
Branch: next
test.py: switch cql/ suite to pytest/tabular output
---
diff --git a/test/cql/cassandra_batch_test.result b/test/cql/cassandra_batch_test.result
--- a/test/cql/cassandra_batch_test.result
+++ b/test/cql/cassandra_batch_test.result
@@ -1,445 +1,257 @@
---
--- Modified by ScyllaDB
--- from cassandra/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java
---
---
---------------------------------------------------------------------------------
---
--- Copyright (C) 2016-present ScyllaDB
---
--- Modified by ScyllaDB
---
--- SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
-
--- setup
-CREATE KEYSPACE k WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
-{
- "status" : "ok"
-}
-USE k;
-{
- "status" : "ok"
-}
-
--- testBatch
-CREATE TABLE t (userid text PRIMARY KEY, name text, password text);
-{
- "status" : "ok"
-}
-BEGIN BATCH
-INSERT INTO t (userid, password, name) VALUES ('user2', 'ch@ngem3b', 'second user')
-UPDATE t SET password = 'ps22dhds' WHERE userid = 'user3'
-INSERT INTO t (userid, password) VALUES ('user4', 'ch@ngem3c')
-DELETE name FROM t WHERE userid = 'user1'
-APPLY BATCH;
-{
- "status" : "ok"
-}
-SELECT * FROM t;
-{
- "rows" :
- [
- {
- "name" : "\"second user\"",
- "password" : "\"ch@ngem3b\"",
- "userid" : "\"user2\""
- },
- {
- "password" : "\"ch@ngem3c\"",
- "userid" : "\"user4\""
- },
- {
- "password" : "\"ps22dhds\"",
- "userid" : "\"user3\""
- }
- ]
-}
-DROP TABLE t;
-{
- "status" : "ok"
-}
---
--- testBatchAndList
-CREATE TABLE t (k int PRIMARY KEY, l list<int>);
-{
- "status" : "ok"
-}
-BEGIN BATCH
-UPDATE t SET l = l + [ 1 ] WHERE k = 0
-UPDATE t SET l = l + [ 2 ] WHERE k = 0
-UPDATE t SET l = l + [ 3 ] WHERE k = 0
-APPLY BATCH;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE k = 0;
-{
- "rows" :
- [
- {
- "l" : "[1, 2, 3]"
- }
- ]
-}
-BEGIN BATCH
-UPDATE t SET l = [ 1 ] + l WHERE k = 1
-UPDATE t SET l = [ 2 ] + l WHERE k = 1
-UPDATE t SET l = [ 3 ] + l WHERE k = 1
-APPLY BATCH;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE k = 1;
-{
- "rows" :
- [
- {
- "l" : "[3, 2, 1]"
- }
- ]
-}
-DROP TABLE t;
-{
- "status" : "ok"
-}
---
--- testBatchDeleteInsert
-CREATE TABLE t (k int, v int, PRIMARY KEY (k, v));
-{
- "status" : "ok"
-}
-INSERT INTO t (k, v) VALUES (0, 1);
-{
- "status" : "ok"
-}
-BEGIN BATCH
-DELETE FROM t WHERE k=0 AND v=1
-INSERT INTO t (k, v) VALUES (0, 2)
-APPLY BATCH;
-{
- "status" : "ok"
-}
-SELECT * FROM t;
-{
- "rows" :
- [
- {
- "k" : "0",
- "v" : "2"
- }
- ]
-}
-DROP TABLE t;
-{
- "status" : "ok"
-}
-
--- testBatchWithUnset
-CREATE TABLE t (k int PRIMARY KEY, s text, i int);
-{
- "status" : "ok"
-}
-BEGIN BATCH
-INSERT INTO t JSON '{"k": 100, "s": null}' DEFAULT UNSET
-INSERT INTO t JSON '{"k": 111, "i": null}' DEFAULT UNSET
-APPLY BATCH;
-{
- "status" : "ok"
-}
-SELECT k, s, i FROM t where k in (100,111);
-{
- "rows" :
- [
- {
- "k" : "100"
- },
- {
- "k" : "111"
- }
- ]
-}
-DROP TABLE t;
-{
- "status" : "ok"
-}
-
--- testBatchUpdate
-CREATE TABLE t (partitionKey int, clustering_1 int, value int, PRIMARY KEY (partitionKey, clustering_1));
-{
- "status" : "ok"
-}
-INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 0, 0);
-{
- "status" : "ok"
-}
-INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 1, 1);
-{
- "status" : "ok"
-}
-INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 2, 2);
-{
- "status" : "ok"
-}
-INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 3, 3);
-{
- "status" : "ok"
-}
-INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 4, 4);
-{
- "status" : "ok"
-}
-INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 5, 5);
-{
- "status" : "ok"
-}
-INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 6, 6);
-{
- "status" : "ok"
-}
-
-BEGIN BATCH
-UPDATE t SET value = 7 WHERE partitionKey = 0 AND clustering_1 = 1
-UPDATE t SET value = 8 WHERE partitionKey = 0 AND (clustering_1) = (2)
-UPDATE t SET value = 10 WHERE partitionKey = 0 AND clustering_1 IN (3, 4)
-UPDATE t SET value = 20 WHERE partitionKey = 0 AND (clustering_1) IN ((5), (6))
-APPLY BATCH;
-{
- "status" : "ok"
-}
-SELECT * FROM t;
-{
- "rows" :
- [
- {
- "clustering_1" : "0",
- "partitionkey" : "0",
- "value" : "0"
- },
- {
- "clustering_1" : "1",
- "partitionkey" : "0",
- "value" : "7"
- },
- {
- "clustering_1" : "2",
- "partitionkey" : "0",
- "value" : "8"
- },
- {
- "clustering_1" : "3",
- "partitionkey" : "0",
- "value" : "10"
- },
- {
- "clustering_1" : "4",
- "partitionkey" : "0",
- "value" : "10"
- },
- {
- "clustering_1" : "5",
- "partitionkey" : "0",
- "value" : "20"
- },
- {
- "clustering_1" : "6",
- "partitionkey" : "0",
- "value" : "20"
- }
- ]
-}
-DROP TABLE t;
-{
- "status" : "ok"
-}
-
--- testBatchEmpty
-BEGIN BATCH APPLY BATCH;
-{
- "status" : "ok"
-}
-
--- testBatchMultipleTable
-CREATE TABLE t1 (k1 int PRIMARY KEY, v11 int, v12 int);
-{
- "status" : "ok"
-}
-CREATE TABLE t2 (k2 int PRIMARY KEY, v21 int, v22 int);
-{
- "status" : "ok"
-}
-BEGIN BATCH
-UPDATE t1 SET v11 = 1 WHERE k1 = 0
-UPDATE t1 SET v12 = 2 WHERE k1 = 0
-UPDATE t2 SET v21 = 3 WHERE k2 = 0
-UPDATE t2 SET v22 = 4 WHERE k2 = 0
-APPLY BATCH;
-{
- "status" : "ok"
-}
-SELECT * FROM t1;
-{
- "rows" :
- [
- {
- "k1" : "0",
- "v11" : "1",
- "v12" : "2"
- }
- ]
-}
-SELECT * FROM t2;
-{
- "rows" :
- [
- {
- "k2" : "0",
- "v21" : "3",
- "v22" : "4"
- }
- ]
-}
-SELECT * FROM t1;
-{
- "rows" :
- [
- {
- "k1" : "0",
- "v11" : "1",
- "v12" : "2"
- }
- ]
-}
-SELECT * FROM t2;
-{
- "rows" :
- [
- {
- "k2" : "0",
- "v21" : "3",
- "v22" : "4"
- }
- ]
-}
-DROP TABLE t1;
-{
- "status" : "ok"
-}
-DROP TABLE t2;
-{
- "status" : "ok"
-}
-
--- testBatchWithInRestriction
-CREATE TABLE t (a int, b int, c int, PRIMARY KEY (a,b));
-{
- "status" : "ok"
-}
-INSERT INTO t (a,b,c) VALUES (1, 1, 1);
-{
- "status" : "ok"
-}
-INSERT INTO t (a,b,c) VALUES (1, 2, 2);
-{
- "status" : "ok"
-}
-INSERT INTO t (a,b,c) VALUES (1, 3, 3);
-{
- "status" : "ok"
-}
-BEGIN BATCH
-UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
-UPDATE t SET c = 200 WHERE a = 1 AND b IN () IF c = 1
-APPLY BATCH;
-{
- "message" : "exceptions::invalid_request_exception (IN on the clustering key columns is not supported with conditional updates)",
- "status" : "error"
-}
-BEGIN BATCH
-UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
-DELETE FROM t WHERE a = 1 AND b IN () IF c = 1
-APPLY BATCH;
-{
- "message" : "exceptions::invalid_request_exception (IN on the clustering key columns is not supported with conditional deletions)",
- "status" : "error"
-}
-BEGIN BATCH
-UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
-UPDATE t SET c = 200 WHERE a IN () AND b = 1 IF c = 1
-APPLY BATCH;
-{
- "message" : "exceptions::invalid_request_exception (IN on the partition key is not supported with conditional updates)",
- "status" : "error"
-}
-BEGIN BATCH
-UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
-DELETE FROM t WHERE a IN () AND b = 1 IF c = 1
-APPLY BATCH;
-{
- "message" : "exceptions::invalid_request_exception (IN on the partition key is not supported with conditional deletions)",
- "status" : "error"
-}
-
-BEGIN BATCH
-UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
-UPDATE t SET c = 200 WHERE a = 1 AND b IN (1, 2) IF c = 1
-APPLY BATCH;
-{
- "message" : "exceptions::invalid_request_exception (IN on the clustering key columns is not supported with conditional updates)",
- "status" : "error"
-}
-
-BEGIN BATCH
-UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
-DELETE FROM t WHERE a = 1 AND b IN (1, 2) IF c = 1
-APPLY BATCH;
-{
- "message" : "exceptions::invalid_request_exception (IN on the clustering key columns is not supported with conditional deletions)",
- "status" : "error"
-}
-
-BEGIN BATCH
-UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
-UPDATE t SET c = 200 WHERE a IN (1, 2) AND b = 1 IF c = 1
-APPLY BATCH;
-{
- "message" : "exceptions::invalid_request_exception (IN on the partition key is not supported with conditional updates)",
- "status" : "error"
-}
-BEGIN BATCH
-UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
-DELETE FROM t WHERE a IN (1, 2) AND b = 1 IF c = 1
-APPLY BATCH;
-{
- "message" : "exceptions::invalid_request_exception (IN on the partition key is not supported with conditional deletions)",
- "status" : "error"
-}
-
-SELECT * FROM t;
-{
- "rows" :
- [
- {
- "a" : "1",
- "b" : "1",
- "c" : "1"
- },
- {
- "a" : "1",
- "b" : "2",
- "c" : "2"
- },
- {
- "a" : "1",
- "b" : "3",
- "c" : "3"
- }
- ]
-}
-DROP TABLE t;
-{
- "status" : "ok"
-}
-DROP KEYSPACE k;
-{
- "status" : "ok"
-}
+> --
+> -- Modified by ScyllaDB
+> -- from cassandra/test/unit/org/apache/cassandra/cql3/validation/operations/BatchTest.java
+> --
+> --
+> --------------------------------------------------------------------------------
+> --
+> -- Copyright (C) 2016-present ScyllaDB
+> --
+> -- Modified by ScyllaDB
+> --
+> -- SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
+>
+> -- setup
+> CREATE KEYSPACE k WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> USE k;
+OK
+>
+> -- testBatch
+> CREATE TABLE t (userid text PRIMARY KEY, name text, password text);
+OK
+> BEGIN BATCH
+> INSERT INTO t (userid, password, name) VALUES ('user2', 'ch@ngem3b', 'second user')
+> UPDATE t SET password = 'ps22dhds' WHERE userid = 'user3'
+> INSERT INTO t (userid, password) VALUES ('user4', 'ch@ngem3c')
+> DELETE name FROM t WHERE userid = 'user1'
+> APPLY BATCH;
+OK
+> SELECT * FROM t;
++----------+-------------+------------+
+| userid | name | password |
+|----------+-------------+------------|
+| user2 | second user | ch@ngem3b |
+| user4 | null | ch@ngem3c |
+| user3 | null | ps22dhds |
++----------+-------------+------------+
+> DROP TABLE t;
+OK
+> --
+> -- testBatchAndList
+> CREATE TABLE t (k int PRIMARY KEY, l list<int>);
+OK
+> BEGIN BATCH
+> UPDATE t SET l = l + [ 1 ] WHERE k = 0
+> UPDATE t SET l = l + [ 2 ] WHERE k = 0
+> UPDATE t SET l = l + [ 3 ] WHERE k = 0
+> APPLY BATCH;
+OK
+> SELECT l FROM t WHERE k = 0;
++-----------+
+| l |
+|-----------|
+| [1, 2, 3] |
++-----------+
+> BEGIN BATCH
+> UPDATE t SET l = [ 1 ] + l WHERE k = 1
+> UPDATE t SET l = [ 2 ] + l WHERE k = 1
+> UPDATE t SET l = [ 3 ] + l WHERE k = 1
+> APPLY BATCH;
+OK
+> SELECT l FROM t WHERE k = 1;
++-----------+
+| l |
+|-----------|
+| [3, 2, 1] |
++-----------+
+> DROP TABLE t;
+OK
+> --
+> -- testBatchDeleteInsert
+> CREATE TABLE t (k int, v int, PRIMARY KEY (k, v));
+OK
+> INSERT INTO t (k, v) VALUES (0, 1);
+OK
+> BEGIN BATCH
+> DELETE FROM t WHERE k=0 AND v=1
+> INSERT INTO t (k, v) VALUES (0, 2)
+> APPLY BATCH;
+OK
+> SELECT * FROM t;
++-----+-----+
+| k | v |
+|-----+-----|
+| 0 | 2 |
++-----+-----+
+> DROP TABLE t;
+OK
+>
+> -- testBatchWithUnset
+> CREATE TABLE t (k int PRIMARY KEY, s text, i int);
+OK
+> BEGIN BATCH
+> INSERT INTO t JSON '{"k": 100, "s": null}' DEFAULT UNSET
+> INSERT INTO t JSON '{"k": 111, "i": null}' DEFAULT UNSET
+> APPLY BATCH;
+OK
+> SELECT k, s, i FROM t where k in (100,111);
++-----+------+------+
+| k | s | i |
+|-----+------+------|
+| 100 | null | null |
+| 111 | null | null |
++-----+------+------+
+> DROP TABLE t;
+OK
+>
+> -- testBatchUpdate
+> CREATE TABLE t (partitionKey int, clustering_1 int, value int, PRIMARY KEY (partitionKey, clustering_1));
+OK
+> INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 0, 0);
+OK
+> INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 1, 1);
+OK
+> INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 2, 2);
+OK
+> INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 3, 3);
+OK
+> INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 4, 4);
+OK
+> INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 5, 5);
+OK
+> INSERT INTO t (partitionKey, clustering_1, value) VALUES (0, 6, 6);
+OK
+>
+> BEGIN BATCH
+> UPDATE t SET value = 7 WHERE partitionKey = 0 AND clustering_1 = 1
+> UPDATE t SET value = 8 WHERE partitionKey = 0 AND (clustering_1) = (2)
+> UPDATE t SET value = 10 WHERE partitionKey = 0 AND clustering_1 IN (3, 4)
+> UPDATE t SET value = 20 WHERE partitionKey = 0 AND (clustering_1) IN ((5), (6))
+> APPLY BATCH;
+OK
+> SELECT * FROM t;
++----------------+----------------+---------+
+| partitionkey | clustering_1 | value |
+|----------------+----------------+---------|
+| 0 | 0 | 0 |
+| 0 | 1 | 7 |
+| 0 | 2 | 8 |
+| 0 | 3 | 10 |
+| 0 | 4 | 10 |
+| 0 | 5 | 20 |
+| 0 | 6 | 20 |
++----------------+----------------+---------+
+> DROP TABLE t;
+OK
+>
+> -- testBatchEmpty
+> BEGIN BATCH APPLY BATCH;
+OK
+>
+> -- testBatchMultipleTable
+> CREATE TABLE t1 (k1 int PRIMARY KEY, v11 int, v12 int);
+OK
+> CREATE TABLE t2 (k2 int PRIMARY KEY, v21 int, v22 int);
+OK
+> BEGIN BATCH
+> UPDATE t1 SET v11 = 1 WHERE k1 = 0
+> UPDATE t1 SET v12 = 2 WHERE k1 = 0
+> UPDATE t2 SET v21 = 3 WHERE k2 = 0
+> UPDATE t2 SET v22 = 4 WHERE k2 = 0
+> APPLY BATCH;
+OK
+> SELECT * FROM t1;
++------+-------+-------+
+| k1 | v11 | v12 |
+|------+-------+-------|
+| 0 | 1 | 2 |
++------+-------+-------+
+> SELECT * FROM t2;
++------+-------+-------+
+| k2 | v21 | v22 |
+|------+-------+-------|
+| 0 | 3 | 4 |
++------+-------+-------+
+> SELECT * FROM t1;
++------+-------+-------+
+| k1 | v11 | v12 |
+|------+-------+-------|
+| 0 | 1 | 2 |
++------+-------+-------+
+> SELECT * FROM t2;
++------+-------+-------+
+| k2 | v21 | v22 |
+|------+-------+-------|
+| 0 | 3 | 4 |
++------+-------+-------+
+> DROP TABLE t1;
+OK
+> DROP TABLE t2;
+OK
+>
+> -- testBatchWithInRestriction
+> CREATE TABLE t (a int, b int, c int, PRIMARY KEY (a,b));
+OK
+> INSERT INTO t (a,b,c) VALUES (1, 1, 1);
+OK
+> INSERT INTO t (a,b,c) VALUES (1, 2, 2);
+OK
+> INSERT INTO t (a,b,c) VALUES (1, 3, 3);
+OK
+> BEGIN BATCH
+> UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
+> UPDATE t SET c = 200 WHERE a = 1 AND b IN () IF c = 1
+> APPLY BATCH;
+Error from server: code=2200 [Invalid query] message="IN on the clustering key columns is not supported with conditional updates"
+> BEGIN BATCH
+> UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
+> DELETE FROM t WHERE a = 1 AND b IN () IF c = 1
+> APPLY BATCH;
+Error from server: code=2200 [Invalid query] message="IN on the clustering key columns is not supported with conditional deletions"
+> BEGIN BATCH
+> UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
+> UPDATE t SET c = 200 WHERE a IN () AND b = 1 IF c = 1
+> APPLY BATCH;
+Error from server: code=2200 [Invalid query] message="IN on the partition key is not supported with conditional updates"
+> BEGIN BATCH
+> UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
+> DELETE FROM t WHERE a IN () AND b = 1 IF c = 1
+> APPLY BATCH;
+Error from server: code=2200 [Invalid query] message="IN on the partition key is not supported with conditional deletions"
+>
+> BEGIN BATCH
+> UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
+> UPDATE t SET c = 200 WHERE a = 1 AND b IN (1, 2) IF c = 1
+> APPLY BATCH;
+Error from server: code=2200 [Invalid query] message="IN on the clustering key columns is not supported with conditional updates"
+>
+> BEGIN BATCH
+> UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
+> DELETE FROM t WHERE a = 1 AND b IN (1, 2) IF c = 1
+> APPLY BATCH;
+Error from server: code=2200 [Invalid query] message="IN on the clustering key columns is not supported with conditional deletions"
+>
+> BEGIN BATCH
+> UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
+> UPDATE t SET c = 200 WHERE a IN (1, 2) AND b = 1 IF c = 1
+> APPLY BATCH;
+Error from server: code=2200 [Invalid query] message="IN on the partition key is not supported with conditional updates"
+> BEGIN BATCH
+> UPDATE t SET c = 100 WHERE a = 1 AND b = 1 IF c = 1
+> DELETE FROM t WHERE a IN (1, 2) AND b = 1 IF c = 1
+> APPLY BATCH;
+Error from server: code=2200 [Invalid query] message="IN on the partition key is not supported with conditional deletions"
+>
+> SELECT * FROM t;
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 1 | 1 | 1 |
+| 1 | 2 | 2 |
+| 1 | 3 | 3 |
++-----+-----+-----+
+> DROP TABLE t;
+OK
+> DROP KEYSPACE k;
+OK
diff --git a/test/cql/cassandra_cql_test.result b/test/cql/cassandra_cql_test.result
--- a/test/cql/cassandra_cql_test.result
+++ b/test/cql/cassandra_cql_test.result
null
diff --git a/test/cql/cdc_allow_dropping_manually_created_log_test.cql b/test/cql/cdc_allow_dropping_manually_created_log_test.cql
--- a/test/cql/cdc_allow_dropping_manually_created_log_test.cql
+++ b/test/cql/cdc_allow_dropping_manually_created_log_test.cql
@@ -1,3 +1,6 @@
+-- Error messages contain a keyspace name. Make the output stable.
+CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
create table ks.test_scylla_cdc_log (pk int primary key);
-- Should be possible to drop it
drop table ks.test_scylla_cdc_log;
+DROP KEYSPACE ks;
diff --git a/test/cql/cdc_allow_dropping_manually_created_log_test.result b/test/cql/cdc_allow_dropping_manually_created_log_test.result
--- a/test/cql/cdc_allow_dropping_manually_created_log_test.result
+++ b/test/cql/cdc_allow_dropping_manually_created_log_test.result
@@ -1,9 +1,10 @@
-create table ks.test_scylla_cdc_log (pk int primary key);
-{
- "status" : "ok"
-}
--- Should be possible to drop it
-drop table ks.test_scylla_cdc_log;
-{
- "status" : "ok"
-}
+> -- Error messages contain a keyspace name. Make the output stable.
+> CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> create table ks.test_scylla_cdc_log (pk int primary key);
+OK
+> -- Should be possible to drop it
+> drop table ks.test_scylla_cdc_log;
+OK
+> DROP KEYSPACE ks;
+OK
diff --git a/test/cql/cdc_batch_delete_postimage_test.cql b/test/cql/cdc_batch_delete_postimage_test.cql
--- a/test/cql/cdc_batch_delete_postimage_test.cql
+++ b/test/cql/cdc_batch_delete_postimage_test.cql
@@ -1,21 +1,24 @@
+-- Error messages contain a keyspace name. Make the output stable.
+CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
-- do range delete in batch
create table ks.t (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
-begin batch insert into ks.t (pk, ck, v) values (1, 1, 100); delete from t where pk = 1 and ck >= 1 and ck <= 2; apply batch;
+begin batch insert into ks.t (pk, ck, v) values (1, 1, 100); delete from ks.t where pk = 1 and ck >= 1 and ck <= 2; apply batch;
-select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from t_scylla_cdc_log;
+select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from ks.t_scylla_cdc_log;
-- do pk delete in batch
create table ks.t2 (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
-begin batch insert into ks.t2 (pk, ck, v) values (1, 1, 100); delete from t2 where pk = 1; apply batch;
+begin batch insert into ks.t2 (pk, ck, v) values (1, 1, 100); delete from ks.t2 where pk = 1; apply batch;
-select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from t2_scylla_cdc_log;
+select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from ks.t2_scylla_cdc_log;
-- do range delete in batch, but not matcing ck
create table ks.t3 (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
-- do range delete in batch
-begin batch insert into ks.t3 (pk, ck, v) values (1, 1, 100); delete from t3 where pk = 1 and ck >= 2 and ck <= 3; apply batch;
+begin batch insert into ks.t3 (pk, ck, v) values (1, 1, 100); delete from ks.t3 where pk = 1 and ck >= 2 and ck <= 3; apply batch;
-select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from t3_scylla_cdc_log;
+select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from ks.t3_scylla_cdc_log;
+DROP KEYSPACE ks;
diff --git a/test/cql/cdc_batch_delete_postimage_test.result b/test/cql/cdc_batch_delete_postimage_test.result
--- a/test/cql/cdc_batch_delete_postimage_test.result
+++ b/test/cql/cdc_batch_delete_postimage_test.result
@@ -1,111 +1,53 @@
--- do range delete in batch
-create table ks.t (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
-{
- "status" : "ok"
-}
-
-begin batch insert into ks.t (pk, ck, v) values (1, 1, 100); delete from t where pk = 1 and ck >= 1 and ck <= 2; apply batch;
-{
- "status" : "ok"
-}
-
-select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from t_scylla_cdc_log;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "2",
- "ck" : "1",
- "pk" : "1",
- "v" : "100"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "5",
- "ck" : "1",
- "pk" : "1"
- },
- {
- "cdc$batch_seq_no" : "2",
- "cdc$operation" : "7",
- "ck" : "2",
- "pk" : "1"
- }
- ]
-}
-
--- do pk delete in batch
-create table ks.t2 (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
-{
- "status" : "ok"
-}
-
-begin batch insert into ks.t2 (pk, ck, v) values (1, 1, 100); delete from t2 where pk = 1; apply batch;
-{
- "status" : "ok"
-}
-
-select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from t2_scylla_cdc_log;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "2",
- "ck" : "1",
- "pk" : "1",
- "v" : "100"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "4",
- "pk" : "1"
- }
- ]
-}
-
--- do range delete in batch, but not matcing ck
-create table ks.t3 (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
-{
- "status" : "ok"
-}
-
--- do range delete in batch
-begin batch insert into ks.t3 (pk, ck, v) values (1, 1, 100); delete from t3 where pk = 1 and ck >= 2 and ck <= 3; apply batch;
-{
- "status" : "ok"
-}
-
-select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from t3_scylla_cdc_log;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "2",
- "ck" : "1",
- "pk" : "1",
- "v" : "100"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "5",
- "ck" : "2",
- "pk" : "1"
- },
- {
- "cdc$batch_seq_no" : "2",
- "cdc$operation" : "7",
- "ck" : "3",
- "pk" : "1"
- },
- {
- "cdc$batch_seq_no" : "3",
- "cdc$operation" : "9",
- "ck" : "1",
- "pk" : "1",
- "v" : "100"
- }
- ]
-}
+> -- Error messages contain a keyspace name. Make the output stable.
+> CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> -- do range delete in batch
+> create table ks.t (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
+OK
+>
+> begin batch insert into ks.t (pk, ck, v) values (1, 1, 100); delete from ks.t where pk = 1 and ck >= 1 and ck <= 2; apply batch;
+OK
+>
+> select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from ks.t_scylla_cdc_log;
++--------------------+-----------------+------+------+------+
+| cdc$batch_seq_no | cdc$operation | pk | ck | v |
+|--------------------+-----------------+------+------+------|
+| 0 | 2 | 1 | 1 | 100 |
+| 1 | 5 | 1 | 1 | null |
+| 2 | 7 | 1 | 2 | null |
++--------------------+-----------------+------+------+------+
+>
+> -- do pk delete in batch
+> create table ks.t2 (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
+OK
+>
+> begin batch insert into ks.t2 (pk, ck, v) values (1, 1, 100); delete from ks.t2 where pk = 1; apply batch;
+OK
+>
+> select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from ks.t2_scylla_cdc_log;
++--------------------+-----------------+------+------+------+
+| cdc$batch_seq_no | cdc$operation | pk | ck | v |
+|--------------------+-----------------+------+------+------|
+| 0 | 2 | 1 | 1 | 100 |
+| 1 | 4 | 1 | null | null |
++--------------------+-----------------+------+------+------+
+>
+> -- do range delete in batch, but not matcing ck
+> create table ks.t3 (pk int, ck int, v int, primary key(pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true};
+OK
+>
+> -- do range delete in batch
+> begin batch insert into ks.t3 (pk, ck, v) values (1, 1, 100); delete from ks.t3 where pk = 1 and ck >= 2 and ck <= 3; apply batch;
+OK
+>
+> select "cdc$batch_seq_no", "cdc$operation", pk, ck, v from ks.t3_scylla_cdc_log;
++--------------------+-----------------+------+------+------+
+| cdc$batch_seq_no | cdc$operation | pk | ck | v |
+|--------------------+-----------------+------+------+------|
+| 0 | 2 | 1 | 1 | 100 |
+| 1 | 5 | 1 | 2 | null |
+| 2 | 7 | 1 | 3 | null |
+| 3 | 9 | 1 | 1 | 100 |
++--------------------+-----------------+------+------+------+
+> DROP KEYSPACE ks;
+OK
diff --git a/test/cql/cdc_compact_storage_test.cql b/test/cql/cdc_compact_storage_test.cql
--- a/test/cql/cdc_compact_storage_test.cql
+++ b/test/cql/cdc_compact_storage_test.cql
@@ -12,3 +12,5 @@ select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck from tb3_scylla_cd
-- Should add 3 rows (preimage + postimage + delta).
insert into tb3 (pk, ck) VALUES (2, 22) USING TTL 2223;
select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck from tb3_scylla_cdc_log;
+drop table tb2;
+drop table tb3;
diff --git a/test/cql/cdc_compact_storage_test.result b/test/cql/cdc_compact_storage_test.result
--- a/test/cql/cdc_compact_storage_test.result
+++ b/test/cql/cdc_compact_storage_test.result
@@ -1,149 +1,54 @@
-create table tb2 (pk int, ck int, v int, PRIMARY KEY (pk, ck)) with compact storage and cdc = {'enabled': true, 'preimage': true, 'postimage': true};
-{
- "status" : "ok"
-}
--- Should add 2 rows (postimage + delta).
-insert into tb2 (pk, ck, v) VALUES (2, 22, 111) USING TTL 2222;
-{
- "status" : "ok"
-}
-select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, v from tb2_scylla_cdc_log;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "1",
- "cdc$ttl" : "2222",
- "ck" : "22",
- "pk" : "2",
- "v" : "111"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "9",
- "ck" : "22",
- "pk" : "2",
- "v" : "111"
- }
- ]
-}
--- Should add 3 rows (preimage + postimage + delta).
-insert into tb2 (pk, ck, v) VALUES (2, 22, 1111) USING TTL 2223;
-{
- "status" : "ok"
-}
-select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, v from tb2_scylla_cdc_log;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "1",
- "cdc$ttl" : "2222",
- "ck" : "22",
- "pk" : "2",
- "v" : "111"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "9",
- "ck" : "22",
- "pk" : "2",
- "v" : "111"
- },
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "0",
- "ck" : "22",
- "pk" : "2",
- "v" : "111"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "1",
- "cdc$ttl" : "2223",
- "ck" : "22",
- "pk" : "2",
- "v" : "1111"
- },
- {
- "cdc$batch_seq_no" : "2",
- "cdc$operation" : "9",
- "ck" : "22",
- "pk" : "2",
- "v" : "1111"
- }
- ]
-}
-create table tb3 (pk int, ck int, PRIMARY KEY (pk, ck)) with compact storage and cdc = {'enabled': true, 'preimage': true, 'postimage': true};
-{
- "status" : "ok"
-}
--- Should add 2 rows (postimage + delta).
-insert into tb3 (pk, ck) VALUES (2, 22) USING TTL 2222;
-{
- "status" : "ok"
-}
-select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck from tb3_scylla_cdc_log;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "1",
- "cdc$ttl" : "2222",
- "ck" : "22",
- "pk" : "2"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "9",
- "ck" : "22",
- "pk" : "2"
- }
- ]
-}
--- Should add 3 rows (preimage + postimage + delta).
-insert into tb3 (pk, ck) VALUES (2, 22) USING TTL 2223;
-{
- "status" : "ok"
-}
-select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck from tb3_scylla_cdc_log;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "1",
- "cdc$ttl" : "2222",
- "ck" : "22",
- "pk" : "2"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "9",
- "ck" : "22",
- "pk" : "2"
- },
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "0",
- "ck" : "22",
- "pk" : "2"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "1",
- "cdc$ttl" : "2223",
- "ck" : "22",
- "pk" : "2"
- },
- {
- "cdc$batch_seq_no" : "2",
- "cdc$operation" : "9",
- "ck" : "22",
- "pk" : "2"
- }
- ]
-}
+> create table tb2 (pk int, ck int, v int, PRIMARY KEY (pk, ck)) with compact storage and cdc = {'enabled': true, 'preimage': true, 'postimage': true};
+OK
+> -- Should add 2 rows (postimage + delta).
+> insert into tb2 (pk, ck, v) VALUES (2, 22, 111) USING TTL 2222;
+OK
+> select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, v from tb2_scylla_cdc_log;
++--------------------+-----------------+-----------+------+------+-----+
+| cdc$batch_seq_no | cdc$operation | cdc$ttl | pk | ck | v |
+|--------------------+-----------------+-----------+------+------+-----|
+| 0 | 1 | 2222 | 2 | 22 | 111 |
+| 1 | 9 | null | 2 | 22 | 111 |
++--------------------+-----------------+-----------+------+------+-----+
+> -- Should add 3 rows (preimage + postimage + delta).
+> insert into tb2 (pk, ck, v) VALUES (2, 22, 1111) USING TTL 2223;
+OK
+> select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, v from tb2_scylla_cdc_log;
++--------------------+-----------------+-----------+------+------+------+
+| cdc$batch_seq_no | cdc$operation | cdc$ttl | pk | ck | v |
+|--------------------+-----------------+-----------+------+------+------|
+| 0 | 1 | 2222 | 2 | 22 | 111 |
+| 1 | 9 | null | 2 | 22 | 111 |
+| 0 | 0 | null | 2 | 22 | 111 |
+| 1 | 1 | 2223 | 2 | 22 | 1111 |
+| 2 | 9 | null | 2 | 22 | 1111 |
++--------------------+-----------------+-----------+------+------+------+
+> create table tb3 (pk int, ck int, PRIMARY KEY (pk, ck)) with compact storage and cdc = {'enabled': true, 'preimage': true, 'postimage': true};
+OK
+> -- Should add 2 rows (postimage + delta).
+> insert into tb3 (pk, ck) VALUES (2, 22) USING TTL 2222;
+OK
+> select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck from tb3_scylla_cdc_log;
++--------------------+-----------------+-----------+------+------+
+| cdc$batch_seq_no | cdc$operation | cdc$ttl | pk | ck |
+|--------------------+-----------------+-----------+------+------|
+| 0 | 1 | 2222 | 2 | 22 |
+| 1 | 9 | null | 2 | 22 |
++--------------------+-----------------+-----------+------+------+
+> -- Should add 3 rows (preimage + postimage + delta).
+> insert into tb3 (pk, ck) VALUES (2, 22) USING TTL 2223;
+OK
+> select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck from tb3_scylla_cdc_log;
++--------------------+-----------------+-----------+------+------+
+| cdc$batch_seq_no | cdc$operation | cdc$ttl | pk | ck |
+|--------------------+-----------------+-----------+------+------|
+| 0 | 1 | 2222 | 2 | 22 |
+| 1 | 9 | null | 2 | 22 |
+| 0 | 0 | null | 2 | 22 |
+| 1 | 1 | 2223 | 2 | 22 |
+| 2 | 9 | null | 2 | 22 |
++--------------------+-----------------+-----------+------+------+
+> drop table tb2;
+OK
+> drop table tb3;
+OK
diff --git a/test/cql/cdc_delta_modes_test.cql b/test/cql/cdc_delta_modes_test.cql
--- a/test/cql/cdc_delta_modes_test.cql
+++ b/test/cql/cdc_delta_modes_test.cql
@@ -7,3 +7,4 @@ alter table tb2 with cdc = {'enabled': true, 'preimage': true, 'postimage': true
-- Should add 3 rows (preimage + postimage + delta)
insert into tb2 (pk, ck, i1) VALUES (3, 33, 333) USING TTL 3333;
select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, i1 from tb2_scylla_cdc_log where pk = 3 and ck = 33 allow filtering;
+drop table tb2;
diff --git a/test/cql/cdc_delta_modes_test.result b/test/cql/cdc_delta_modes_test.result
--- a/test/cql/cdc_delta_modes_test.result
+++ b/test/cql/cdc_delta_modes_test.result
@@ -1,60 +1,27 @@
-create table tb2 (pk int, ck int, i1 int, PRIMARY KEY (pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true, 'delta': 'keys'};
-{
- "status" : "ok"
-}
--- Should add 3 rows (preimage + postimage + delta). Delta has only key columns and "pk" + "ck"
-insert into tb2 (pk, ck, i1) VALUES (2, 22, 222) USING TTL 2222;
-{
- "status" : "ok"
-}
-select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, i1 from tb2_scylla_cdc_log where pk = 2 and ck = 22 allow filtering;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "2",
- "cdc$ttl" : "2222",
- "ck" : "22",
- "pk" : "2"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "9",
- "ck" : "22",
- "i1" : "222",
- "pk" : "2"
- }
- ]
-}
-
-alter table tb2 with cdc = {'enabled': true, 'preimage': true, 'postimage': true, 'delta': 'full'};
-{
- "status" : "ok"
-}
--- Should add 3 rows (preimage + postimage + delta)
-insert into tb2 (pk, ck, i1) VALUES (3, 33, 333) USING TTL 3333;
-{
- "status" : "ok"
-}
-select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, i1 from tb2_scylla_cdc_log where pk = 3 and ck = 33 allow filtering;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "2",
- "cdc$ttl" : "3333",
- "ck" : "33",
- "i1" : "333",
- "pk" : "3"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "9",
- "ck" : "33",
- "i1" : "333",
- "pk" : "3"
- }
- ]
-}
+> create table tb2 (pk int, ck int, i1 int, PRIMARY KEY (pk, ck)) with cdc = {'enabled': true, 'preimage': true, 'postimage': true, 'delta': 'keys'};
+OK
+> -- Should add 3 rows (preimage + postimage + delta). Delta has only key columns and "pk" + "ck"
+> insert into tb2 (pk, ck, i1) VALUES (2, 22, 222) USING TTL 2222;
+OK
+> select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, i1 from tb2_scylla_cdc_log where pk = 2 and ck = 22 allow filtering;
++--------------------+-----------------+-----------+------+------+------+
+| cdc$batch_seq_no | cdc$operation | cdc$ttl | pk | ck | i1 |
+|--------------------+-----------------+-----------+------+------+------|
+| 0 | 2 | 2222 | 2 | 22 | null |
+| 1 | 9 | null | 2 | 22 | 222 |
++--------------------+-----------------+-----------+------+------+------+
+>
+> alter table tb2 with cdc = {'enabled': true, 'preimage': true, 'postimage': true, 'delta': 'full'};
+OK
+> -- Should add 3 rows (preimage + postimage + delta)
+> insert into tb2 (pk, ck, i1) VALUES (3, 33, 333) USING TTL 3333;
+OK
+> select "cdc$batch_seq_no", "cdc$operation", "cdc$ttl", pk, ck, i1 from tb2_scylla_cdc_log where pk = 3 and ck = 33 allow filtering;
++--------------------+-----------------+-----------+------+------+------+
+| cdc$batch_seq_no | cdc$operation | cdc$ttl | pk | ck | i1 |
+|--------------------+-----------------+-----------+------+------+------|
+| 0 | 2 | 3333 | 3 | 33 | 333 |
+| 1 | 9 | null | 3 | 33 | 333 |
++--------------------+-----------------+-----------+------+------+------+
+> drop table tb2;
+OK
diff --git a/test/cql/cdc_disallow_cdc_for_counters_test.cql b/test/cql/cdc_disallow_cdc_for_counters_test.cql
--- a/test/cql/cdc_disallow_cdc_for_counters_test.cql
+++ b/test/cql/cdc_disallow_cdc_for_counters_test.cql
@@ -1,7 +1,10 @@
-create table tb1 (pk int primary key, c1 counter) with cdc = {'enabled': true};
+-- Error messages contain a keyspace name. Make the output stable.
+CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+create table ks.tb1 (pk int primary key, c1 counter) with cdc = {'enabled': true};
-create table tb2 (pk int primary key, c1 counter);
-alter table tb2 with cdc = {'enabled': true};
+create table ks.tb2 (pk int primary key, c1 counter);
+alter table ks.tb2 with cdc = {'enabled': true};
-create table tb3 (pk int primary key) with cdc = {'enabled': true};
-alter table tb3 add (c1 counter);
\ No newline at end of file
+create table ks.tb3 (pk int primary key) with cdc = {'enabled': true};
+alter table ks.tb3 add (c1 counter);
+DROP KEYSPACE ks;
diff --git a/test/cql/cdc_disallow_cdc_for_counters_test.result b/test/cql/cdc_disallow_cdc_for_counters_test.result
--- a/test/cql/cdc_disallow_cdc_for_counters_test.result
+++ b/test/cql/cdc_disallow_cdc_for_counters_test.result
@@ -1,25 +1,17 @@
-create table tb1 (pk int primary key, c1 counter) with cdc = {'enabled': true};
-{
- "message" : "exceptions::invalid_request_exception (Cannot create CDC log for table ks.tb1. Counter support not implemented)",
- "status" : "error"
-}
-
-create table tb2 (pk int primary key, c1 counter);
-{
- "status" : "ok"
-}
-alter table tb2 with cdc = {'enabled': true};
-{
- "message" : "exceptions::invalid_request_exception (Cannot create CDC log for table ks.tb2. Counter support not implemented)",
- "status" : "error"
-}
-
-create table tb3 (pk int primary key) with cdc = {'enabled': true};
-{
- "status" : "ok"
-}
-alter table tb3 add (c1 counter);
-{
- "message" : "exceptions::configuration_exception (Cannot add a counter column (c1) in a non counter column family)",
- "status" : "error"
-}
+> -- Error messages contain a keyspace name. Make the output stable.
+> CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> create table ks.tb1 (pk int primary key, c1 counter) with cdc = {'enabled': true};
+Error from server: code=2200 [Invalid query] message="Cannot create CDC log for table ks.tb1. Counter support not implemented"
+>
+> create table ks.tb2 (pk int primary key, c1 counter);
+OK
+> alter table ks.tb2 with cdc = {'enabled': true};
+Error from server: code=2200 [Invalid query] message="Cannot create CDC log for table ks.tb2. Counter support not implemented"
+>
+> create table ks.tb3 (pk int primary key) with cdc = {'enabled': true};
+OK
+> alter table ks.tb3 add (c1 counter);
+<Error from server: code=2300 [Query invalid because of configuration issue] message="Cannot add a counter column (c1) in a non counter column family">
+> DROP KEYSPACE ks;
+OK
diff --git a/test/cql/cdc_disallow_materialized_view_for_cdc_log_test.cql b/test/cql/cdc_disallow_materialized_view_for_cdc_log_test.cql
--- a/test/cql/cdc_disallow_materialized_view_for_cdc_log_test.cql
+++ b/test/cql/cdc_disallow_materialized_view_for_cdc_log_test.cql
@@ -1,3 +1,6 @@
-create table tb1 (pk int primary key, v int) with cdc = {'enabled': true};
+-- Error messages contain a keyspace name. Make the output stable.
+CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+create table ks.tb1 (pk int primary key, v int) with cdc = {'enabled': true};
-create materialized view tb1_mv as select * from tb1_scylla_cdc_log where v is not null primary key (v);
+create materialized view ks.tb1_mv as select * from ks.tb1_scylla_cdc_log where v is not null primary key (v);
+DROP KEYSPACE ks;
diff --git a/test/cql/cdc_disallow_materialized_view_for_cdc_log_test.result b/test/cql/cdc_disallow_materialized_view_for_cdc_log_test.result
--- a/test/cql/cdc_disallow_materialized_view_for_cdc_log_test.result
+++ b/test/cql/cdc_disallow_materialized_view_for_cdc_log_test.result
@@ -1,10 +1,10 @@
-create table tb1 (pk int primary key, v int) with cdc = {'enabled': true};
-{
- "status" : "ok"
-}
-
-create materialized view tb1_mv as select * from tb1_scylla_cdc_log where v is not null primary key (v);
-{
- "message" : "exceptions::invalid_request_exception (Materialized views cannot be created on CDC Log tables)",
- "status" : "error"
-}
+> -- Error messages contain a keyspace name. Make the output stable.
+> CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> create table ks.tb1 (pk int primary key, v int) with cdc = {'enabled': true};
+OK
+>
+> create materialized view ks.tb1_mv as select * from ks.tb1_scylla_cdc_log where v is not null primary key (v);
+Error from server: code=2200 [Invalid query] message="Materialized views cannot be created on CDC Log tables"
+> DROP KEYSPACE ks;
+OK
diff --git a/test/cql/cdc_disallow_nested_cdc_logs_test.cql b/test/cql/cdc_disallow_nested_cdc_logs_test.cql
--- a/test/cql/cdc_disallow_nested_cdc_logs_test.cql
+++ b/test/cql/cdc_disallow_nested_cdc_logs_test.cql
@@ -1,2 +1,5 @@
-create table tbl (pk int primary key) with cdc = {'enabled': true};
-alter table tbl_scylla_cdc_log with cdc = {'enabled': true};
+-- Error messages contain a keyspace name. Make the output stable.
+CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+create table ks.tbl (pk int primary key) with cdc = {'enabled': true};
+alter table ks.tbl_scylla_cdc_log with cdc = {'enabled': true};
+DROP KEYSPACE ks;
diff --git a/test/cql/cdc_disallow_nested_cdc_logs_test.result b/test/cql/cdc_disallow_nested_cdc_logs_test.result
--- a/test/cql/cdc_disallow_nested_cdc_logs_test.result
+++ b/test/cql/cdc_disallow_nested_cdc_logs_test.result
@@ -1,9 +1,9 @@
-create table tbl (pk int primary key) with cdc = {'enabled': true};
-{
- "status" : "ok"
-}
-alter table tbl_scylla_cdc_log with cdc = {'enabled': true};
-{
- "message" : "exceptions::invalid_request_exception (Cannot create a CDC log for a table ks.tbl_scylla_cdc_log, because creating nested CDC logs is not allowed)",
- "status" : "error"
-}
+> -- Error messages contain a keyspace name. Make the output stable.
+> CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> create table ks.tbl (pk int primary key) with cdc = {'enabled': true};
+OK
+> alter table ks.tbl_scylla_cdc_log with cdc = {'enabled': true};
+Error from server: code=2200 [Invalid query] message="Cannot create a CDC log for a table ks.tbl_scylla_cdc_log, because creating nested CDC logs is not allowed"
+> DROP KEYSPACE ks;
+OK
diff --git a/test/cql/cdc_static_and_clustered_rows_test.cql b/test/cql/cdc_static_and_clustered_rows_test.cql
--- a/test/cql/cdc_static_and_clustered_rows_test.cql
+++ b/test/cql/cdc_static_and_clustered_rows_test.cql
@@ -1,3 +1,5 @@
+-- Error messages contain a keyspace name. Make the output stable.
+CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
create table ks.t (pk int, ck int, vs int static, vc int, primary key (pk, ck)) with cdc = {'enabled': true, 'preimage': true};
-- generates 2 rows: preimage(static), delta(static)
@@ -17,5 +19,6 @@ update ks.t set vc = 4 where pk = 1 and ck = 0;
update ks.t set vc = 5 where pk = 1 and ck = 0;
select "cdc$batch_seq_no", "cdc$operation", ck, vs, vc from ks.t_scylla_cdc_log where pk = 1 and ck = 0 allow filtering;
--- there should be 16 rows in total
+-- there should be 13 rows in total
select count(*) from ks.t_scylla_cdc_log;
+DROP KEYSPACE ks;
diff --git a/test/cql/cdc_static_and_clustered_rows_test.result b/test/cql/cdc_static_and_clustered_rows_test.result
--- a/test/cql/cdc_static_and_clustered_rows_test.result
+++ b/test/cql/cdc_static_and_clustered_rows_test.result
@@ -1,144 +1,59 @@
-create table ks.t (pk int, ck int, vs int static, vc int, primary key (pk, ck)) with cdc = {'enabled': true, 'preimage': true};
-{
- "status" : "ok"
-}
-
--- generates 2 rows: preimage(static), delta(static)
-update ks.t set vs = 0 where pk = 0;
-{
- "status" : "ok"
-}
--- generates 2 rows: preimage(static), delta(static)
-update ks.t set vs = 1 where pk = 0;
-{
- "status" : "ok"
-}
-
--- generates 4 rows: preimage(static), preimage(clustering), delta(static), delta(clustering)
-update ks.t set vs = 2, vc = 2 where pk = 0 and ck = 0;
-{
- "status" : "ok"
-}
--- generates 4 rows: preimage(static), preimage(clustering), delta(static), delta(clustering)
-update ks.t set vs = 3, vc = 3 where pk = 0 and ck = 0;
-{
- "status" : "ok"
-}
-select "cdc$batch_seq_no", "cdc$operation", ck, vs, vc from ks.t_scylla_cdc_log where pk = 0 allow filtering;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "1",
- "pk" : "0",
- "vs" : "0"
- },
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "0",
- "pk" : "0",
- "vs" : "0"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "1",
- "pk" : "0",
- "vs" : "1"
- },
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "0",
- "pk" : "0",
- "vs" : "1"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "1",
- "pk" : "0",
- "vs" : "2"
- },
- {
- "cdc$batch_seq_no" : "2",
- "cdc$operation" : "1",
- "ck" : "0",
- "pk" : "0",
- "vc" : "2"
- },
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "0",
- "pk" : "0",
- "vs" : "2"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "0",
- "ck" : "0",
- "pk" : "0",
- "vc" : "2"
- },
- {
- "cdc$batch_seq_no" : "2",
- "cdc$operation" : "1",
- "pk" : "0",
- "vs" : "3"
- },
- {
- "cdc$batch_seq_no" : "3",
- "cdc$operation" : "1",
- "ck" : "0",
- "pk" : "0",
- "vc" : "3"
- }
- ]
-}
-
--- generates 2 rows: preimage(clustering), delta(clustering)
-update ks.t set vc = 4 where pk = 1 and ck = 0;
-{
- "status" : "ok"
-}
--- generates 2 rows: preimage(clustering), delta(clustering)
-update ks.t set vc = 5 where pk = 1 and ck = 0;
-{
- "status" : "ok"
-}
-select "cdc$batch_seq_no", "cdc$operation", ck, vs, vc from ks.t_scylla_cdc_log where pk = 1 and ck = 0 allow filtering;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "1",
- "ck" : "0",
- "pk" : "1",
- "vc" : "4"
- },
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "0",
- "ck" : "0",
- "pk" : "1",
- "vc" : "4"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "1",
- "ck" : "0",
- "pk" : "1",
- "vc" : "5"
- }
- ]
-}
-
--- there should be 16 rows in total
-select count(*) from ks.t_scylla_cdc_log;
-{
- "rows" :
- [
- {
- "count" : "13"
- }
- ]
-}
+> -- Error messages contain a keyspace name. Make the output stable.
+> CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> create table ks.t (pk int, ck int, vs int static, vc int, primary key (pk, ck)) with cdc = {'enabled': true, 'preimage': true};
+OK
+>
+> -- generates 2 rows: preimage(static), delta(static)
+> update ks.t set vs = 0 where pk = 0;
+OK
+> -- generates 2 rows: preimage(static), delta(static)
+> update ks.t set vs = 1 where pk = 0;
+OK
+>
+> -- generates 4 rows: preimage(static), preimage(clustering), delta(static), delta(clustering)
+> update ks.t set vs = 2, vc = 2 where pk = 0 and ck = 0;
+OK
+> -- generates 4 rows: preimage(static), preimage(clustering), delta(static), delta(clustering)
+> update ks.t set vs = 3, vc = 3 where pk = 0 and ck = 0;
+OK
+> select "cdc$batch_seq_no", "cdc$operation", ck, vs, vc from ks.t_scylla_cdc_log where pk = 0 allow filtering;
++--------------------+-----------------+------+------+------+
+| cdc$batch_seq_no | cdc$operation | ck | vs | vc |
+|--------------------+-----------------+------+------+------|
+| 0 | 1 | null | 0 | null |
+| 0 | 0 | null | 0 | null |
+| 1 | 1 | null | 1 | null |
+| 0 | 0 | null | 1 | null |
+| 1 | 1 | null | 2 | null |
+| 2 | 1 | 0 | null | 2 |
+| 0 | 0 | null | 2 | null |
+| 1 | 0 | 0 | null | 2 |
+| 2 | 1 | null | 3 | null |
+| 3 | 1 | 0 | null | 3 |
++--------------------+-----------------+------+------+------+
+>
+> -- generates 2 rows: preimage(clustering), delta(clustering)
+> update ks.t set vc = 4 where pk = 1 and ck = 0;
+OK
+> -- generates 2 rows: preimage(clustering), delta(clustering)
+> update ks.t set vc = 5 where pk = 1 and ck = 0;
+OK
+> select "cdc$batch_seq_no", "cdc$operation", ck, vs, vc from ks.t_scylla_cdc_log where pk = 1 and ck = 0 allow filtering;
++--------------------+-----------------+------+------+------+
+| cdc$batch_seq_no | cdc$operation | ck | vs | vc |
+|--------------------+-----------------+------+------+------|
+| 0 | 1 | 0 | null | 4 |
+| 0 | 0 | 0 | null | 4 |
+| 1 | 1 | 0 | null | 5 |
++--------------------+-----------------+------+------+------+
+>
+> -- there should be 13 rows in total
+> select count(*) from ks.t_scylla_cdc_log;
++---------+
+| count |
+|---------|
+| 13 |
++---------+
+> DROP KEYSPACE ks;
+OK
diff --git a/test/cql/cdc_too_short_stream_id_test.result b/test/cql/cdc_too_short_stream_id_test.result
--- a/test/cql/cdc_too_short_stream_id_test.result
+++ b/test/cql/cdc_too_short_stream_id_test.result
@@ -1,19 +1,17 @@
-create table tb (pk int primary key) with cdc = {'enabled': true};
-{
- "status" : "ok"
-}
-insert into tb (pk) VALUES (0);
-{
- "status" : "ok"
-}
-
--- Key of length != 128 b should return empty result set (issue #6570)
-select * from tb_scylla_cdc_log where "cdc$stream_id" = 0x00;
-{
- "rows" : null
-}
-
-select * from tb_scylla_cdc_log where "cdc$stream_id" = 0x;
-{
- "rows" : null
-}
+> create table tb (pk int primary key) with cdc = {'enabled': true};
+OK
+> insert into tb (pk) VALUES (0);
+OK
+>
+> -- Key of length != 128 b should return empty result set (issue #6570)
+> select * from tb_scylla_cdc_log where "cdc$stream_id" = 0x00;
++-----------------+------------+--------------------+--------------------+-----------------+-----------+------+
+| cdc$stream_id | cdc$time | cdc$batch_seq_no | cdc$end_of_batch | cdc$operation | cdc$ttl | pk |
+|-----------------+------------+--------------------+--------------------+-----------------+-----------+------|
++-----------------+------------+--------------------+--------------------+-----------------+-----------+------+
+>
+> select * from tb_scylla_cdc_log where "cdc$stream_id" = 0x;
++-----------------+------------+--------------------+--------------------+-----------------+-----------+------+
+| cdc$stream_id | cdc$time | cdc$batch_seq_no | cdc$end_of_batch | cdc$operation | cdc$ttl | pk |
+|-----------------+------------+--------------------+--------------------+-----------------+-----------+------|
++-----------------+------------+--------------------+--------------------+-----------------+-----------+------+
diff --git a/test/cql/cdc_with_lwt_test.cql b/test/cql/cdc_with_lwt_test.cql
--- a/test/cql/cdc_with_lwt_test.cql
+++ b/test/cql/cdc_with_lwt_test.cql
@@ -1,3 +1,5 @@
+-- Error messages contain a keyspace name. Make the output stable.
+CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
CREATE TABLE ks.tbl_cdc_lwt (pk int, ck int, val int, PRIMARY KEY(pk, ck)) WITH cdc = {'enabled':true, 'preimage':true};
-- (0) successful insert
@@ -17,3 +19,4 @@ SELECT "cdc$batch_seq_no", "cdc$operation", ck, pk, val FROM ks.tbl_cdc_lwt_scyl
-- there should be 6 rows in total: (0) + preimg(0) + (2) + preimg(2) + (4) + preimg(4)
SELECT count(*) FROM ks.tbl_cdc_lwt_scylla_cdc_log;
+DROP KEYSPACE ks;
diff --git a/test/cql/cdc_with_lwt_test.result b/test/cql/cdc_with_lwt_test.result
--- a/test/cql/cdc_with_lwt_test.result
+++ b/test/cql/cdc_with_lwt_test.result
@@ -1,126 +1,69 @@
-CREATE TABLE ks.tbl_cdc_lwt (pk int, ck int, val int, PRIMARY KEY(pk, ck)) WITH cdc = {'enabled':true, 'preimage':true};
-{
- "status" : "ok"
-}
-
--- (0) successful insert
-INSERT INTO ks.tbl_cdc_lwt (pk, ck, val) VALUES (1, 1, 111) IF NOT EXISTS;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- }
- ]
-}
--- (1) unsuccessful insert
-INSERT INTO ks.tbl_cdc_lwt (pk, ck, val) VALUES (1, 1, 222) IF NOT EXISTS;
-{
- "rows" :
- [
- {
- "[applied]" : "false",
- "ck" : "1",
- "pk" : "1",
- "val" : "111"
- }
- ]
-}
--- (2) successful update
-UPDATE ks.tbl_cdc_lwt set val = 333 WHERE pk = 1 and ck = 1 IF EXISTS;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "ck" : "1",
- "pk" : "1",
- "val" : "111"
- }
- ]
-}
--- (3) unsuccessful update
-UPDATE ks.tbl_cdc_lwt set val = 444 WHERE pk = 888 and ck = 777 IF EXISTS;
-{
- "rows" :
- [
- {
- "[applied]" : "false"
- }
- ]
-}
--- (4) successful row delete
-DELETE FROM ks.tbl_cdc_lwt WHERE pk = 1 AND ck = 1 IF EXISTS;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "ck" : "1",
- "pk" : "1",
- "val" : "333"
- }
- ]
-}
--- (5) unsuccessful row delete
-DELETE FROM ks.tbl_cdc_lwt WHERE pk = 1 AND ck = 1 IF EXISTS;
-{
- "rows" :
- [
- {
- "[applied]" : "false"
- }
- ]
-}
-
-SELECT "cdc$batch_seq_no", "cdc$operation", ck, pk, val FROM ks.tbl_cdc_lwt_scylla_cdc_log;
-{
- "rows" :
- [
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "2",
- "ck" : "1",
- "pk" : "1",
- "val" : "111"
- },
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "0",
- "ck" : "1",
- "pk" : "1",
- "val" : "111"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "1",
- "ck" : "1",
- "pk" : "1",
- "val" : "333"
- },
- {
- "cdc$batch_seq_no" : "0",
- "cdc$operation" : "0",
- "ck" : "1",
- "pk" : "1",
- "val" : "333"
- },
- {
- "cdc$batch_seq_no" : "1",
- "cdc$operation" : "3",
- "ck" : "1",
- "pk" : "1"
- }
- ]
-}
-
--- there should be 6 rows in total: (0) + preimg(0) + (2) + preimg(2) + (4) + preimg(4)
-SELECT count(*) FROM ks.tbl_cdc_lwt_scylla_cdc_log;
-{
- "rows" :
- [
- {
- "count" : "5"
- }
- ]
-}
+> -- Error messages contain a keyspace name. Make the output stable.
+> CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> CREATE TABLE ks.tbl_cdc_lwt (pk int, ck int, val int, PRIMARY KEY(pk, ck)) WITH cdc = {'enabled':true, 'preimage':true};
+OK
+>
+> -- (0) successful insert
+> INSERT INTO ks.tbl_cdc_lwt (pk, ck, val) VALUES (1, 1, 111) IF NOT EXISTS;
++-------------+------+------+-------+
+| [applied] | pk | ck | val |
+|-------------+------+------+-------|
+| True | null | null | null |
++-------------+------+------+-------+
+> -- (1) unsuccessful insert
+> INSERT INTO ks.tbl_cdc_lwt (pk, ck, val) VALUES (1, 1, 222) IF NOT EXISTS;
++-------------+------+------+-------+
+| [applied] | pk | ck | val |
+|-------------+------+------+-------|
+| False | 1 | 1 | 111 |
++-------------+------+------+-------+
+> -- (2) successful update
+> UPDATE ks.tbl_cdc_lwt set val = 333 WHERE pk = 1 and ck = 1 IF EXISTS;
++-------------+------+------+-------+
+| [applied] | pk | ck | val |
+|-------------+------+------+-------|
+| True | 1 | 1 | 111 |
++-------------+------+------+-------+
+> -- (3) unsuccessful update
+> UPDATE ks.tbl_cdc_lwt set val = 444 WHERE pk = 888 and ck = 777 IF EXISTS;
++-------------+------+------+-------+
+| [applied] | pk | ck | val |
+|-------------+------+------+-------|
+| False | null | null | null |
++-------------+------+------+-------+
+> -- (4) successful row delete
+> DELETE FROM ks.tbl_cdc_lwt WHERE pk = 1 AND ck = 1 IF EXISTS;
++-------------+------+------+-------+
+| [applied] | pk | ck | val |
+|-------------+------+------+-------|
+| True | 1 | 1 | 333 |
++-------------+------+------+-------+
+> -- (5) unsuccessful row delete
+> DELETE FROM ks.tbl_cdc_lwt WHERE pk = 1 AND ck = 1 IF EXISTS;
++-------------+------+------+-------+
+| [applied] | pk | ck | val |
+|-------------+------+------+-------|
+| False | null | null | null |
++-------------+------+------+-------+
+>
+> SELECT "cdc$batch_seq_no", "cdc$operation", ck, pk, val FROM ks.tbl_cdc_lwt_scylla_cdc_log;
++--------------------+-----------------+------+------+-------+
+| cdc$batch_seq_no | cdc$operation | ck | pk | val |
+|--------------------+-----------------+------+------+-------|
+| 0 | 2 | 1 | 1 | 111 |
+| 0 | 0 | 1 | 1 | 111 |
+| 1 | 1 | 1 | 1 | 333 |
+| 0 | 0 | 1 | 1 | 333 |
+| 1 | 3 | 1 | 1 | null |
++--------------------+-----------------+------+------+-------+
+>
+> -- there should be 6 rows in total: (0) + preimg(0) + (2) + preimg(2) + (4) + preimg(4)
+> SELECT count(*) FROM ks.tbl_cdc_lwt_scylla_cdc_log;
++---------+
+| count |
+|---------|
+| 5 |
++---------+
+> DROP KEYSPACE ks;
+OK
diff --git a/test/cql/counters_disallow_ttl_test.result b/test/cql/counters_disallow_ttl_test.result
--- a/test/cql/counters_disallow_ttl_test.result
+++ b/test/cql/counters_disallow_ttl_test.result
@@ -1,31 +1,15 @@
-create table tb1 (pk int primary key, c1 counter) with default_time_to_live = 100;
-{
- "message" : "exceptions::invalid_request_exception (Cannot set default_time_to_live on a table with counters)",
- "status" : "error"
-}
-
-create table tb2 (pk int primary key, c1 counter);
-{
- "status" : "ok"
-}
-alter table tb2 with default_time_to_live = 100;
-{
- "message" : "exceptions::invalid_request_exception (Cannot set default_time_to_live on a table with counters)",
- "status" : "error"
-}
-
-create table tb3 (pk int primary key) with default_time_to_live = 100;
-{
- "status" : "ok"
-}
-alter table tb3 add (c1 counter);
-{
- "message" : "exceptions::configuration_exception (Cannot add a counter column (c1) in a non counter column family)",
- "status" : "error"
-}
-
-create table tb4 (pk int, ck int, cs counter static, primary KEY (pk, ck)) with default_time_to_live = 100;
-{
- "message" : "exceptions::invalid_request_exception (Cannot set default_time_to_live on a table with counters)",
- "status" : "error"
-}
+> create table tb1 (pk int primary key, c1 counter) with default_time_to_live = 100;
+Error from server: code=2200 [Invalid query] message="Cannot set default_time_to_live on a table with counters"
+>
+> create table tb2 (pk int primary key, c1 counter);
+OK
+> alter table tb2 with default_time_to_live = 100;
+Error from server: code=2200 [Invalid query] message="Cannot set default_time_to_live on a table with counters"
+>
+> create table tb3 (pk int primary key) with default_time_to_live = 100;
+OK
+> alter table tb3 add (c1 counter);
+<Error from server: code=2300 [Query invalid because of configuration issue] message="Cannot add a counter column (c1) in a non counter column family">
+>
+> create table tb4 (pk int, ck int, cs counter static, primary KEY (pk, ck)) with default_time_to_live = 100;
+Error from server: code=2200 [Invalid query] message="Cannot set default_time_to_live on a table with counters"
diff --git a/test/cql/counters_test.cql b/test/cql/counters_test.cql
--- a/test/cql/counters_test.cql
+++ b/test/cql/counters_test.cql
@@ -1,3 +1,5 @@
+-- Error messages contain a keyspace name. Make the output stable.
+CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
CREATE TABLE ks.tbl_cnt (pk int PRIMARY KEY, c1 counter);
-- insert some values in one column
@@ -22,7 +24,7 @@ DELETE c1 from ks.tbl_cnt WHERE pk = 1;
SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 = 1 ALLOW FILTERING;
SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 <= 1000 ALLOW FILTERING;
SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 > -1000 ALLOW FILTERING;
-
+DROP KEYSPACE ks;
CREATE TABLE counter_bug (t int, c counter, primary key(t));
UPDATE counter_bug SET c = c + 9223372036854775807 where t = 0;
diff --git a/test/cql/counters_test.result b/test/cql/counters_test.result
--- a/test/cql/counters_test.result
+++ b/test/cql/counters_test.result
@@ -1,206 +1,126 @@
-CREATE TABLE ks.tbl_cnt (pk int PRIMARY KEY, c1 counter);
-{
- "status" : "ok"
-}
-
--- insert some values in one column
-UPDATE ks.tbl_cnt SET c1 = c1+1 WHERE pk = 1;
-{
- "status" : "ok"
-}
-UPDATE ks.tbl_cnt SET c1 = c1+2 WHERE pk = 2;
-{
- "status" : "ok"
-}
-UPDATE ks.tbl_cnt SET c1 = c1+3 WHERE pk = 3;
-{
- "status" : "ok"
-}
-UPDATE ks.tbl_cnt SET c1 = c1+4 WHERE pk = 4;
-{
- "status" : "ok"
-}
-
--- test various filtering options on counter column
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 < 3 ALLOW FILTERING;
-{
- "rows" :
- [
- {
- "c1" : "1",
- "pk" : "1"
- },
- {
- "c1" : "2",
- "pk" : "2"
- }
- ]
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 < 1 ALLOW FILTERING;
-{
- "rows" : null
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 <= 3 ALLOW FILTERING;
-{
- "rows" :
- [
- {
- "c1" : "1",
- "pk" : "1"
- },
- {
- "c1" : "2",
- "pk" : "2"
- },
- {
- "c1" : "3",
- "pk" : "3"
- }
- ]
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 > 2 AND pk = 4 ALLOW FILTERING;
-{
- "rows" :
- [
- {
- "c1" : "4",
- "pk" : "4"
- }
- ]
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 >= 3 and pk = 3 ALLOW FILTERING;
-{
- "rows" :
- [
- {
- "c1" : "3",
- "pk" : "3"
- }
- ]
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 > 4 ALLOW FILTERING;
-{
- "rows" : null
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 in (-1, 2, 3) ALLOW FILTERING;
-{
- "rows" :
- [
- {
- "c1" : "2",
- "pk" : "2"
- },
- {
- "c1" : "3",
- "pk" : "3"
- }
- ]
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 = 0 ALLOW FILTERING;
-{
- "rows" : null
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 = 1 ALLOW FILTERING;
-{
- "rows" :
- [
- {
- "c1" : "1",
- "pk" : "1"
- }
- ]
-}
-
--- delete `c1` and make sure it doesn't appear in filtering results
-DELETE c1 from ks.tbl_cnt WHERE pk = 1;
-{
- "status" : "ok"
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 = 1 ALLOW FILTERING;
-{
- "rows" : null
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 <= 1000 ALLOW FILTERING;
-{
- "rows" :
- [
- {
- "c1" : "2",
- "pk" : "2"
- },
- {
- "c1" : "4",
- "pk" : "4"
- },
- {
- "c1" : "3",
- "pk" : "3"
- }
- ]
-}
-SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 > -1000 ALLOW FILTERING;
-{
- "rows" :
- [
- {
- "c1" : "2",
- "pk" : "2"
- },
- {
- "c1" : "4",
- "pk" : "4"
- },
- {
- "c1" : "3",
- "pk" : "3"
- }
- ]
-}
-
-
-CREATE TABLE counter_bug (t int, c counter, primary key(t));
-{
- "status" : "ok"
-}
-UPDATE counter_bug SET c = c + 9223372036854775807 where t = 0;
-{
- "status" : "ok"
-}
-SELECT * from counter_bug;
-{
- "rows" :
- [
- {
- "c" : "9223372036854775807",
- "t" : "0"
- }
- ]
-}
-UPDATE counter_bug SET c = c + 1 where t = 0;
-{
- "status" : "ok"
-}
-SELECT * from counter_bug;
-{
- "rows" :
- [
- {
- "c" : "-9223372036854775808",
- "t" : "0"
- }
- ]
-}
-UPDATE counter_bug SET c = c - 1 where t = 0;
-{
- "status" : "ok"
-}
-SELECT * from counter_bug;
-{
- "rows" :
- [
- {
- "c" : "9223372036854775807",
- "t" : "0"
- }
- ]
-}
+> -- Error messages contain a keyspace name. Make the output stable.
+> CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> CREATE TABLE ks.tbl_cnt (pk int PRIMARY KEY, c1 counter);
+OK
+>
+> -- insert some values in one column
+> UPDATE ks.tbl_cnt SET c1 = c1+1 WHERE pk = 1;
+OK
+> UPDATE ks.tbl_cnt SET c1 = c1+2 WHERE pk = 2;
+OK
+> UPDATE ks.tbl_cnt SET c1 = c1+3 WHERE pk = 3;
+OK
+> UPDATE ks.tbl_cnt SET c1 = c1+4 WHERE pk = 4;
+OK
+>
+> -- test various filtering options on counter column
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 < 3 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
+| 1 | 1 |
+| 2 | 2 |
++------+------+
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 < 1 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
++------+------+
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 <= 3 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
+| 1 | 1 |
+| 2 | 2 |
+| 3 | 3 |
++------+------+
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 > 2 AND pk = 4 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
+| 4 | 4 |
++------+------+
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 >= 3 and pk = 3 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
+| 3 | 3 |
++------+------+
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 > 4 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
++------+------+
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 in (-1, 2, 3) ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
+| 2 | 2 |
+| 3 | 3 |
++------+------+
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 = 0 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
++------+------+
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 = 1 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
+| 1 | 1 |
++------+------+
+>
+> -- delete `c1` and make sure it doesn't appear in filtering results
+> DELETE c1 from ks.tbl_cnt WHERE pk = 1;
+OK
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 = 1 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
++------+------+
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 <= 1000 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
+| 2 | 2 |
+| 4 | 4 |
+| 3 | 3 |
++------+------+
+> SELECT pk, c1 FROM ks.tbl_cnt WHERE c1 > -1000 ALLOW FILTERING;
++------+------+
+| pk | c1 |
+|------+------|
+| 2 | 2 |
+| 4 | 4 |
+| 3 | 3 |
++------+------+
+> DROP KEYSPACE ks;
+OK
+>
+> CREATE TABLE counter_bug (t int, c counter, primary key(t));
+OK
+> UPDATE counter_bug SET c = c + 9223372036854775807 where t = 0;
+OK
+> SELECT * from counter_bug;
++-----+---------------------+
+| t | c |
+|-----+---------------------|
+| 0 | 9223372036854775807 |
++-----+---------------------+
+> UPDATE counter_bug SET c = c + 1 where t = 0;
+OK
+> SELECT * from counter_bug;
++-----+----------------------+
+| t | c |
+|-----+----------------------|
+| 0 | -9223372036854775808 |
++-----+----------------------+
+> UPDATE counter_bug SET c = c - 1 where t = 0;
+OK
+> SELECT * from counter_bug;
++-----+---------------------+
+| t | c |
+|-----+---------------------|
+| 0 | 9223372036854775807 |
++-----+---------------------+
diff --git a/test/cql/forbid_adding_to_udt_used_in_partkey_test.cql b/test/cql/forbid_adding_to_udt_used_in_partkey_test.cql
--- a/test/cql/forbid_adding_to_udt_used_in_partkey_test.cql
+++ b/test/cql/forbid_adding_to_udt_used_in_partkey_test.cql
@@ -1,7 +1,10 @@
-create type ut (a int);
-create table t (pk frozen<ut> primary key);
-alter type ut add b int;
-drop table t;
-alter type ut add c int;
-create table t2 (pk frozen<list<frozen<ut>>> primary key);
-alter type ut add d int;
+-- Error messages contain a keyspace name. Make the output stable.
+CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+create type ks.ut (a int);
+create table ks.t (pk frozen<ut> primary key);
+alter type ks.ut add b int;
+drop table ks.t;
+alter type ks.ut add c int;
+create table ks.t2 (pk frozen<list<frozen<ut>>> primary key);
+alter type ks.ut add d int;
+DROP KEYSPACE ks;
diff --git a/test/cql/forbid_adding_to_udt_used_in_partkey_test.result b/test/cql/forbid_adding_to_udt_used_in_partkey_test.result
--- a/test/cql/forbid_adding_to_udt_used_in_partkey_test.result
+++ b/test/cql/forbid_adding_to_udt_used_in_partkey_test.result
@@ -1,30 +1,19 @@
-create type ut (a int);
-{
- "status" : "ok"
-}
-create table t (pk frozen<ut> primary key);
-{
- "status" : "ok"
-}
-alter type ut add b int;
-{
- "message" : "exceptions::invalid_request_exception (Cannot add new field to type ks.ut because it is used in the partition key column pk of table ks.t)",
- "status" : "error"
-}
-drop table t;
-{
- "status" : "ok"
-}
-alter type ut add c int;
-{
- "status" : "ok"
-}
-create table t2 (pk frozen<list<frozen<ut>>> primary key);
-{
- "status" : "ok"
-}
-alter type ut add d int;
-{
- "message" : "exceptions::invalid_request_exception (Cannot add new field to type ks.ut because it is used in the partition key column pk of table ks.t2)",
- "status" : "error"
-}
+> -- Error messages contain a keyspace name. Make the output stable.
+> CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> create type ks.ut (a int);
+OK
+> create table ks.t (pk frozen<ut> primary key);
+OK
+> alter type ks.ut add b int;
+Error from server: code=2200 [Invalid query] message="Cannot add new field to type ks.ut because it is used in the partition key column pk of table ks.t"
+> drop table ks.t;
+OK
+> alter type ks.ut add c int;
+OK
+> create table ks.t2 (pk frozen<list<frozen<ut>>> primary key);
+OK
+> alter type ks.ut add d int;
+Error from server: code=2200 [Invalid query] message="Cannot add new field to type ks.ut because it is used in the partition key column pk of table ks.t2"
+> DROP KEYSPACE ks;
+OK
diff --git a/test/cql/list_test.result b/test/cql/list_test.result
--- a/test/cql/list_test.result
+++ b/test/cql/list_test.result
@@ -1,340 +1,216 @@
-CREATE TABLE t (pk INT PRIMARY KEY, l LIST<INT>);
-{
- "status" : "ok"
-}
-UPDATE t SET l = [-1] + l WHERE pk = 0;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-1]"
- }
- ]
-}
-UPDATE t SET l = [-3,-2] + l WHERE pk = 0;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-3, -2, -1]"
- }
- ]
-}
-UPDATE t SET l = [-4] + l WHERE pk = 0 IF EXISTS;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "l" : "[-3, -2, -1]",
- "pk" : "0"
- }
- ]
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-4, -3, -2, -1]"
- }
- ]
-}
-UPDATE t SET l = [-6, -5] + l WHERE pk = 0 IF EXISTS;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "l" : "[-4, -3, -2, -1]",
- "pk" : "0"
- }
- ]
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-6, -5, -4, -3, -2, -1]"
- }
- ]
-}
-UPDATE t SET l = l + [1] WHERE pk = 0;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-6, -5, -4, -3, -2, -1, 1]"
- }
- ]
-}
-UPDATE t SET l = l + [2,3] WHERE pk = 0;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-6, -5, -4, -3, -2, -1, 1, 2, 3]"
- }
- ]
-}
-UPDATE t SET l = l + [4] WHERE pk = 0 IF EXISTS;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "l" : "[-6, -5, -4, -3, -2, -1, 1, 2, 3]",
- "pk" : "0"
- }
- ]
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-6, -5, -4, -3, -2, -1, 1, 2, 3, 4]"
- }
- ]
-}
-UPDATE t SET l = l + [5,6] WHERE pk = 0 IF EXISTS;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "l" : "[-6, -5, -4, -3, -2, -1, 1, 2, 3, 4]",
- "pk" : "0"
- }
- ]
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6]"
- }
- ]
-}
-BEGIN BATCH
- UPDATE t SET l = l + [7] WHERE pk = 0
- UPDATE t SET l = [-7] + l WHERE pk = 0
- UPDATE t SET l = l + [8, 9] WHERE pk = 0
- UPDATE t SET l = l + [10] WHERE pk = 0
- UPDATE t SET l = [-9, -8] + l WHERE pk = 0
- UPDATE t SET l = [-10] + l WHERE pk = 0
-APPLY BATCH;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
- }
- ]
-}
--- LWT batch
-BEGIN BATCH
- UPDATE t SET l = [-11] + l WHERE pk = 0 IF EXISTS
- UPDATE t SET l = [-13, -12] + l WHERE pk = 0 IF EXISTS
- UPDATE t SET l = [-14] + l WHERE pk = 0 IF EXISTS
- UPDATE t SET l = l + [11] WHERE pk = 0 IF EXISTS
- UPDATE t SET l = l + [12, 13] WHERE pk = 0 IF EXISTS
- UPDATE t SET l = l + [14] WHERE pk = 0 IF EXISTS
-APPLY BATCH;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "l" : "[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
- "pk" : "0"
- },
- {
- "[applied]" : "true",
- "l" : "[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
- "pk" : "0"
- },
- {
- "[applied]" : "true",
- "l" : "[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
- "pk" : "0"
- },
- {
- "[applied]" : "true",
- "l" : "[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
- "pk" : "0"
- },
- {
- "[applied]" : "true",
- "l" : "[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
- "pk" : "0"
- },
- {
- "[applied]" : "true",
- "l" : "[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
- "pk" : "0"
- }
- ]
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]"
- }
- ]
-}
-
-DROP TABLE t;
-{
- "status" : "ok"
-}
--- test custom timestamps
--- Scylla, unlike Cassandra, takes custom timestamps into account
--- in list append/prepend operations
-CREATE TABLE t (pk INT PRIMARY KEY, l LIST<INT>);
-{
- "status" : "ok"
-}
-
--- Even though it's an append, since the timestamp is in the past,
--- the result is going to be a prepend
-UPDATE t USING TIMESTAMP 1607100000000000 SET l = l + [-3] WHERE pk = 0;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-3]"
- }
- ]
-}
--- append with the same timestamp has an undefined behavior:
--- the list key, which is a TIMEUUID, is generated by the coordinator,
--- so depends on the coordinator spoof node address. If the coordinator
--- happens to be the same, then it generated an identical timestamp, and
--- then the the value is reset or skipped, depending on whether it's
--- larger or not lexicographically. But if the coordinator is different,
--- the value will be appended.
--- UPDATE t USING TIMESTAMP 1607100000000000 SET l = l + [-5] WHERE pk = 0;
--- SELECT l FROM t WHERE pk = 0;
-UPDATE t USING TIMESTAMP 1607100000000001 SET l = l + [-2] WHERE pk = 0;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-3, -2]"
- }
- ]
-}
--- if a timestamp grows, the new value is after the previous one in the list
-UPDATE t USING TIMESTAMP 1607100000000002 SET l = l + [-1] WHERE pk = 0;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-3, -2, -1]"
- }
- ]
-}
--- And if it goes back, it's prepended
-UPDATE t USING TIMESTAMP 1607099999999999 SET l = l + [-4] WHERE pk = 0;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-4, -3, -2, -1]"
- }
- ]
-}
--- The batch has both list append and prepend.
--- The relative order of appends and prepends in the batch
--- is correct, but since batch timestamp is lower
--- than anything that is already in the list cell
--- all appends and prepends of the batch end up
--- preceding all previous values of the list.
-BEGIN BATCH USING TIMESTAMP 1607099999999998
- UPDATE t SET l = [-5] + l WHERE pk = 0
- UPDATE t SET l = [-7, -6] + l WHERE pk = 0
- UPDATE t SET l = [-8] + l WHERE pk = 0
- UPDATE t SET l = l + [0] WHERE pk = 0
- UPDATE t SET l = l + [1, 2] WHERE pk = 0
- UPDATE t SET l = l + [3] WHERE pk = 0
-APPLY BATCH;
-{
- "status" : "ok"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-8, -7, -6, -5, 0, 1, 2, 3, -4, -3, -2, -1]"
- }
- ]
-}
--- try a very low timestamp
-BEGIN BATCH USING TIMESTAMP 1000
- UPDATE t SET l = [-8] + l WHERE pk = 0
- UPDATE t SET l = [-10, -9] + l WHERE pk = 0
- UPDATE t SET l = [-11] + l WHERE pk = 0
- UPDATE t SET l = l + [4] WHERE pk = 0
- UPDATE t SET l = l + [5, 6] WHERE pk = 0
- UPDATE t SET l = l + [7] WHERE pk = 0
-APPLY BATCH;
-{
- "message" : "exceptions::invalid_request_exception (List prepend custom timestamp must be greater than Jan 1 2010 00:00:00)",
- "status" : "error"
-}
-SELECT l FROM t WHERE pk = 0;
-{
- "rows" :
- [
- {
- "l" : "[-8, -7, -6, -5, 0, 1, 2, 3, -4, -3, -2, -1]"
- }
- ]
-}
-
-DROP TABLE t;
-{
- "status" : "ok"
-}
+> CREATE TABLE t (pk INT PRIMARY KEY, l LIST<INT>);
+OK
+> UPDATE t SET l = [-1] + l WHERE pk = 0;
+OK
+> SELECT l FROM t WHERE pk = 0;
++------+
+| l |
+|------|
+| [-1] |
++------+
+> UPDATE t SET l = [-3,-2] + l WHERE pk = 0;
+OK
+> SELECT l FROM t WHERE pk = 0;
++--------------+
+| l |
+|--------------|
+| [-3, -2, -1] |
++--------------+
+> UPDATE t SET l = [-4] + l WHERE pk = 0 IF EXISTS;
++-------------+------+--------------+
+| [applied] | pk | l |
+|-------------+------+--------------|
+| True | 0 | [-3, -2, -1] |
++-------------+------+--------------+
+> SELECT l FROM t WHERE pk = 0;
++------------------+
+| l |
+|------------------|
+| [-4, -3, -2, -1] |
++------------------+
+> UPDATE t SET l = [-6, -5] + l WHERE pk = 0 IF EXISTS;
++-------------+------+------------------+
+| [applied] | pk | l |
+|-------------+------+------------------|
+| True | 0 | [-4, -3, -2, -1] |
++-------------+------+------------------+
+> SELECT l FROM t WHERE pk = 0;
++--------------------------+
+| l |
+|--------------------------|
+| [-6, -5, -4, -3, -2, -1] |
++--------------------------+
+> UPDATE t SET l = l + [1] WHERE pk = 0;
+OK
+> SELECT l FROM t WHERE pk = 0;
++-----------------------------+
+| l |
+|-----------------------------|
+| [-6, -5, -4, -3, -2, -1, 1] |
++-----------------------------+
+> UPDATE t SET l = l + [2,3] WHERE pk = 0;
+OK
+> SELECT l FROM t WHERE pk = 0;
++-----------------------------------+
+| l |
+|-----------------------------------|
+| [-6, -5, -4, -3, -2, -1, 1, 2, 3] |
++-----------------------------------+
+> UPDATE t SET l = l + [4] WHERE pk = 0 IF EXISTS;
++-------------+------+-----------------------------------+
+| [applied] | pk | l |
+|-------------+------+-----------------------------------|
+| True | 0 | [-6, -5, -4, -3, -2, -1, 1, 2, 3] |
++-------------+------+-----------------------------------+
+> SELECT l FROM t WHERE pk = 0;
++--------------------------------------+
+| l |
+|--------------------------------------|
+| [-6, -5, -4, -3, -2, -1, 1, 2, 3, 4] |
++--------------------------------------+
+> UPDATE t SET l = l + [5,6] WHERE pk = 0 IF EXISTS;
++-------------+------+--------------------------------------+
+| [applied] | pk | l |
+|-------------+------+--------------------------------------|
+| True | 0 | [-6, -5, -4, -3, -2, -1, 1, 2, 3, 4] |
++-------------+------+--------------------------------------+
+> SELECT l FROM t WHERE pk = 0;
++--------------------------------------------+
+| l |
+|--------------------------------------------|
+| [-6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6] |
++--------------------------------------------+
+> BEGIN BATCH
+> UPDATE t SET l = l + [7] WHERE pk = 0
+> UPDATE t SET l = [-7] + l WHERE pk = 0
+> UPDATE t SET l = l + [8, 9] WHERE pk = 0
+> UPDATE t SET l = l + [10] WHERE pk = 0
+> UPDATE t SET l = [-9, -8] + l WHERE pk = 0
+> UPDATE t SET l = [-10] + l WHERE pk = 0
+> APPLY BATCH;
+OK
+> SELECT l FROM t WHERE pk = 0;
++--------------------------------------------------------------------------+
+| l |
+|--------------------------------------------------------------------------|
+| [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
++--------------------------------------------------------------------------+
+> -- LWT batch
+> BEGIN BATCH
+> UPDATE t SET l = [-11] + l WHERE pk = 0 IF EXISTS
+> UPDATE t SET l = [-13, -12] + l WHERE pk = 0 IF EXISTS
+> UPDATE t SET l = [-14] + l WHERE pk = 0 IF EXISTS
+> UPDATE t SET l = l + [11] WHERE pk = 0 IF EXISTS
+> UPDATE t SET l = l + [12, 13] WHERE pk = 0 IF EXISTS
+> UPDATE t SET l = l + [14] WHERE pk = 0 IF EXISTS
+> APPLY BATCH;
++-------------+------+--------------------------------------------------------------------------+
+| [applied] | pk | l |
+|-------------+------+--------------------------------------------------------------------------|
+| True | 0 | [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
+| True | 0 | [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
+| True | 0 | [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
+| True | 0 | [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
+| True | 0 | [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
+| True | 0 | [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
++-------------+------+--------------------------------------------------------------------------+
+> SELECT l FROM t WHERE pk = 0;
++--------------------------------------------------------------------------------------------------------------+
+| l |
+|--------------------------------------------------------------------------------------------------------------|
+| [-14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] |
++--------------------------------------------------------------------------------------------------------------+
+>
+> DROP TABLE t;
+OK
+> -- test custom timestamps
+> -- Scylla, unlike Cassandra, takes custom timestamps into account
+> -- in list append/prepend operations
+> CREATE TABLE t (pk INT PRIMARY KEY, l LIST<INT>);
+OK
+>
+> -- Even though it's an append, since the timestamp is in the past,
+> -- the result is going to be a prepend
+> UPDATE t USING TIMESTAMP 1607100000000000 SET l = l + [-3] WHERE pk = 0;
+OK
+> SELECT l FROM t WHERE pk = 0;
++------+
+| l |
+|------|
+| [-3] |
++------+
+> -- append with the same timestamp has an undefined behavior:
+> -- the list key, which is a TIMEUUID, is generated by the coordinator,
+> -- so depends on the coordinator spoof node address. If the coordinator
+> -- happens to be the same, then it generated an identical timestamp, and
+> -- then the the value is reset or skipped, depending on whether it's
+> -- larger or not lexicographically. But if the coordinator is different,
+> -- the value will be appended.
+> -- UPDATE t USING TIMESTAMP 1607100000000000 SET l = l + [-5] WHERE pk = 0;
+> -- SELECT l FROM t WHERE pk = 0;
+> UPDATE t USING TIMESTAMP 1607100000000001 SET l = l + [-2] WHERE pk = 0;
+OK
+> SELECT l FROM t WHERE pk = 0;
++----------+
+| l |
+|----------|
+| [-3, -2] |
++----------+
+> -- if a timestamp grows, the new value is after the previous one in the list
+> UPDATE t USING TIMESTAMP 1607100000000002 SET l = l + [-1] WHERE pk = 0;
+OK
+> SELECT l FROM t WHERE pk = 0;
++--------------+
+| l |
+|--------------|
+| [-3, -2, -1] |
++--------------+
+> -- And if it goes back, it's prepended
+> UPDATE t USING TIMESTAMP 1607099999999999 SET l = l + [-4] WHERE pk = 0;
+OK
+> SELECT l FROM t WHERE pk = 0;
++------------------+
+| l |
+|------------------|
+| [-4, -3, -2, -1] |
++------------------+
+> -- The batch has both list append and prepend.
+> -- The relative order of appends and prepends in the batch
+> -- is correct, but since batch timestamp is lower
+> -- than anything that is already in the list cell
+> -- all appends and prepends of the batch end up
+> -- preceding all previous values of the list.
+> BEGIN BATCH USING TIMESTAMP 1607099999999998
+> UPDATE t SET l = [-5] + l WHERE pk = 0
+> UPDATE t SET l = [-7, -6] + l WHERE pk = 0
+> UPDATE t SET l = [-8] + l WHERE pk = 0
+> UPDATE t SET l = l + [0] WHERE pk = 0
+> UPDATE t SET l = l + [1, 2] WHERE pk = 0
+> UPDATE t SET l = l + [3] WHERE pk = 0
+> APPLY BATCH;
+OK
+> SELECT l FROM t WHERE pk = 0;
++----------------------------------------------+
+| l |
+|----------------------------------------------|
+| [-8, -7, -6, -5, 0, 1, 2, 3, -4, -3, -2, -1] |
++----------------------------------------------+
+> -- try a very low timestamp
+> BEGIN BATCH USING TIMESTAMP 1000
+> UPDATE t SET l = [-8] + l WHERE pk = 0
+> UPDATE t SET l = [-10, -9] + l WHERE pk = 0
+> UPDATE t SET l = [-11] + l WHERE pk = 0
+> UPDATE t SET l = l + [4] WHERE pk = 0
+> UPDATE t SET l = l + [5, 6] WHERE pk = 0
+> UPDATE t SET l = l + [7] WHERE pk = 0
+> APPLY BATCH;
+Error from server: code=2200 [Invalid query] message="List prepend custom timestamp must be greater than Jan 1 2010 00:00:00"
+> SELECT l FROM t WHERE pk = 0;
++----------------------------------------------+
+| l |
+|----------------------------------------------|
+| [-8, -7, -6, -5, 0, 1, 2, 3, -4, -3, -2, -1] |
++----------------------------------------------+
+>
+> DROP TABLE t;
+OK
diff --git a/test/cql/locator_test.result b/test/cql/locator_test.result
--- a/test/cql/locator_test.result
+++ b/test/cql/locator_test.result
@@ -1,101 +1,50 @@
---
---
https://github.com/scylladb/scylla/issues/7595
--- Fail on wrong DC name
---
-CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'nosuchdc' : 3 } AND DURABLE_WRITES = true;
-{
- "message" : "exceptions::configuration_exception (Unrecognized strategy option {nosuchdc} passed to org.apache.cassandra.locator.NetworkTopologyStrategy for keyspace t)",
- "status" : "error"
-}
-CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 3 } AND DURABLE_WRITES = true;
-{
- "status" : "ok"
-}
-DROP KEYSPACE t;
-{
- "status" : "ok"
-}
---
---
https://github.com/scylladb/scylla/issues/5962
--- wrong de-facto replication factor
--- when RF=0 and SimpleStrategy
---
-CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 0 } AND DURABLE_WRITES = true;
-{
- "status" : "ok"
-}
-CREATE TABLE t.t (a INT PRIMARY KEY, b int);
-{
- "status" : "ok"
-}
-INSERT INTO t.t (a, b) VALUES (1, 1);
-{
- "message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
- "status" : "error"
-}
-INSERT INTO t.t (a, b) VALUES (2, 2);
-{
- "message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
- "status" : "error"
-}
-SELECT * FROM t.t ALLOW FILTERING;
-{
- "message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
- "status" : "error"
-}
--- This statement used to trigger a crash
-SELECT a FROM t.t WHERE a IN (1, 2);
-{
- "message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
- "status" : "error"
-}
-DELETE FROM t.t WHERE a = 1;
-{
- "message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
- "status" : "error"
-}
-DELETE FROM t.t WHERE a = 2;
-{
- "message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
- "status" : "error"
-}
-CREATE INDEX b ON t.t (b);
-{
- "status" : "ok"
-}
-SELECT * FROM t.t WHERE b=2;
-{
- "message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
- "status" : "error"
-}
-INSERT INTO t.t (a) VALUES (1) IF NOT EXISTS;
-{
- "message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl SERIAL. Requires 1, alive 0)",
- "status" : "error"
-}
-DELETE FROM t.t WHERE a=1 IF EXISTS;
-{
- "message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl SERIAL. Requires 1, alive 0)",
- "status" : "error"
-}
-CREATE MATERIALIZED VIEW
t.mv AS SELECT a, b FROM t.t WHERE b > 1 PRIMARY KEY (b, a);
-{
- "status" : "ok"
-}
-SELECT * FROM
t.mv WHERE b IN (2, 1);
-{
- "message" : "exceptions::unavailable_exception (Cannot achieve consistency level for cl ONE. Requires 1, alive 0)",
- "status" : "error"
-}
-DROP MATERIALIZED VIEW
t.mv;
-{
- "status" : "ok"
-}
-DROP TABLE t.t;
-{
- "status" : "ok"
-}
-DROP KEYSPACE t;
-{
- "status" : "ok"
-}
+> --
+> --
https://github.com/scylladb/scylla/issues/7595
+> -- Fail on wrong DC name
+> --
+> CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'nosuchdc' : 3 } AND DURABLE_WRITES = true;
+<Error from server: code=2300 [Query invalid because of configuration issue] message="Unrecognized strategy option {nosuchdc} passed to org.apache.cassandra.locator.NetworkTopologyStrategy for keyspace t">
+> CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 3 } AND DURABLE_WRITES = true;
+OK
+> DROP KEYSPACE t;
+OK
+> --
+> --
https://github.com/scylladb/scylla/issues/5962
+> -- wrong de-facto replication factor
+> -- when RF=0 and SimpleStrategy
+> --
+> CREATE KEYSPACE t WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 0 } AND DURABLE_WRITES = true;
+OK
+> CREATE TABLE t.t (a INT PRIMARY KEY, b int);
+OK
+> INSERT INTO t.t (a, b) VALUES (1, 1);
+('Unable to complete the operation against any hosts', {<Host:
127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level for cl ONE. Requires 1, alive 0" info={\'consistency\': \'ONE\', \'required_replicas\': 1, \'alive_replicas\': 0}')})
+> INSERT INTO t.t (a, b) VALUES (2, 2);
+('Unable to complete the operation against any hosts', {<Host:
127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level for cl ONE. Requires 1, alive 0" info={\'consistency\': \'ONE\', \'required_replicas\': 1, \'alive_replicas\': 0}')})
+> SELECT * FROM t.t ALLOW FILTERING;
+('Unable to complete the operation against any hosts', {<Host:
127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level for cl ONE. Requires 1, alive 0" info={\'consistency\': \'ONE\', \'required_replicas\': 1, \'alive_replicas\': 0}')})
+> -- This statement used to trigger a crash
+> SELECT a FROM t.t WHERE a IN (1, 2);
+('Unable to complete the operation against any hosts', {<Host:
127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level for cl ONE. Requires 1, alive 0" info={\'consistency\': \'ONE\', \'required_replicas\': 1, \'alive_replicas\': 0}')})
+> DELETE FROM t.t WHERE a = 1;
+('Unable to complete the operation against any hosts', {<Host:
127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level for cl ONE. Requires 1, alive 0" info={\'consistency\': \'ONE\', \'required_replicas\': 1, \'alive_replicas\': 0}')})
+> DELETE FROM t.t WHERE a = 2;
+('Unable to complete the operation against any hosts', {<Host:
127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level for cl ONE. Requires 1, alive 0" info={\'consistency\': \'ONE\', \'required_replicas\': 1, \'alive_replicas\': 0}')})
+> CREATE INDEX b ON t.t (b);
+OK
+> SELECT * FROM t.t WHERE b=2;
+('Unable to complete the operation against any hosts', {<Host:
127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level for cl ONE. Requires 1, alive 0" info={\'consistency\': \'ONE\', \'required_replicas\': 1, \'alive_replicas\': 0}')})
+> INSERT INTO t.t (a) VALUES (1) IF NOT EXISTS;
+('Unable to complete the operation against any hosts', {<Host:
127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level for cl SERIAL. Requires 1, alive 0" info={\'consistency\': \'SERIAL\', \'required_replicas\': 1, \'alive_replicas\': 0}')})
+> DELETE FROM t.t WHERE a=1 IF EXISTS;
+('Unable to complete the operation against any hosts', {<Host:
127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level for cl SERIAL. Requires 1, alive 0" info={\'consistency\': \'SERIAL\', \'required_replicas\': 1, \'alive_replicas\': 0}')})
+> CREATE MATERIALIZED VIEW
t.mv AS SELECT a, b FROM t.t WHERE b > 1 PRIMARY KEY (b, a);
+OK
+> SELECT * FROM
t.mv WHERE b IN (2, 1);
+('Unable to complete the operation against any hosts', {<Host:
127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level for cl ONE. Requires 1, alive 0" info={\'consistency\': \'ONE\', \'required_replicas\': 1, \'alive_replicas\': 0}')})
+> DROP MATERIALIZED VIEW
t.mv;
+OK
+> DROP TABLE t.t;
+OK
+> DROP KEYSPACE t;
+OK
diff --git a/test/cql/lua_test.cql b/test/cql/lua_test.cql
--- a/test/cql/lua_test.cql
+++ b/test/cql/lua_test.cql
@@ -1,13 +1,16 @@
+-- Error messages contain a keyspace name. Make the output stable.
+CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
-- setup
-create table my_table (key int primary key);
-insert into my_table (key) values (1);
+create table ks.my_table (key int primary key);
+insert into ks.my_table (key) values (1);
-- test list<varint>
-create function my_func(val int) called on null input returns list<varint> language lua as 'return {1,2,3}';
-select my_func(key) from my_table;
-drop function my_func;
+create function ks.my_func(val int) called on null input returns list<varint> language lua as 'return {1,2,3}';
+select ks.my_func(key) from ks.my_table;
+drop function ks.my_func;
-- test list<decimal>
-create function my_func(val int) called on null input returns list<decimal> language lua as 'return {1,2,3}';
-select my_func(key) from my_table;
-drop function my_func;
+create function ks.my_func(val int) called on null input returns list<decimal> language lua as 'return {1,2,3}';
+select ks.my_func(key) from ks.my_table;
+drop function ks.my_func;
+DROP KEYSPACE ks;
diff --git a/test/cql/lua_test.result b/test/cql/lua_test.result
--- a/test/cql/lua_test.result
+++ b/test/cql/lua_test.result
@@ -1,47 +1,34 @@
--- setup
-create table my_table (key int primary key);
-{
- "status" : "ok"
-}
-insert into my_table (key) values (1);
-{
- "status" : "ok"
-}
-
--- test list<varint>
-create function my_func(val int) called on null input returns list<varint> language lua as 'return {1,2,3}';
-{
- "status" : "ok"
-}
-select my_func(key) from my_table;
-{
- "rows" :
- [
- {
- "ks.my_func(key)" : "[1, 2, 3]"
- }
- ]
-}
-drop function my_func;
-{
- "status" : "ok"
-}
-
--- test list<decimal>
-create function my_func(val int) called on null input returns list<decimal> language lua as 'return {1,2,3}';
-{
- "status" : "ok"
-}
-select my_func(key) from my_table;
-{
- "rows" :
- [
- {
- "ks.my_func(key)" : "[1, 2, 3]"
- }
- ]
-}
-drop function my_func;
-{
- "status" : "ok"
-}
+> -- Error messages contain a keyspace name. Make the output stable.
+> CREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> -- setup
+> create table ks.my_table (key int primary key);
+OK
+> insert into ks.my_table (key) values (1);
+OK
+>
+> -- test list<varint>
+> create function ks.my_func(val int) called on null input returns list<varint> language lua as 'return {1,2,3}';
+OK
+> select ks.my_func(key) from ks.my_table;
++-------------------+
+| ks.my_func(key) |
+|-------------------|
+| [1, 2, 3] |
++-------------------+
+> drop function ks.my_func;
+OK
+>
+> -- test list<decimal>
+> create function ks.my_func(val int) called on null input returns list<decimal> language lua as 'return {1,2,3}';
+OK
+> select ks.my_func(key) from ks.my_table;
++--------------------------------------------+
+| ks.my_func(key) |
+|--------------------------------------------|
+| [Decimal('1'), Decimal('2'), Decimal('3')] |
++--------------------------------------------+
+> drop function ks.my_func;
+OK
+> DROP KEYSPACE ks;
+OK
diff --git a/test/cql/lwt_batch_test.result b/test/cql/lwt_batch_test.result
--- a/test/cql/lwt_batch_test.result
+++ b/test/cql/lwt_batch_test.result
@@ -1,944 +1,529 @@
-create table lwt (a int, b int, primary key (a,b));
-{
- "status" : "ok"
-}
--- basic batch: ok
-begin batch
- insert into lwt (a, b) values (1, 1) if not exists
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- }
- ]
-}
--- begin unlogged batch + lwt: ok; unlogged is ignored
--- (same in c*)
-begin unlogged batch
- insert into lwt (a, b) values (1, 1) if not exists
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "false",
- "a" : "1",
- "b" : "1"
- }
- ]
-}
--- begin counter batch + lwt: error
-begin counter batch
- insert into lwt (a, b) values (1, 1) if not exists
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (Cannot include non-counter statement in a counter batch)",
- "status" : "error"
-}
--- a batch affecting two partitions: error
-begin batch
- insert into lwt (a, b) values (1, 1) if not exists
- insert into lwt (a, b) values (2, 1) if not exists
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (BATCH with conditions cannot span multiple partitions)",
- "status" : "error"
-}
--- a batch with an LWT statement and other statement affecting another
--- partition: error
-begin batch
- insert into lwt (a, b) values (1, 1) if not exists
- insert into lwt (a, b) values (2, 1)
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (BATCH with conditions cannot span multiple partitions)",
- "status" : "error"
-}
--- a batch affecting different clustering keys of the same partition: ok
-begin batch
- insert into lwt (a, b) values (1, 1) if not exists
- insert into lwt (a, b) values (1, 2) if not exists
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "false",
- "a" : "1",
- "b" : "1"
- },
- {
- "[applied]" : "false"
- }
- ]
-}
--- a batch and non-batch statement, on the same partition: ok
-begin batch
- insert into lwt (a, b) values (1, 1) if not exists
- insert into lwt (a, b) values (1, 2)
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "false",
- "a" : "1",
- "b" : "1"
- },
- {
- "[applied]" : "false"
- }
- ]
-}
--- a batch affecting two tables: error
-create table two (a int primary key, b int);
-{
- "status" : "ok"
-}
-begin batch
- insert into lwt (a, b) values (1, 1) if not exists
- insert into two (a, b) values (1, 1)
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (BATCH with conditions cannot span multiple tables)",
- "status" : "error"
-}
-drop table two;
-{
- "status" : "ok"
-}
--- a batch with custom timestamp set: error
-begin batch using timestamp 1
- insert into lwt (a, b) values (1, 1) if not exists
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (Cannot provide custom timestamp for conditional BATCH)",
- "status" : "error"
-}
--- a batch with a statement with a custom timestamp: error
-begin batch
- insert into lwt (a, b) values (1, 1) if not exists using timestamp 1
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (Cannot provide custom timestamp for conditional updates)",
- "status" : "error"
-}
--- a batch with an LWT statement and another statement with a custom timestamp set: ok
-begin batch
- insert into lwt (a, b) values (1, 1) if not exists
- insert into lwt (a, b) values (1, 1) using timestamp 1
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "false",
- "a" : "1",
- "b" : "1"
- },
- {
- "[applied]" : "false",
- "a" : "1",
- "b" : "1"
- }
- ]
-}
--- a batch with if condition and counters: error
--- if a table has a counter, all its non-primary key columns
--- must be counters
-create table lcounter (a int primary key, c counter);
-{
- "status" : "ok"
-}
-begin batch
- update lcounter set c = c + 1 where a = 1 if c = null
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (Conditional updates are not supported on counter tables)",
- "status" : "error"
-}
-drop table lcounter;
-{
- "status" : "ok"
-}
-drop table lwt;
-{
- "status" : "ok"
-}
-create table lwt (a int, b int, c int, primary key (a,b));
-{
- "status" : "ok"
-}
--- a batch with IF condition on primary key: error
-begin batch
- update lwt set c = 2 where a = 1 and b = 1 if a > 0
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (PRIMARY KEY column 'a' cannot have IF conditions)",
- "status" : "error"
-}
-begin batch
- update lwt set c = 2 where a = 1 and b = 1 if b > 0
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (PRIMARY KEY column 'b' cannot have IF conditions)",
- "status" : "error"
-}
-begin batch
- update lwt set c = 2 where a = 1 if c = null
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (Missing mandatory PRIMARY KEY part b)",
- "status" : "error"
-}
--- a batch with a statement that has IN prediacte and IF condition: error
-begin batch
- update lwt set c = 2 where a = 1 and b in (1, 2) if c = null
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (IN on the clustering key columns is not supported with conditional updates)",
- "status" : "error"
-}
--- a batch with a statement that has IN prediacte and *another* statement
--- with IF condition: OK. This is an error in C* but I see no reason
--- why it should be an error in Scylla.
-delete from lwt where a = 1;
-{
- "status" : "ok"
-}
-begin batch
- update lwt set c = 2 where a = 1 and b = 1 if c = null
- update lwt set c = 2 where a = 1 and b in (1, 2)
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- },
- {
- "[applied]" : "true"
- }
- ]
-}
-select a, b, c from lwt where a = 1 and b in (1, 2);
-{
- "rows" :
- [
- {
- "a" : "1",
- "b" : "1",
- "c" : "2"
- },
- {
- "a" : "1",
- "b" : "2",
- "c" : "2"
- }
- ]
-}
-drop table lwt;
-{
- "status" : "ok"
-}
---
--- BATCH LWT with multiple statements on LIST data type,
--- append/discard operations on the type: all append/discard
--- operations from all stsatemetns of the batch are applied
---
-create table lwt (a int, b int, c list<text>, d list<text> static, primary key (a, b));
-{
- "status" : "ok"
-}
-begin batch
- insert into lwt (a, b, c, d ) values (1, 1, ['1'], ['1']) if not exists
- insert into lwt (a, b, c, d ) values (1, 2, ['2'], ['2']) if not exists
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- },
- {
- "[applied]" : "true"
- }
- ]
-}
-select b, c, d from lwt where a = 1;
-{
- "rows" :
- [
- {
- "b" : "1",
- "c" : "[\"1\"]",
- "d" : "[\"1\", \"2\"]"
- },
- {
- "b" : "2",
- "c" : "[\"2\"]",
- "d" : "[\"1\", \"2\"]"
- }
- ]
-}
-begin batch
- update lwt set c = c + ['3'], d = d + ['3'] where a = 1 and b = 1 if exists
- update lwt set c = c + ['4'], d = d + ['4'] where a = 1 and b = 2
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "a" : "1",
- "b" : "1",
- "c" : "[\"1\"]",
- "d" : "[\"1\", \"2\"]"
- },
- {
- "[applied]" : "true"
- }
- ]
-}
-select b, c, d from lwt where a = 1;
-{
- "rows" :
- [
- {
- "b" : "1",
- "c" : "[\"1\", \"3\"]",
- "d" : "[\"1\", \"2\", \"3\", \"4\"]"
- },
- {
- "b" : "2",
- "c" : "[\"2\", \"4\"]",
- "d" : "[\"1\", \"2\", \"3\", \"4\"]"
- }
- ]
-}
-begin batch
- update lwt set c = c + ['5'], d = d + ['5'] where a = 1 and b = 1 if c[0] = '1' and c[1] = '3'
- update lwt set c = c + ['6'], d = d + ['6'] where a = 1 and b = 2
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "a" : "1",
- "b" : "1",
- "c" : "[\"1\", \"3\"]"
- },
- {
- "[applied]" : "true"
- }
- ]
-}
-select b, c, d from lwt where a = 1;
-{
- "rows" :
- [
- {
- "b" : "1",
- "c" : "[\"1\", \"3\", \"5\"]",
- "d" : "[\"1\", \"2\", \"3\", \"4\", \"5\", \"6\"]"
- },
- {
- "b" : "2",
- "c" : "[\"2\", \"4\", \"6\"]",
- "d" : "[\"1\", \"2\", \"3\", \"4\", \"5\", \"6\"]"
- }
- ]
-}
--- multiple conditions:
--- two simple conditions, effects of all statements are applied atomically
--- or not applied at all: ok
-begin batch
- update lwt set c = c + ['7'], d = d + ['7'] where a = 1 and b = 1 if c[0] = '1' and c[1] = '2'
- update lwt set c = c + ['8'], d = d + ['8'] where a = 1 and b = 2 if c[3] = '3' and c[4] = '4'
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "false",
- "a" : "1",
- "b" : "1",
- "c" : "[\"1\", \"3\", \"5\"]"
- },
- {
- "[applied]" : "false",
- "a" : "1",
- "b" : "2",
- "c" : "[\"2\", \"4\", \"6\"]"
- }
- ]
-}
-select b, c, d from lwt where a = 1;
-{
- "rows" :
- [
- {
- "b" : "1",
- "c" : "[\"1\", \"3\", \"5\"]",
- "d" : "[\"1\", \"2\", \"3\", \"4\", \"5\", \"6\"]"
- },
- {
- "b" : "2",
- "c" : "[\"2\", \"4\", \"6\"]",
- "d" : "[\"1\", \"2\", \"3\", \"4\", \"5\", \"6\"]"
- }
- ]
-}
-begin batch
- update lwt set c = c + ['7'], d = d + ['7'] where a = 1 and b = 1 if c[0] = '1' and c[1] = '3'
- update lwt set c = c + ['8'], d = d + ['8'] where a = 1 and b = 2 if c[1] = '4' and c[2] = '6'
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "a" : "1",
- "b" : "1",
- "c" : "[\"1\", \"3\", \"5\"]"
- },
- {
- "[applied]" : "true",
- "a" : "1",
- "b" : "2",
- "c" : "[\"2\", \"4\", \"6\"]"
- }
- ]
-}
-select b, c, d from lwt where a = 1;
-{
- "rows" :
- [
- {
- "b" : "1",
- "c" : "[\"1\", \"3\", \"5\", \"7\"]",
- "d" : "[\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\"]"
- },
- {
- "b" : "2",
- "c" : "[\"2\", \"4\", \"6\", \"8\"]",
- "d" : "[\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\"]"
- }
- ]
-}
-drop table lwt;
-{
- "status" : "ok"
-}
-
--- batch + lwt + range UPDATE of multiple rows, clustering key is not fully restricted: ok
--- batch + lwt + range DELETE of multiple rows, clustering key is not fully restricted: ok
--- usually within the same partition key
-create table lwt (a int, b int, c int, d int, primary key (a, b, c));
-{
- "status" : "ok"
-}
-insert into lwt (a, b, c, d) values (1,1,1,1);
-{
- "status" : "ok"
-}
-insert into lwt (a, b, c, d) values (1,1,2,0);
-{
- "status" : "ok"
-}
-insert into lwt (a, b, c, d) values (1,1,3,1);
-{
- "status" : "ok"
-}
-insert into lwt (a, b, c, d) values (1,2,1,1);
-{
- "status" : "ok"
-}
-insert into lwt (a, b, c, d) values (1,2,2,0);
-{
- "status" : "ok"
-}
-insert into lwt (a, b, c, d) values (1,2,3,1);
-{
- "status" : "ok"
-}
--- update
-begin batch
- update lwt set d = 7 where a = 1 and b = 1 and c = 1 if exists
- update lwt set d = 7 where a = 1 and b in (1,2) and c in (1,2,3)
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "a" : "1",
- "b" : "1",
- "c" : "1",
- "d" : "1"
- },
- {
- "[applied]" : "true",
- "a" : "1",
- "b" : "1",
- "c" : "1",
- "d" : "1"
- }
- ]
-}
-select a, b, c, d from lwt where a = 1;
-{
- "rows" :
- [
- {
- "a" : "1",
- "b" : "1",
- "c" : "1",
- "d" : "7"
- },
- {
- "a" : "1",
- "b" : "1",
- "c" : "2",
- "d" : "7"
- },
- {
- "a" : "1",
- "b" : "1",
- "c" : "3",
- "d" : "7"
- },
- {
- "a" : "1",
- "b" : "2",
- "c" : "1",
- "d" : "7"
- },
- {
- "a" : "1",
- "b" : "2",
- "c" : "2",
- "d" : "7"
- },
- {
- "a" : "1",
- "b" : "2",
- "c" : "3",
- "d" : "7"
- }
- ]
-}
--- delete
-begin batch
- delete from lwt where a = 1 and b = 1 if exists
- delete from lwt where a = 1 and b = 2 if exists
-apply batch;
-{
- "message" : "exceptions::invalid_request_exception (DELETE statements must restrict all PRIMARY KEY columns with equality relations in order to delete non static columns)",
- "status" : "error"
-}
--- select a, b, c, d from lwt where a = 1;
-drop table lwt;
-{
- "status" : "ok"
-}
-
--- Rows fetched for statements that require read but has no conditions
--- must not be included into the result set.
-create table lwt(p int, c int, i int, l list<int>, primary key(p, c));
-{
- "status" : "ok"
-}
-insert into lwt(p, c, i, l) values(1, 1, 1, [1, 2]);
-{
- "status" : "ok"
-}
-insert into lwt(p, c, i, l) values(1, 2, 2, [1, 2, 3, 4]);
-{
- "status" : "ok"
-}
--- doesn't apply
-begin batch
-update lwt set i = 3 where p = 1 and c = 1 if i = 2
-update lwt set l = l - [1] where p = 1 and c = 2
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "false",
- "c" : "1",
- "i" : "1",
- "p" : "1"
- },
- {
- "[applied]" : "false",
- "c" : "2",
- "i" : "2",
- "p" : "1"
- }
- ]
-}
--- applies
-begin batch
-update lwt set i = 2 where p = 1 and c = 1 if i = 1
-update lwt set l = l - [2] where p = 1 and c = 2
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "c" : "1",
- "i" : "1",
- "p" : "1"
- },
- {
- "[applied]" : "true",
- "c" : "2",
- "i" : "2",
- "p" : "1"
- }
- ]
-}
--- doesn't apply
-begin batch
-delete l from lwt where p = 1 and c = 3 if exists
-update lwt set l = l - [3] where p = 1 and c = 2
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "false"
- },
- {
- "[applied]" : "false",
- "c" : "2",
- "i" : "2",
- "l" : "[1, 3, 4]",
- "p" : "1"
- }
- ]
-}
--- applies
-begin batch
-delete l from lwt where p = 1 and c = 1 if exists
-update lwt set l = l - [4] where p = 1 and c = 2
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "c" : "1",
- "i" : "2",
- "l" : "[1, 2]",
- "p" : "1"
- },
- {
- "[applied]" : "true",
- "c" : "2",
- "i" : "2",
- "l" : "[1, 3, 4]",
- "p" : "1"
- }
- ]
-}
-select * from lwt;
-{
- "rows" :
- [
- {
- "c" : "1",
- "i" : "2",
- "p" : "1"
- },
- {
- "c" : "2",
- "i" : "2",
- "l" : "[1, 3]",
- "p" : "1"
- }
- ]
-}
-drop table lwt;
-{
- "status" : "ok"
-}
-
--- Suppose there's a batch with two statements, one of which has clustering
--- column restrictions that select no row, another has static conditions.
--- In this case we must fetch the static row (provided it exists, of course)
--- to check the static column conditions.
-create table lwt (p int, c int, s int static, primary key (p, c));
-{
- "status" : "ok"
-}
-insert into lwt(p, s) values(1, 1);
-{
- "status" : "ok"
-}
-begin batch
-insert into lwt(p, c) values(1, 1) if not exists
-update lwt set s = 2 where p = 1 if s = 1
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- },
- {
- "[applied]" : "true",
- "p" : "1",
- "s" : "1"
- }
- ]
-}
-select * from lwt;
-{
- "rows" :
- [
- {
- "c" : "1",
- "p" : "1",
- "s" : "2"
- }
- ]
-}
-drop table lwt;
-{
- "status" : "ok"
-}
---
---
--- condtitions on different list columns and different rows of the same
--- partition, these columns are retreived fine and the appropriate row
--- is found when checking the conds
---
--- correct read command: statement 1 condition is on column a and list update
--- is on column b, while statement b condition is on column c and list
--- update is on column d
--- a composite read command is built and both rows are retreieved,
--- conditions are executed correctly and mutations are applied accordingly
---
---
--- Issue: #6273
--- Delete have priority above Insert.
-create table lwt (key bigint, ck int, cv set<text>, PRIMARY KEY((key), ck));
-{
- "status" : "ok"
-}
-insert into lwt (key, ck, cv) values (1, 0, {'a', 'b'}) if not exists;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- }
- ]
-}
-begin batch
- delete from lwt where key=1 and ck=0 if exists
- insert into lwt (key, ck, cv) values (1, 0, {'b', 'c'})
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "ck" : "0",
- "cv" : "[\"a\", \"b\"]",
- "key" : "1"
- },
- {
- "[applied]" : "true",
- "ck" : "0",
- "cv" : "[\"a\", \"b\"]",
- "key" : "1"
- }
- ]
-}
-select * from lwt;
-{
- "rows" : null
-}
-drop table lwt;
-{
- "status" : "ok"
-}
---
--- Workaround for Issue #6273.
--- Delete individual cells instead of entire partition.
---
-create table lwt (key bigint, ck int, cv set<text>, PRIMARY KEY((key), ck));
-{
- "status" : "ok"
-}
-insert into lwt (key, ck, cv) values (1, 0, {'a', 'b'}) if not exists;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- }
- ]
-}
-begin batch
- update lwt set cv=null where key=1 and ck=0 if exists
- insert into lwt (key, ck, cv) values (1, 0, {'b', 'c'})
-apply batch;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "ck" : "0",
- "cv" : "[\"a\", \"b\"]",
- "key" : "1"
- },
- {
- "[applied]" : "true",
- "ck" : "0",
- "cv" : "[\"a\", \"b\"]",
- "key" : "1"
- }
- ]
-}
-select * from lwt;
-{
- "rows" :
- [
- {
- "ck" : "0",
- "cv" : "[\"b\", \"c\"]",
- "key" : "1"
- }
- ]
-}
-drop table lwt;
-{
- "status" : "ok"
-}
-
---
--- A test case for Issue #7113
--- Return one row per each LWT statement
--- in a batch, in statement order.
---
-CREATE TABLE IF NOT EXISTS gh7113 (
- part int,
- key int,
- lwt_trivial int,
- int1 int,
- int2 int,
- PRIMARY KEY (part, key)
-);
-{
- "status" : "ok"
-}
-
-BEGIN BATCH
- UPDATE gh7113 SET int1 = 6 WHERE part = 0 AND key = 4 IF lwt_trivial = null
-APPLY BATCH;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- }
- ]
-}
-
-BEGIN BATCH
- UPDATE gh7113 SET int2 = 0, int1 = 0 WHERE part = 0 AND key = 0 IF lwt_trivial = null
- UPDATE gh7113 SET int2 = 1, int1 = 6 WHERE part = 0 AND key = 7 IF lwt_trivial = null
-APPLY BATCH;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- },
- {
- "[applied]" : "true"
- }
- ]
-}
-
-BEGIN BATCH
- UPDATE gh7113 SET int2 = 0, int1 = 2 WHERE part = 0 AND key = 9 IF lwt_trivial = null
- UPDATE gh7113 SET int1 = 7 WHERE part = 0 AND key = 0 IF lwt_trivial = null
-APPLY BATCH;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- },
- {
- "[applied]" : "true",
- "key" : "0",
- "part" : "0"
- }
- ]
-}
-
-
-BEGIN BATCH
-UPDATE gh7113 SET int1 = 6, int2 = 7 WHERE part = 0 AND key = 1 IF lwt_trivial = null
-UPDATE gh7113 SET int2 = 4 WHERE part = 0 AND key = 0 IF lwt_trivial = null
-UPDATE gh7113 SET int2 = 2 WHERE part = 0 AND key = 3 IF lwt_trivial = null
-APPLY BATCH;
-{
- "rows" :
- [
- {
- "[applied]" : "true"
- },
- {
- "[applied]" : "true",
- "key" : "0",
- "part" : "0"
- },
- {
- "[applied]" : "true"
- }
- ]
-}
-
-BEGIN BATCH
- UPDATE gh7113 SET int2 = 1 WHERE part = 0 AND key = 4 IF lwt_trivial = null
- UPDATE gh7113 SET int2 = 1 WHERE part = 0 AND key = 0 IF lwt_trivial = null
- UPDATE gh7113 SET int1 = 4, int2 = 8 WHERE part = 0 AND key = 9 IF lwt_trivial = null
- UPDATE gh7113 SET int1 = 0, int2 = 9 WHERE part = 0 AND key = 0 IF lwt_trivial = null
-APPLY BATCH;
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "key" : "4",
- "part" : "0"
- },
- {
- "[applied]" : "true",
- "key" : "0",
- "part" : "0"
- },
- {
- "[applied]" : "true",
- "key" : "9",
- "part" : "0"
- },
- {
- "[applied]" : "true",
- "key" : "0",
- "part" : "0"
- }
- ]
-}
+> create table lwt (a int, b int, primary key (a,b));
+OK
+> -- basic batch: ok
+> begin batch
+> insert into lwt (a, b) values (1, 1) if not exists
+> apply batch;
++-------------+------+------+
+| [applied] | a | b |
+|-------------+------+------|
+| True | null | null |
++-------------+------+------+
+> -- begin unlogged batch + lwt: ok; unlogged is ignored
+> -- (same in c*)
+> begin unlogged batch
+> insert into lwt (a, b) values (1, 1) if not exists
+> apply batch;
++-------------+-----+-----+
+| [applied] | a | b |
+|-------------+-----+-----|
+| False | 1 | 1 |
++-------------+-----+-----+
+> -- begin counter batch + lwt: error
+> begin counter batch
+> insert into lwt (a, b) values (1, 1) if not exists
+> apply batch;
+Error from server: code=2200 [Invalid query] message="Cannot include non-counter statement in a counter batch"
+> -- a batch affecting two partitions: error
+> begin batch
+> insert into lwt (a, b) values (1, 1) if not exists
+> insert into lwt (a, b) values (2, 1) if not exists
+> apply batch;
+Error from server: code=2200 [Invalid query] message="BATCH with conditions cannot span multiple partitions"
+> -- a batch with an LWT statement and other statement affecting another
+> -- partition: error
+> begin batch
+> insert into lwt (a, b) values (1, 1) if not exists
+> insert into lwt (a, b) values (2, 1)
+> apply batch;
+Error from server: code=2200 [Invalid query] message="BATCH with conditions cannot span multiple partitions"
+> -- a batch affecting different clustering keys of the same partition: ok
+> begin batch
+> insert into lwt (a, b) values (1, 1) if not exists
+> insert into lwt (a, b) values (1, 2) if not exists
+> apply batch;
++-------------+------+------+
+| [applied] | a | b |
+|-------------+------+------|
+| False | 1 | 1 |
+| False | null | null |
++-------------+------+------+
+> -- a batch and non-batch statement, on the same partition: ok
+> begin batch
+> insert into lwt (a, b) values (1, 1) if not exists
+> insert into lwt (a, b) values (1, 2)
+> apply batch;
++-------------+------+------+
+| [applied] | a | b |
+|-------------+------+------|
+| False | 1 | 1 |
+| False | null | null |
++-------------+------+------+
+> -- a batch affecting two tables: error
+> create table two (a int primary key, b int);
+OK
+> begin batch
+> insert into lwt (a, b) values (1, 1) if not exists
+> insert into two (a, b) values (1, 1)
+> apply batch;
+Error from server: code=2200 [Invalid query] message="BATCH with conditions cannot span multiple tables"
+> drop table two;
+OK
+> -- a batch with custom timestamp set: error
+> begin batch using timestamp 1
+> insert into lwt (a, b) values (1, 1) if not exists
+> apply batch;
+Error from server: code=2200 [Invalid query] message="Cannot provide custom timestamp for conditional BATCH"
+> -- a batch with a statement with a custom timestamp: error
+> begin batch
+> insert into lwt (a, b) values (1, 1) if not exists using timestamp 1
+> apply batch;
+Error from server: code=2200 [Invalid query] message="Cannot provide custom timestamp for conditional updates"
+> -- a batch with an LWT statement and another statement with a custom timestamp set: ok
+> begin batch
+> insert into lwt (a, b) values (1, 1) if not exists
+> insert into lwt (a, b) values (1, 1) using timestamp 1
+> apply batch;
++-------------+-----+-----+
+| [applied] | a | b |
+|-------------+-----+-----|
+| False | 1 | 1 |
+| False | 1 | 1 |
++-------------+-----+-----+
+> -- a batch with if condition and counters: error
+> -- if a table has a counter, all its non-primary key columns
+> -- must be counters
+> create table lcounter (a int primary key, c counter);
+OK
+> begin batch
+> update lcounter set c = c + 1 where a = 1 if c = null
+> apply batch;
+Error from server: code=2200 [Invalid query] message="Conditional updates are not supported on counter tables"
+> drop table lcounter;
+OK
+> drop table lwt;
+OK
+> create table lwt (a int, b int, c int, primary key (a,b));
+OK
+> -- a batch with IF condition on primary key: error
+> begin batch
+> update lwt set c = 2 where a = 1 and b = 1 if a > 0
+> apply batch;
+Error from server: code=2200 [Invalid query] message="PRIMARY KEY column 'a' cannot have IF conditions"
+> begin batch
+> update lwt set c = 2 where a = 1 and b = 1 if b > 0
+> apply batch;
+Error from server: code=2200 [Invalid query] message="PRIMARY KEY column 'b' cannot have IF conditions"
+> begin batch
+> update lwt set c = 2 where a = 1 if c = null
+> apply batch;
+Error from server: code=2200 [Invalid query] message="Missing mandatory PRIMARY KEY part b"
+> -- a batch with a statement that has IN prediacte and IF condition: error
+> begin batch
+> update lwt set c = 2 where a = 1 and b in (1, 2) if c = null
+> apply batch;
+Error from server: code=2200 [Invalid query] message="IN on the clustering key columns is not supported with conditional updates"
+> -- a batch with a statement that has IN prediacte and *another* statement
+> -- with IF condition: OK. This is an error in C* but I see no reason
+> -- why it should be an error in Scylla.
+> delete from lwt where a = 1;
+OK
+> begin batch
+> update lwt set c = 2 where a = 1 and b = 1 if c = null
+> update lwt set c = 2 where a = 1 and b in (1, 2)
+> apply batch;
++-------------+------+------+------+
+| [applied] | a | b | c |
+|-------------+------+------+------|
+| True | null | null | null |
+| True | null | null | null |
++-------------+------+------+------+
+> select a, b, c from lwt where a = 1 and b in (1, 2);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 1 | 1 | 2 |
+| 1 | 2 | 2 |
++-----+-----+-----+
+> drop table lwt;
+OK
+> --
+> -- BATCH LWT with multiple statements on LIST data type,
+> -- append/discard operations on the type: all append/discard
+> -- operations from all stsatemetns of the batch are applied
+> --
+> create table lwt (a int, b int, c list<text>, d list<text> static, primary key (a, b));
+OK
+> begin batch
+> insert into lwt (a, b, c, d ) values (1, 1, ['1'], ['1']) if not exists
+> insert into lwt (a, b, c, d ) values (1, 2, ['2'], ['2']) if not exists
+> apply batch;
++-------------+------+------+------+------+
+| [applied] | a | b | d | c |
+|-------------+------+------+------+------|
+| True | null | null | null | null |
+| True | null | null | null | null |
++-------------+------+------+------+------+
+> select b, c, d from lwt where a = 1;
++-----+-------+------------+
+| b | c | d |
+|-----+-------+------------|
+| 1 | ['1'] | ['1', '2'] |
+| 2 | ['2'] | ['1', '2'] |
++-----+-------+------------+
+> begin batch
+> update lwt set c = c + ['3'], d = d + ['3'] where a = 1 and b = 1 if exists
+> update lwt set c = c + ['4'], d = d + ['4'] where a = 1 and b = 2
+> apply batch;
++-------------+------+------+------------+-------+
+| [applied] | a | b | d | c |
+|-------------+------+------+------------+-------|
+| True | 1 | 1 | ['1', '2'] | ['1'] |
+| True | null | null | null | null |
++-------------+------+------+------------+-------+
+> select b, c, d from lwt where a = 1;
++-----+------------+----------------------+
+| b | c | d |
+|-----+------------+----------------------|
+| 1 | ['1', '3'] | ['1', '2', '3', '4'] |
+| 2 | ['2', '4'] | ['1', '2', '3', '4'] |
++-----+------------+----------------------+
+> begin batch
+> update lwt set c = c + ['5'], d = d + ['5'] where a = 1 and b = 1 if c[0] = '1' and c[1] = '3'
+> update lwt set c = c + ['6'], d = d + ['6'] where a = 1 and b = 2
+> apply batch;
++-------------+------+------+------------+
+| [applied] | a | b | c |
+|-------------+------+------+------------|
+| True | 1 | 1 | ['1', '3'] |
+| True | null | null | null |
++-------------+------+------+------------+
+> select b, c, d from lwt where a = 1;
++-----+-----------------+--------------------------------+
+| b | c | d |
+|-----+-----------------+--------------------------------|
+| 1 | ['1', '3', '5'] | ['1', '2', '3', '4', '5', '6'] |
+| 2 | ['2', '4', '6'] | ['1', '2', '3', '4', '5', '6'] |
++-----+-----------------+--------------------------------+
+> -- multiple conditions:
+> -- two simple conditions, effects of all statements are applied atomically
+> -- or not applied at all: ok
+> begin batch
+> update lwt set c = c + ['7'], d = d + ['7'] where a = 1 and b = 1 if c[0] = '1' and c[1] = '2'
+> update lwt set c = c + ['8'], d = d + ['8'] where a = 1 and b = 2 if c[3] = '3' and c[4] = '4'
+> apply batch;
++-------------+-----+-----+-----------------+
+| [applied] | a | b | c |
+|-------------+-----+-----+-----------------|
+| False | 1 | 1 | ['1', '3', '5'] |
+| False | 1 | 2 | ['2', '4', '6'] |
++-------------+-----+-----+-----------------+
+> select b, c, d from lwt where a = 1;
++-----+-----------------+--------------------------------+
+| b | c | d |
+|-----+-----------------+--------------------------------|
+| 1 | ['1', '3', '5'] | ['1', '2', '3', '4', '5', '6'] |
+| 2 | ['2', '4', '6'] | ['1', '2', '3', '4', '5', '6'] |
++-----+-----------------+--------------------------------+
+> begin batch
+> update lwt set c = c + ['7'], d = d + ['7'] where a = 1 and b = 1 if c[0] = '1' and c[1] = '3'
+> update lwt set c = c + ['8'], d = d + ['8'] where a = 1 and b = 2 if c[1] = '4' and c[2] = '6'
+> apply batch;
++-------------+-----+-----+-----------------+
+| [applied] | a | b | c |
+|-------------+-----+-----+-----------------|
+| True | 1 | 1 | ['1', '3', '5'] |
+| True | 1 | 2 | ['2', '4', '6'] |
++-------------+-----+-----+-----------------+
+> select b, c, d from lwt where a = 1;
++-----+----------------------+------------------------------------------+
+| b | c | d |
+|-----+----------------------+------------------------------------------|
+| 1 | ['1', '3', '5', '7'] | ['1', '2', '3', '4', '5', '6', '7', '8'] |
+| 2 | ['2', '4', '6', '8'] | ['1', '2', '3', '4', '5', '6', '7', '8'] |
++-----+----------------------+------------------------------------------+
+> drop table lwt;
+OK
+>
+> -- batch + lwt + range UPDATE of multiple rows, clustering key is not fully restricted: ok
+> -- batch + lwt + range DELETE of multiple rows, clustering key is not fully restricted: ok
+> -- usually within the same partition key
+> create table lwt (a int, b int, c int, d int, primary key (a, b, c));
+OK
+> insert into lwt (a, b, c, d) values (1,1,1,1);
+OK
+> insert into lwt (a, b, c, d) values (1,1,2,0);
+OK
+> insert into lwt (a, b, c, d) values (1,1,3,1);
+OK
+> insert into lwt (a, b, c, d) values (1,2,1,1);
+OK
+> insert into lwt (a, b, c, d) values (1,2,2,0);
+OK
+> insert into lwt (a, b, c, d) values (1,2,3,1);
+OK
+> -- update
+> begin batch
+> update lwt set d = 7 where a = 1 and b = 1 and c = 1 if exists
+> update lwt set d = 7 where a = 1 and b in (1,2) and c in (1,2,3)
+> apply batch;
++-------------+-----+-----+-----+-----+
+| [applied] | a | b | c | d |
+|-------------+-----+-----+-----+-----|
+| True | 1 | 1 | 1 | 1 |
+| True | 1 | 1 | 1 | 1 |
++-------------+-----+-----+-----+-----+
+> select a, b, c, d from lwt where a = 1;
++-----+-----+-----+-----+
+| a | b | c | d |
+|-----+-----+-----+-----|
+| 1 | 1 | 1 | 7 |
+| 1 | 1 | 2 | 7 |
+| 1 | 1 | 3 | 7 |
+| 1 | 2 | 1 | 7 |
+| 1 | 2 | 2 | 7 |
+| 1 | 2 | 3 | 7 |
++-----+-----+-----+-----+
+> -- delete
+> begin batch
+> delete from lwt where a = 1 and b = 1 if exists
+> delete from lwt where a = 1 and b = 2 if exists
+> apply batch;
+Error from server: code=2200 [Invalid query] message="DELETE statements must restrict all PRIMARY KEY columns with equality relations in order to delete non static columns"
+> -- select a, b, c, d from lwt where a = 1;
+> drop table lwt;
+OK
+>
+> -- Rows fetched for statements that require read but has no conditions
+> -- must not be included into the result set.
+> create table lwt(p int, c int, i int, l list<int>, primary key(p, c));
+OK
+> insert into lwt(p, c, i, l) values(1, 1, 1, [1, 2]);
+OK
+> insert into lwt(p, c, i, l) values(1, 2, 2, [1, 2, 3, 4]);
+OK
+> -- doesn't apply
+> begin batch
+> update lwt set i = 3 where p = 1 and c = 1 if i = 2
+> update lwt set l = l - [1] where p = 1 and c = 2
+> apply batch;
++-------------+-----+-----+-----+
+| [applied] | p | c | i |
+|-------------+-----+-----+-----|
+| False | 1 | 1 | 1 |
+| False | 1 | 2 | 2 |
++-------------+-----+-----+-----+
+> -- applies
+> begin batch
+> update lwt set i = 2 where p = 1 and c = 1 if i = 1
+> update lwt set l = l - [2] where p = 1 and c = 2
+> apply batch;
++-------------+-----+-----+-----+
+| [applied] | p | c | i |
+|-------------+-----+-----+-----|
+| True | 1 | 1 | 1 |
+| True | 1 | 2 | 2 |
++-------------+-----+-----+-----+
+> -- doesn't apply
+> begin batch
+> delete l from lwt where p = 1 and c = 3 if exists
+> update lwt set l = l - [3] where p = 1 and c = 2
+> apply batch;
++-------------+------+------+------+-----------+
+| [applied] | p | c | i | l |
+|-------------+------+------+------+-----------|
+| False | null | null | null | null |
+| False | 1 | 2 | 2 | [1, 3, 4] |
++-------------+------+------+------+-----------+
+> -- applies
+> begin batch
+> delete l from lwt where p = 1 and c = 1 if exists
+> update lwt set l = l - [4] where p = 1 and c = 2
+> apply batch;
++-------------+-----+-----+-----+-----------+
+| [applied] | p | c | i | l |
+|-------------+-----+-----+-----+-----------|
+| True | 1 | 1 | 2 | [1, 2] |
+| True | 1 | 2 | 2 | [1, 3, 4] |
++-------------+-----+-----+-----+-----------+
+> select * from lwt;
++-----+-----+-----+--------+
+| p | c | i | l |
+|-----+-----+-----+--------|
+| 1 | 1 | 2 | null |
+| 1 | 2 | 2 | [1, 3] |
++-----+-----+-----+--------+
+> drop table lwt;
+OK
+>
+> -- Suppose there's a batch with two statements, one of which has clustering
+> -- column restrictions that select no row, another has static conditions.
+> -- In this case we must fetch the static row (provided it exists, of course)
+> -- to check the static column conditions.
+> create table lwt (p int, c int, s int static, primary key (p, c));
+OK
+> insert into lwt(p, s) values(1, 1);
+OK
+> begin batch
+> insert into lwt(p, c) values(1, 1) if not exists
+> update lwt set s = 2 where p = 1 if s = 1
+> apply batch;
++-------------+------+------+------+
+| [applied] | p | c | s |
+|-------------+------+------+------|
+| True | null | null | null |
+| True | 1 | null | 1 |
++-------------+------+------+------+
+> select * from lwt;
++-----+-----+-----+
+| p | c | s |
+|-----+-----+-----|
+| 1 | 1 | 2 |
++-----+-----+-----+
+> drop table lwt;
+OK
+> --
+> --
+> -- condtitions on different list columns and different rows of the same
+> -- partition, these columns are retreived fine and the appropriate row
+> -- is found when checking the conds
+> --
+> -- correct read command: statement 1 condition is on column a and list update
+> -- is on column b, while statement b condition is on column c and list
+> -- update is on column d
+> -- a composite read command is built and both rows are retreieved,
+> -- conditions are executed correctly and mutations are applied accordingly
+> --
+> --
+> -- Issue: #6273
+> -- Delete have priority above Insert.
+> create table lwt (key bigint, ck int, cv set<text>, PRIMARY KEY((key), ck));
+OK
+> insert into lwt (key, ck, cv) values (1, 0, {'a', 'b'}) if not exists;
++-------------+-------+------+------+
+| [applied] | key | ck | cv |
+|-------------+-------+------+------|
+| True | null | null | null |
++-------------+-------+------+------+
+> begin batch
+> delete from lwt where key=1 and ck=0 if exists
+> insert into lwt (key, ck, cv) values (1, 0, {'b', 'c'})
+> apply batch;
++-------------+-------+------+------------+
+| [applied] | key | ck | cv |
+|-------------+-------+------+------------|
+| True | 1 | 0 | ['a', 'b'] |
+| True | 1 | 0 | ['a', 'b'] |
++-------------+-------+------+------------+
+> select * from lwt;
++-------+------+------+
+| key | ck | cv |
+|-------+------+------|
++-------+------+------+
+> drop table lwt;
+OK
+> --
+> -- Workaround for Issue #6273.
+> -- Delete individual cells instead of entire partition.
+> --
+> create table lwt (key bigint, ck int, cv set<text>, PRIMARY KEY((key), ck));
+OK
+> insert into lwt (key, ck, cv) values (1, 0, {'a', 'b'}) if not exists;
++-------------+-------+------+------+
+| [applied] | key | ck | cv |
+|-------------+-------+------+------|
+| True | null | null | null |
++-------------+-------+------+------+
+> begin batch
+> update lwt set cv=null where key=1 and ck=0 if exists
+> insert into lwt (key, ck, cv) values (1, 0, {'b', 'c'})
+> apply batch;
++-------------+-------+------+------------+
+| [applied] | key | ck | cv |
+|-------------+-------+------+------------|
+| True | 1 | 0 | ['a', 'b'] |
+| True | 1 | 0 | ['a', 'b'] |
++-------------+-------+------+------------+
+> select * from lwt;
++-------+------+------------+
+| key | ck | cv |
+|-------+------+------------|
+| 1 | 0 | ['b', 'c'] |
++-------+------+------------+
+> drop table lwt;
+OK
+>
+> --
+> -- A test case for Issue #7113
+> -- Return one row per each LWT statement
+> -- in a batch, in statement order.
+> --
+> CREATE TABLE IF NOT EXISTS gh7113 (
+> part int,
+> key int,
+> lwt_trivial int,
+> int1 int,
+> int2 int,
+> PRIMARY KEY (part, key)
+> );
+OK
+>
+> BEGIN BATCH
+> UPDATE gh7113 SET int1 = 6 WHERE part = 0 AND key = 4 IF lwt_trivial = null
+> APPLY BATCH;
++-------------+--------+-------+---------------+
+| [applied] | part | key | lwt_trivial |
+|-------------+--------+-------+---------------|
+| True | null | null | null |
++-------------+--------+-------+---------------+
+>
+> BEGIN BATCH
+> UPDATE gh7113 SET int2 = 0, int1 = 0 WHERE part = 0 AND key = 0 IF lwt_trivial = null
+> UPDATE gh7113 SET int2 = 1, int1 = 6 WHERE part = 0 AND key = 7 IF lwt_trivial = null
+> APPLY BATCH;
++-------------+--------+-------+---------------+
+| [applied] | part | key | lwt_trivial |
+|-------------+--------+-------+---------------|
+| True | null | null | null |
+| True | null | null | null |
++-------------+--------+-------+---------------+
+>
+> BEGIN BATCH
+> UPDATE gh7113 SET int2 = 0, int1 = 2 WHERE part = 0 AND key = 9 IF lwt_trivial = null
+> UPDATE gh7113 SET int1 = 7 WHERE part = 0 AND key = 0 IF lwt_trivial = null
+> APPLY BATCH;
++-------------+--------+-------+---------------+
+| [applied] | part | key | lwt_trivial |
+|-------------+--------+-------+---------------|
+| True | null | null | null |
+| True | 0 | 0 | null |
++-------------+--------+-------+---------------+
+>
+>
+> BEGIN BATCH
+> UPDATE gh7113 SET int1 = 6, int2 = 7 WHERE part = 0 AND key = 1 IF lwt_trivial = null
+> UPDATE gh7113 SET int2 = 4 WHERE part = 0 AND key = 0 IF lwt_trivial = null
+> UPDATE gh7113 SET int2 = 2 WHERE part = 0 AND key = 3 IF lwt_trivial = null
+> APPLY BATCH;
++-------------+--------+-------+---------------+
+| [applied] | part | key | lwt_trivial |
+|-------------+--------+-------+---------------|
+| True | null | null | null |
+| True | 0 | 0 | null |
+| True | null | null | null |
++-------------+--------+-------+---------------+
+>
+> BEGIN BATCH
+> UPDATE gh7113 SET int2 = 1 WHERE part = 0 AND key = 4 IF lwt_trivial = null
+> UPDATE gh7113 SET int2 = 1 WHERE part = 0 AND key = 0 IF lwt_trivial = null
+> UPDATE gh7113 SET int1 = 4, int2 = 8 WHERE part = 0 AND key = 9 IF lwt_trivial = null
+> UPDATE gh7113 SET int1 = 0, int2 = 9 WHERE part = 0 AND key = 0 IF lwt_trivial = null
+> APPLY BATCH;
++-------------+--------+-------+---------------+
+| [applied] | part | key | lwt_trivial |
+|-------------+--------+-------+---------------|
+| True | 0 | 4 | null |
+| True | 0 | 0 | null |
+| True | 0 | 9 | null |
+| True | 0 | 0 | null |
++-------------+--------+-------+---------------+
diff --git a/test/cql/lwt_batch_validation_test.result b/test/cql/lwt_batch_validation_test.result
--- a/test/cql/lwt_batch_validation_test.result
+++ b/test/cql/lwt_batch_validation_test.result
@@ -1,24 +1,13 @@
-CREATE KEYSPACE k WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
-{
- "status" : "ok"
-}
-USE k;
-{
- "status" : "ok"
-}
-CREATE TABLE t1 (userid int PRIMARY KEY);
-{
- "status" : "ok"
-}
-CREATE TABLE t2 (userid int PRIMARY KEY);
-{
- "status" : "ok"
-}
-BEGIN BATCH
-INSERT INTO t1 (userid) VALUES (1) IF NOT EXISTS
-INSERT INTO t2 (userid) VALUES (1) IF NOT EXISTS
-APPLY BATCH;
-{
- "message" : "exceptions::invalid_request_exception (BATCH with conditions cannot span multiple tables)",
- "status" : "error"
-}
+> CREATE KEYSPACE k WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
+OK
+> USE k;
+OK
+> CREATE TABLE t1 (userid int PRIMARY KEY);
+OK
+> CREATE TABLE t2 (userid int PRIMARY KEY);
+OK
+> BEGIN BATCH
+> INSERT INTO t1 (userid) VALUES (1) IF NOT EXISTS
+> INSERT INTO t2 (userid) VALUES (1) IF NOT EXISTS
+> APPLY BATCH;
+Error from server: code=2200 [Invalid query] message="BATCH with conditions cannot span multiple tables"
diff --git a/test/cql/lwt_like_test.result b/test/cql/lwt_like_test.result
--- a/test/cql/lwt_like_test.result
+++ b/test/cql/lwt_like_test.result
@@ -1,144 +1,80 @@
-create table t (pk int primary key, c text);
-{
- "status" : "ok"
-}
-insert into t (pk, c) values (1, 'abc');
-{
- "status" : "ok"
-}
-insert into t (pk, c) values (2, 'bcd');
-{
- "status" : "ok"
-}
-insert into t (pk, c) values (3, 'cde');
-{
- "status" : "ok"
-}
--- match
-update t set c = 'chg' where pk = 1 if c like 'a%';
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "c" : "\"abc\""
- }
- ]
-}
-update t set c = 'chg' where pk = 2 if c like 'b%';
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "c" : "\"bcd\""
- }
- ]
-}
-update t set c = 'chg' where pk = 3 if c like 'c%';
-{
- "rows" :
- [
- {
- "[applied]" : "true",
- "c" : "\"cde\""
- }
- ]
-}
--- null value
-insert into t (pk, c) values (3, null);
-{
- "status" : "ok"
-}
-update t set c = 'error' where pk = 3 if c like 'a%';
-{
- "rows" :
- [
- {
- "[applied]" : "false"
- }
- ]
-}
--- unset value
-insert into t json '{ "pk": 4 }' default unset;
-{
- "status" : "ok"
-}
-update t set c = 'err' where pk = 4 if c like 'a%';
-{
- "rows" :
- [
- {
- "[applied]" : "false"
- }
- ]
-}
--- empty pattern
-update t set c = 'err' where pk = 1 if c like '';
-{
- "rows" :
- [
- {
- "[applied]" : "false",
- "c" : "\"chg\""
- }
- ]
-}
--- invalid pattern type
-update t set c = 'err' where pk = 1 if c like 1;
-{
- "message" : "exceptions::invalid_request_exception (Invalid INTEGER constant (1) for \"c\" of type text)",
- "status" : "error"
-}
-update t set c = 'err' where pk = 1 if c like null;
-{
- "message" : "exceptions::invalid_request_exception (Invalid NULL value in LIKE pattern)",
- "status" : "error"
-}
-update t set c = 'err' where pk = 1 if c like bigintAsBlob(1);
-{
- "message" : "exceptions::invalid_request_exception (Type error: cannot assign result of function system.bigintasblob (type blob) to c (type text))",
- "status" : "error"
-}
--- int column
-create table ti (pk int primary key, c int);
-{
- "status" : "ok"
-}
-insert into ti (pk, c) values (1, 1);
-{
- "status" : "ok"
-}
-update ti set c = 2 where pk = 1 if c like 'a%';
-{
- "message" : "exceptions::invalid_request_exception (Invalid STRING constant (a%) for \"c\" of type int)",
- "status" : "error"
-}
--- map column
-create table tm (pk int primary key, m map<int, text>);
-{
- "status" : "ok"
-}
-insert into tm (pk, m) values (1, { 1: 'abc' });
-{
- "status" : "ok"
-}
-update tm set m = { 2: 'error' } where pk = 1 if m like 'a%';
-{
- "message" : "exceptions::invalid_request_exception (Invalid STRING constant (a%) for \"m\" of type map<int, text>)",
- "status" : "error"
-}
--- blob column
-create table tb (pk int primary key, b blob);
-{
- "status" : "ok"
-}
-insert into tb (pk, b) values (1, bigintAsBlob(1));
-{
- "status" : "ok"
-}
-update tb set b = bigintAsBlob(2) where pk = 1 if b like 'a%';
-{
- "message" : "exceptions::invalid_request_exception (Invalid STRING constant (a%) for \"b\" of type blob)",
- "status" : "error"
-}
+> create table t (pk int primary key, c text);
+OK
+> insert into t (pk, c) values (1, 'abc');
+OK
+> insert into t (pk, c) values (2, 'bcd');
+OK
+> insert into t (pk, c) values (3, 'cde');
+OK
+> -- match
+> update t set c = 'chg' where pk = 1 if c like 'a%';
++-------------+-----+
+| [applied] | c |
+|-------------+-----|
+| True | abc |
++-------------+-----+
+> update t set c = 'chg' where pk = 2 if c like 'b%';
++-------------+-----+
+| [applied] | c |
+|-------------+-----|
+| True | bcd |
++-------------+-----+
+> update t set c = 'chg' where pk = 3 if c like 'c%';
++-------------+-----+
+| [applied] | c |
+|-------------+-----|
+| True | cde |
++-------------+-----+
+> -- null value
+> insert into t (pk, c) values (3, null);
+OK
+> update t set c = 'error' where pk = 3 if c like 'a%';
++-------------+------+
+| [applied] | c |
+|-------------+------|
+| False | null |
++-------------+------+
+> -- unset value
+> insert into t json '{ "pk": 4 }' default unset;
+OK
+> update t set c = 'err' where pk = 4 if c like 'a%';
++-------------+------+
+| [applied] | c |
+|-------------+------|
+| False | null |
++-------------+------+
+> -- empty pattern
+> update t set c = 'err' where pk = 1 if c like '';
++-------------+-----+
+| [applied] | c |
+|-------------+-----|
+| False | chg |
++-------------+-----+
+> -- invalid pattern type
+> update t set c = 'err' where pk = 1 if c like 1;
+Error from server: code=2200 [Invalid query] message="Invalid INTEGER constant (1) for "c" of type text"
+> update t set c = 'err' where pk = 1 if c like null;
+Error from server: code=2200 [Invalid query] message="Invalid NULL value in LIKE pattern"
+> update t set c = 'err' where pk = 1 if c like bigintAsBlob(1);
+Error from server: code=2200 [Invalid query] message="Type error: cannot assign result of function system.bigintasblob (type blob) to c (type text)"
+> -- int column
+> create table ti (pk int primary key, c int);
+OK
+> insert into ti (pk, c) values (1, 1);
+OK
+> update ti set c = 2 where pk = 1 if c like 'a%';
+Error from server: code=2200 [Invalid query] message="Invalid STRING constant (a%) for "c" of type int"
+> -- map column
+> create table tm (pk int primary key, m map<int, text>);
+OK
+> insert into tm (pk, m) values (1, { 1: 'abc' });
+OK
+> update tm set m = { 2: 'error' } where pk = 1 if m like 'a%';
+Error from server: code=2200 [Invalid query] message="Invalid STRING constant (a%) for "m" of type map<int, text>"
+> -- blob column
+> create table tb (pk int primary key, b blob);
+OK
+> insert into tb (pk, b) values (1, bigintAsBlob(1));
+OK
+> update tb set b = bigintAsBlob(2) where pk = 1 if b like 'a%';
+Error from server: code=2200 [Invalid query] message="Invalid STRING constant (a%) for "b" of type blob"
diff --git a/test/cql/lwt_test.result b/test/cql/lwt_test.result
--- a/test/cql/lwt_test.result
+++ b/test/cql/lwt_test.result
null
diff --git a/test/cql/mv_si_local_updates_test.result b/test/cql/mv_si_local_updates_test.result
--- a/test/cql/mv_si_local_updates_test.result
+++ b/test/cql/mv_si_local_updates_test.result
@@ -1,69 +1,33 @@
--- Simple test case for local materialized views with synchronous local updates.
--- A view is local when its partition key definition is the same as base's,
--- which results in locating view partition on the same node as the base table.
-CREATE TABLE t (p1 int, p2 int, c int, v int, primary key ((p1,p2),c));
-{
- "status" : "ok"
-}
--- a local view - with identical partition key
-CREATE MATERIALIZED VIEW tv AS SELECT * FROM t WHERE p1 IS NOT NULL AND p2 IS NOT NULL AND c IS NOT NULL AND v IS NOT NULL PRIMARY KEY ((p1,p2),v,c);
-{
- "status" : "ok"
-}
-INSERT INTO t (p1, p2, c, v) VALUES (1,2,3,4);
-{
- "status" : "ok"
-}
-INSERT INTO t (p1, p2, c, v) VALUES (2,3,4,5);
-{
- "status" : "ok"
-}
-SELECT * FROM tv;
-{
- "rows" :
- [
- {
- "c" : "4",
- "p1" : "2",
- "p2" : "3",
- "v" : "5"
- },
- {
- "c" : "3",
- "p1" : "1",
- "p2" : "2",
- "v" : "4"
- }
- ]
-}
--- a local index - with underlying local view
-CREATE INDEX ON t(v);
-{
- "status" : "ok"
-}
-INSERT INTO t (p1, p2, c, v) VALUES (3,4,5,6);
-{
- "status" : "ok"
-}
-INSERT INTO t (p1, p2, c, v) VALUES (4,5,6,6);
-{
- "status" : "ok"
-}
-SELECT * FROM t WHERE v = 6;
-{
- "rows" :
- [
- {
- "c" : "5",
- "p1" : "3",
- "p2" : "4",
- "v" : "6"
- },
- {
- "c" : "6",
- "p1" : "4",
- "p2" : "5",
- "v" : "6"
- }
- ]
-}
+> -- Simple test case for local materialized views with synchronous local updates.
+> -- A view is local when its partition key definition is the same as base's,
+> -- which results in locating view partition on the same node as the base table.
+> CREATE TABLE t (p1 int, p2 int, c int, v int, primary key ((p1,p2),c));
+OK
+> -- a local view - with identical partition key
+> CREATE MATERIALIZED VIEW tv AS SELECT * FROM t WHERE p1 IS NOT NULL AND p2 IS NOT NULL AND c IS NOT NULL AND v IS NOT NULL PRIMARY KEY ((p1,p2),v,c);
+OK
+> INSERT INTO t (p1, p2, c, v) VALUES (1,2,3,4);
+OK
+> INSERT INTO t (p1, p2, c, v) VALUES (2,3,4,5);
+OK
+> SELECT * FROM tv;
++------+------+-----+-----+
+| p1 | p2 | v | c |
+|------+------+-----+-----|
+| 2 | 3 | 5 | 4 |
+| 1 | 2 | 4 | 3 |
++------+------+-----+-----+
+> -- a local index - with underlying local view
+> CREATE INDEX ON t(v);
+OK
+> INSERT INTO t (p1, p2, c, v) VALUES (3,4,5,6);
+OK
+> INSERT INTO t (p1, p2, c, v) VALUES (4,5,6,6);
+OK
+> SELECT * FROM t WHERE v = 6;
++------+------+-----+-----+
+| p1 | p2 | c | v |
+|------+------+-----+-----|
+| 3 | 4 | 5 | 6 |
+| 4 | 5 | 6 | 6 |
++------+------+-----+-----+
diff --git a/test/cql/query_bounds_test.result b/test/cql/query_bounds_test.result
--- a/test/cql/query_bounds_test.result
+++ b/test/cql/query_bounds_test.result
@@ -1,510 +1,271 @@
-create table foo (a int, b int, c int, PRIMARY KEY (a, b, c)) WITH CLUSTERING ORDER BY (b DESC, c ASC);
-{
- "status" : "ok"
-}
-
-INSERT INTO foo (a, b, c) VALUES (0, 2, 0);
-{
- "status" : "ok"
-}
-INSERT INTO foo (a, b, c) VALUES (0, 1, 0);
-{
- "status" : "ok"
-}
-INSERT INTO foo (a, b, c) VALUES (0, 1, 1);
-{
- "status" : "ok"
-}
-INSERT INTO foo (a, b, c) VALUES (0, 0, 0);
-{
- "status" : "ok"
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) > (1, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND (1, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- },
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) > (2, 0);
-{
- "rows" : null
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND (2, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "1",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- },
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) >= (2, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) >= SCYLLA_CLUSTERING_BOUND (2, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- },
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) < (1, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) < SCYLLA_CLUSTERING_BOUND (1, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) < (2, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "1",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- },
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) < SCYLLA_CLUSTERING_BOUND (2, 0);
-{
- "rows" : null
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) <= (2, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- },
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b, c) <= SCYLLA_CLUSTERING_BOUND (2, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- }
- ]
-}
-
-
-SELECT * FROM foo WHERE a=0 AND (b) > (1);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) > SCYLLA_CLUSTERING_BOUND (1);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) > (2);
-{
- "rows" : null
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) > SCYLLA_CLUSTERING_BOUND (2);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "1",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- },
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) >= (2);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) >= SCYLLA_CLUSTERING_BOUND (2);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- },
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) < (1);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) < SCYLLA_CLUSTERING_BOUND (1);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) < (2);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "1",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- },
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) < SCYLLA_CLUSTERING_BOUND (2);
-{
- "rows" : null
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) <= (2);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- },
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) <= SCYLLA_CLUSTERING_BOUND (2);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- }
- ]
-}
-
-
-
-
-SELECT * FROM foo WHERE a=0 AND (b) > (1) AND (b, c) <= (2, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "2",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) > SCYLLA_CLUSTERING_BOUND (1) AND (b, c) <= SCYLLA_CLUSTERING_BOUND (0, 0);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "0",
- "c" : "0"
- }
- ]
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) > (2) AND (b, c) <= (2, 1);
-{
- "rows" : null
-}
-
-SELECT * FROM foo WHERE a=0 AND (b) > SCYLLA_CLUSTERING_BOUND (2) AND (b, c) <= SCYLLA_CLUSTERING_BOUND(1, 1);
-{
- "rows" :
- [
- {
- "a" : "0",
- "b" : "1",
- "c" : "0"
- },
- {
- "a" : "0",
- "b" : "1",
- "c" : "1"
- }
- ]
-}
-
--- error checks --
-
--- wrong side of condition
-SELECT * FROM foo WHERE a=0 AND SCYLLA_CLUSTERING_BOUND(b) > (2);
-{
- "message" : "exceptions::syntax_exception (line 1:32 no viable alternative at input 'SCYLLA_CLUSTERING_BOUND')",
- "status" : "error"
-}
-
--- both sides of condition
-SELECT * FROM foo WHERE a=0 AND SCYLLA_CLUSTERING_BOUND(b) > SCYLLA_CLUSTERING_BOUND(2);
-{
- "message" : "exceptions::syntax_exception (line 1:32 no viable alternative at input 'SCYLLA_CLUSTERING_BOUND')",
- "status" : "error"
-}
-
--- too many values --
-SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND (1, 0, 5);
-{
- "message" : "exceptions::invalid_request_exception (Expected 2 elements in value tuple, but got 3: (1, 0, 5))",
- "status" : "error"
-}
-
--- too few values --
-SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND (1);
-{
- "message" : "exceptions::invalid_request_exception (Expected 2 elements in value tuple, but got 1: (1))",
- "status" : "error"
-}
-
--- missing values --
-SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND;
-{
- "message" : "exceptions::syntax_exception (line 1:64 : syntax error...\n)",
- "status" : "error"
-}
-
--- not tuple --
-SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND 45;
-{
- "message" : "exceptions::syntax_exception (line 1:65 missing '(' at '<missing ')",
- "status" : "error"
-}
-
--- just wrong --
-SELECT * FROM foo WHERE a=0 SCYLLA_CLUSTERING_BOUND AND (b, c) > (0, 1);
-{
- "message" : "exceptions::syntax_exception (line 1:28 : syntax error...\n)",
- "status" : "error"
-}
-SELECT * FROM foo WHERE a=0 AND (b, c) > (0, 1) SCYLLA_CLUSTERING_BOUND;
-{
- "message" : "exceptions::syntax_exception (line 1:48 : syntax error...\n)",
- "status" : "error"
-}
-
--- mixing apples and make_count_rows_function
-SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND(2, 0) AND (b, c) < (1, 1);
-{
- "message" : "exceptions::invalid_request_exception (Invalid combination of restrictions (SCYLLA_CLUSTERING_BOUND / plain))",
- "status" : "error"
-}
--- and again --
-SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND(2, 0) AND (b, c) < (2, 0);
-{
- "message" : "exceptions::invalid_request_exception (Invalid combination of restrictions (SCYLLA_CLUSTERING_BOUND / plain))",
- "status" : "error"
-}
+> create table foo (a int, b int, c int, PRIMARY KEY (a, b, c)) WITH CLUSTERING ORDER BY (b DESC, c ASC);
+OK
+>
+> INSERT INTO foo (a, b, c) VALUES (0, 2, 0);
+OK
+> INSERT INTO foo (a, b, c) VALUES (0, 1, 0);
+OK
+> INSERT INTO foo (a, b, c) VALUES (0, 1, 1);
+OK
+> INSERT INTO foo (a, b, c) VALUES (0, 0, 0);
+OK
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) > (1, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
+| 0 | 1 | 1 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND (1, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 1 | 1 |
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) > (2, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND (2, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 1 | 0 |
+| 0 | 1 | 1 |
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) >= (2, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) >= SCYLLA_CLUSTERING_BOUND (2, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
+| 0 | 1 | 0 |
+| 0 | 1 | 1 |
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) < (1, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) < SCYLLA_CLUSTERING_BOUND (1, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) < (2, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 1 | 0 |
+| 0 | 1 | 1 |
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) < SCYLLA_CLUSTERING_BOUND (2, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) <= (2, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
+| 0 | 1 | 0 |
+| 0 | 1 | 1 |
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b, c) <= SCYLLA_CLUSTERING_BOUND (2, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
++-----+-----+-----+
+>
+>
+> SELECT * FROM foo WHERE a=0 AND (b) > (1);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) > SCYLLA_CLUSTERING_BOUND (1);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) > (2);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) > SCYLLA_CLUSTERING_BOUND (2);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 1 | 0 |
+| 0 | 1 | 1 |
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) >= (2);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) >= SCYLLA_CLUSTERING_BOUND (2);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
+| 0 | 1 | 0 |
+| 0 | 1 | 1 |
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) < (1);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) < SCYLLA_CLUSTERING_BOUND (1);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) < (2);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 1 | 0 |
+| 0 | 1 | 1 |
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) < SCYLLA_CLUSTERING_BOUND (2);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) <= (2);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
+| 0 | 1 | 0 |
+| 0 | 1 | 1 |
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) <= SCYLLA_CLUSTERING_BOUND (2);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
++-----+-----+-----+
+>
+>
+>
+>
+> SELECT * FROM foo WHERE a=0 AND (b) > (1) AND (b, c) <= (2, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 2 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) > SCYLLA_CLUSTERING_BOUND (1) AND (b, c) <= SCYLLA_CLUSTERING_BOUND (0, 0);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 0 | 0 |
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) > (2) AND (b, c) <= (2, 1);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
++-----+-----+-----+
+>
+> SELECT * FROM foo WHERE a=0 AND (b) > SCYLLA_CLUSTERING_BOUND (2) AND (b, c) <= SCYLLA_CLUSTERING_BOUND(1, 1);
++-----+-----+-----+
+| a | b | c |
+|-----+-----+-----|
+| 0 | 1 | 0 |
+| 0 | 1 | 1 |
++-----+-----+-----+
+>
+> -- error checks --
+>
+> -- wrong side of condition
+> SELECT * FROM foo WHERE a=0 AND SCYLLA_CLUSTERING_BOUND(b) > (2);
+<Error from server: code=2000 [Syntax error in CQL query] message="line 1:32 no viable alternative at input 'SCYLLA_CLUSTERING_BOUND'">
+>
+> -- both sides of condition
+> SELECT * FROM foo WHERE a=0 AND SCYLLA_CLUSTERING_BOUND(b) > SCYLLA_CLUSTERING_BOUND(2);
+<Error from server: code=2000 [Syntax error in CQL query] message="line 1:32 no viable alternative at input 'SCYLLA_CLUSTERING_BOUND'">
+>
+> -- too many values --
+> SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND (1, 0, 5);
+Error from server: code=2200 [Invalid query] message="Expected 2 elements in value tuple, but got 3: (1, 0, 5)"
+>
+> -- too few values --
+> SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND (1);
+Error from server: code=2200 [Invalid query] message="Expected 2 elements in value tuple, but got 1: (1)"
+>
+> -- missing values --
+> SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND;
+<Error from server: code=2000 [Syntax error in CQL query] message="line 1:64 : syntax error...
+">
+>
+> -- not tuple --
+> SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND 45;
+<Error from server: code=2000 [Syntax error in CQL query] message="line 1:65 missing '(' at '<missing '">
+>
+> -- just wrong --
+> SELECT * FROM foo WHERE a=0 SCYLLA_CLUSTERING_BOUND AND (b, c) > (0, 1);
+<Error from server: code=2000 [Syntax error in CQL query] message="line 1:28 : syntax error...
+">
+> SELECT * FROM foo WHERE a=0 AND (b, c) > (0, 1) SCYLLA_CLUSTERING_BOUND;
+<Error from server: code=2000 [Syntax error in CQL query] message="line 1:48 : syntax error...
+">
+>
+> -- mixing apples and make_count_rows_function
+> SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND(2, 0) AND (b, c) < (1, 1);
+Error from server: code=2200 [Invalid query] message="Invalid combination of restrictions (SCYLLA_CLUSTERING_BOUND / plain)"
+> -- and again --
+> SELECT * FROM foo WHERE a=0 AND (b, c) > SCYLLA_CLUSTERING_BOUND(2, 0) AND (b, c) < (2, 0);
+Error from server: code=2200 [Invalid query] message="Invalid combination of restrictions (SCYLLA_CLUSTERING_BOUND / plain)"
diff --git a/test/cql/suite.yaml b/test/cql/suite.yaml
--- a/test/cql/suite.yaml
+++ b/test/cql/suite.yaml
@@ -1 +1 @@
-type: CQL
+type: Approval