Skip to content

Commit f6af18d

Browse files
authored
add NOT NULL coordinate for the spatial key
1 parent 7fda8f6 commit f6af18d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test_mysql_ch_replicator.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def test_runner():
315315
name varchar(255),
316316
age int,
317317
rate decimal(10,4),
318-
coordinate point,
318+
coordinate point NOT NULL,
319319
KEY `IDX_age` (`age`),
320320
FULLTEXT KEY `IDX_name` (`name`),
321321
PRIMARY KEY (id),
@@ -324,8 +324,8 @@ def test_runner():
324324
''')
325325

326326

327-
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, age) VALUES ('Ivan', 42);", commit=True)
328-
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, age) VALUES ('Peter', 33);", commit=True)
327+
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, age, coordinate) VALUES ('Ivan', 42, POINT(10.0, 20.0));", commit=True)
328+
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, age, coordinate) VALUES ('Peter', 33, POINT(10.0, 20.0));", commit=True)
329329

330330
run_all_runner = RunAllRunner()
331331
run_all_runner.run()
@@ -337,7 +337,7 @@ def test_runner():
337337
assert_wait(lambda: TEST_TABLE_NAME in ch.get_tables())
338338
assert_wait(lambda: len(ch.select(TEST_TABLE_NAME)) == 2)
339339

340-
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, age) VALUES ('Filipp', 50);", commit=True)
340+
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, age, coordinate) VALUES ('Filipp', 50, POINT(10.0, 20.0));", commit=True)
341341
assert_wait(lambda: len(ch.select(TEST_TABLE_NAME)) == 3)
342342
assert_wait(lambda: ch.select(TEST_TABLE_NAME, where="name='Filipp'")[0]['age'] == 50)
343343

@@ -348,7 +348,7 @@ def test_runner():
348348
kill_process(binlog_repl_pid)
349349
kill_process(db_repl_pid, force=True)
350350

351-
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, rate) VALUES ('John', 12.5);", commit=True)
351+
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, rate, coordinate) VALUES ('John', 12.5, POINT(10.0, 20.0));", commit=True)
352352
assert_wait(lambda: len(ch.select(TEST_TABLE_NAME)) == 4)
353353
assert_wait(lambda: ch.select(TEST_TABLE_NAME, where="name='John'")[0]['rate'] == 12.5)
354354

@@ -364,14 +364,14 @@ def test_runner():
364364
mysql.execute(f"UPDATE {TEST_TABLE_NAME} SET age=88 WHERE name='Ivan'", commit=True)
365365
assert_wait(lambda: ch.select(TEST_TABLE_NAME, "name='Ivan'")[0]['age'] == 88)
366366

367-
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, age) VALUES ('Vlad', 99);", commit=True)
367+
mysql.execute(f"INSERT INTO {TEST_TABLE_NAME} (name, age, coordinate) VALUES ('Vlad', 99, POINT(10.0, 20.0));", commit=True)
368368

369369
assert_wait(lambda: len(ch.select(TEST_TABLE_NAME)) == 4)
370370

371371
assert_wait(lambda: len(ch.select(TEST_TABLE_NAME, final=False)) == 4)
372372

373373
mysql.execute(
374-
command=f"INSERT INTO {TEST_TABLE_NAME} (name, age) VALUES (%s, %s);",
374+
command=f"INSERT INTO {TEST_TABLE_NAME} (name, age, coordinate) VALUES (%s, %s, POINT(10.0, 20.0));",
375375
args=(b'H\xe4llo'.decode('latin-1'), 1912),
376376
commit=True,
377377
)

0 commit comments

Comments
 (0)