diff --git a/test/cql-pytest/test_count.py b/test/cql-pytest/test_aggregate.py similarity index 83% rename from test/cql-pytest/test_count.py rename to test/cql-pytest/test_aggregate.py index b5db6b99d3..7de6e2227e 100644 --- a/test/cql-pytest/test_count.py +++ b/test/cql-pytest/test_aggregate.py @@ -1,13 +1,14 @@ -# Copyright 2023-present ScyllaDB +# Copyright 2021-present ScyllaDB # # SPDX-License-Identifier: AGPL-3.0-or-later ############################################################################# -# Tests for the COUNT() aggregation function +# Tests aggregation functions COUNT(), MIN(), MAX(), SUM() ############################################################################# import pytest -from util import new_test_table, unique_key_int +from util import new_test_table, unique_key_int, project +from cassandra.util import Date @pytest.fixture(scope="module") def table1(cql, test_keyspace): @@ -96,3 +97,14 @@ def test_count_and_group_by_row_none(cql, table1): def test_count_and_group_by_partition_none(cql, table1): p = unique_key_int() assert [] == list(cql.execute(f"select p, count(v) from {table1} where p = {p} group by p")) + +# Regression-test for #7729. +def test_timeuuid(cql, test_keyspace): + schema = "a int, b timeuuid, primary key (a,b)" + with new_test_table(cql, test_keyspace, schema) as table: + cql.execute(f'insert into {table} (a, b) values (0, 13814000-1dd2-11ff-8080-808080808080)') + cql.execute(f'insert into {table} (a, b) values (0, 6b1b3620-33fd-11eb-8080-808080808080)') + assert project('system_todate_system_min_b', + cql.execute(f'select todate(min(b)) from {table} where a = 0')) == [Date('2020-12-01')] + assert project('system_todate_system_max_b', + cql.execute(f'select todate(max(b)) from {table} where a = 0')) == [Date('2038-09-06')] diff --git a/test/cql-pytest/test_minmax.py b/test/cql-pytest/test_minmax.py deleted file mode 100644 index c8b8394808..0000000000 --- a/test/cql-pytest/test_minmax.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2021-present ScyllaDB -# -# SPDX-License-Identifier: AGPL-3.0-or-later - -############################################################################# -# Tests for min/max aggregate functions -############################################################################# - -import pytest -from cassandra.protocol import SyntaxException, AlreadyExists, InvalidRequest, ConfigurationException, ReadFailure -from cassandra.util import Date -from util import unique_name, new_test_table, project - -# Regression-test for #7729. -def test_timeuuid(cql, test_keyspace): - schema = "a int, b timeuuid, primary key (a,b)" - with new_test_table(cql, test_keyspace, schema) as table: - cql.execute(f'insert into {table} (a, b) values (0, 13814000-1dd2-11ff-8080-808080808080)') - cql.execute(f'insert into {table} (a, b) values (0, 6b1b3620-33fd-11eb-8080-808080808080)') - assert project('system_todate_system_min_b', - cql.execute(f'select todate(min(b)) from {table} where a = 0')) == [Date('2020-12-01')] - assert project('system_todate_system_max_b', - cql.execute(f'select todate(max(b)) from {table} where a = 0')) == [Date('2038-09-06')]