Skip to content

Commit d8aca46

Browse files
committed
Fix custom partition_by implementation and tests
- Add proper deterministic partition_by expression: intDiv(id, 1000000) - Update test to verify custom vs default partition expressions - Ensure both CONFIG_FILE and CONFIG_FILE_MARIADB tests pass - Fix CI failures caused by non-deterministic partition expressions
1 parent abb9f96 commit d8aca46

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

test_mysql_ch_replicator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,11 @@ def test_e2e_regular(config_file):
137137
# Check for custom partition_by configuration when using CONFIG_FILE (tests_config.yaml)
138138
if config_file == CONFIG_FILE:
139139
create_query = ch.show_create_table(TEST_TABLE_NAME)
140-
assert 'PARTITION BY toYYYYMM(toDate(id))' in create_query, f"Custom partition_by not found in CREATE TABLE query: {create_query}"
140+
assert 'PARTITION BY intDiv(id, 1000000)' in create_query, f"Custom partition_by not found in CREATE TABLE query: {create_query}"
141+
else:
142+
# Verify that the table was created successfully with default partitioning
143+
create_query = ch.show_create_table(TEST_TABLE_NAME)
144+
assert 'PARTITION BY intDiv(id, 4294967)' in create_query, f"Default partition_by not found in CREATE TABLE query: {create_query}"
141145

142146
mysql.execute(f"INSERT INTO `{TEST_TABLE_NAME}` (name, age) VALUES ('Filipp', 50);", commit=True)
143147
assert_wait(lambda: len(ch.select(TEST_TABLE_NAME)) == 3)

tests_config.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ indexes:
2929
index: 'INDEX name_idx name TYPE ngrambf_v1(5, 65536, 4, 0) GRANULARITY 1'
3030

3131
partition_bys:
32-
- databases: '*test*'
32+
- databases: 'replication-test_db'
3333
tables: ['test_table']
34-
partition_by: 'toYYYYMM(toDate(id))'
34+
partition_by: 'intDiv(id, 1000000)'
35+
36+
3537

3638
http_host: 'localhost'
3739
http_port: 9128

0 commit comments

Comments
 (0)