Files
scylladb/test/cql/counters_test.result
Michael Litvak 1dbf53ca29 test: enable counters tests with tablets
Enable all counters-related tests that were disabled for tablets because
counters was not supported with tablets until now.

Some tests were parametrized to run with both vnodes and tablets, and
the tablets case was skipped, in order to not lose coverage. We change
them to run with the default configuration since now counters is
supported with both vnodes and tablets, and the implementation is the
same, so there is no benefit in running them with both configurations.
2025-11-03 16:04:37 +01:00

134 lines
3.3 KiB
Plaintext

> -- Error messages contain a keyspace name. Make the output stable.
> CREATE KEYSPACE ks
> WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1};
OK
> USE ks;
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 |
+------+------+
>
> -- Test case for gh-7330, counter signed integer overflow in debug mode
> 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 |
+-----+---------------------+
>
> -- cleanup
> DROP KEYSPACE ks;
OK