From 86869c7d150342fc1ef217d4552059b735cf74ff Mon Sep 17 00:00:00 2001 From: walter Date: Sun, 28 Apr 2024 16:02:35 +0800 Subject: [PATCH] Fix test inverted index (#70) --- .../data/table-sync/test_inverted_index.out | 48 +++++++++---------- .../table-sync/test_inverted_index.groovy | 19 +++++--- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/regression-test/data/table-sync/test_inverted_index.out b/regression-test/data/table-sync/test_inverted_index.out index 5d3ef528..7f3f2b8f 100644 --- a/regression-test/data/table-sync/test_inverted_index.out +++ b/regression-test/data/table-sync/test_inverted_index.out @@ -24,7 +24,7 @@ -- !sql -- 2 bason bason hate pear 98 --- !sql -- +-- !target_sql -- 1 andy andy love apple 100 1 bason bason hate pear 100 2 andy andy love apple 100 @@ -34,19 +34,19 @@ 4 andy andy love apple 100 4 bason bason hate pear 99 --- !sql -- +-- !target_sql -- 1 andy andy love apple 100 2 andy andy love apple 100 3 andy andy love apple 100 4 andy andy love apple 100 --- !sql -- +-- !target_sql -- 1 bason bason hate pear 100 2 bason bason hate pear 98 3 bason bason hate pear 99 4 bason bason hate pear 99 --- !sql -- +-- !target_sql -- 2 bason bason hate pear 98 -- !sql -- @@ -83,7 +83,7 @@ 2 bason bason hate pear 98 6 andy andy love apple 98 --- !sql -- +-- !target_sql -- 1 andy andy love apple 100 1 bason bason hate pear 100 2 andy andy love apple 100 @@ -97,7 +97,7 @@ 6 andy andy love apple 98 6 bason bason hate pear 99 --- !sql -- +-- !target_sql -- 1 andy andy love apple 100 2 andy andy love apple 100 3 andy andy love apple 100 @@ -105,7 +105,7 @@ 5 andy andy love apple 100 6 andy andy love apple 98 --- !sql -- +-- !target_sql -- 1 bason bason hate pear 100 2 bason bason hate pear 98 3 bason bason hate pear 99 @@ -113,7 +113,7 @@ 5 bason bason hate pear 99 6 bason bason hate pear 99 --- !sql -- +-- !target_sql -- 2 bason bason hate pear 98 6 andy andy love apple 98 @@ -134,21 +134,21 @@ -- !sql -- 2 bason bason hate pear 98 --- !sql -- +-- !target_sql -- 1 bason bason hate pear 100 2 bason bason hate pear 98 3 bason bason hate pear 99 4 andy andy love apple 100 --- !sql -- +-- !target_sql -- 4 andy andy love apple 100 --- !sql -- +-- !target_sql -- 1 bason bason hate pear 100 2 bason bason hate pear 98 3 bason bason hate pear 99 --- !sql -- +-- !target_sql -- 2 bason bason hate pear 98 -- !sql -- @@ -173,7 +173,7 @@ 2 bason bason hate pear 98 6 andy andy love apple 98 --- !sql -- +-- !target_sql -- 1 bason bason hate pear 100 2 bason bason hate pear 98 3 bason bason hate pear 99 @@ -181,17 +181,17 @@ 5 andy andy love apple 100 6 andy andy love apple 98 --- !sql -- +-- !target_sql -- 4 andy andy love apple 100 5 andy andy love apple 100 6 andy andy love apple 98 --- !sql -- +-- !target_sql -- 1 bason bason hate pear 100 2 bason bason hate pear 98 3 bason bason hate pear 99 --- !sql -- +-- !target_sql -- 2 bason bason hate pear 98 6 andy andy love apple 98 @@ -212,21 +212,21 @@ -- !sql -- 2 bason bason hate pear 98 --- !sql -- +-- !target_sql -- 1 bason bason hate pear 100 2 bason bason hate pear 98 3 bason bason hate pear 99 4 andy andy love apple 100 --- !sql -- +-- !target_sql -- 4 andy andy love apple 100 --- !sql -- +-- !target_sql -- 1 bason bason hate pear 100 2 bason bason hate pear 98 3 bason bason hate pear 99 --- !sql -- +-- !target_sql -- 2 bason bason hate pear 98 -- !sql -- @@ -251,7 +251,7 @@ 2 bason bason hate pear 98 6 andy andy love apple 98 --- !sql -- +-- !target_sql -- 1 bason bason hate pear 100 2 bason bason hate pear 98 3 bason bason hate pear 99 @@ -259,17 +259,17 @@ 5 andy andy love apple 100 6 andy andy love apple 98 --- !sql -- +-- !target_sql -- 4 andy andy love apple 100 5 andy andy love apple 100 6 andy andy love apple 98 --- !sql -- +-- !target_sql -- 1 bason bason hate pear 100 2 bason bason hate pear 98 3 bason bason hate pear 99 --- !sql -- +-- !target_sql -- 2 bason bason hate pear 98 6 andy andy love apple 98 diff --git a/regression-test/suites/table-sync/test_inverted_index.groovy b/regression-test/suites/table-sync/test_inverted_index.groovy index c1ef9d3a..e0003b3d 100644 --- a/regression-test/suites/table-sync/test_inverted_index.groovy +++ b/regression-test/suites/table-sync/test_inverted_index.groovy @@ -77,16 +77,23 @@ suite("test_inverted_index") { sql """ INSERT INTO ${tableName} VALUES (6, "andy", "andy love apple", 98); """ } - def run_sql = { String db -> - qt_sql """ select * from ${db}.${tableName} order by id, name, hobbies, score """ - qt_sql """ select * from ${db}.${tableName} where name match "andy" order by id, name, hobbies, score """ - qt_sql """ select * from ${db}.${tableName} where hobbies match "pear" order by id, name, hobbies, score """ - qt_sql """ select * from ${db}.${tableName} where score < 99 order by id, name, hobbies, score """ + def run_sql = { String db -> + if (db.startsWith('TEST_')) { + qt_target_sql """ select * from ${db}.${tableName} order by id, name, hobbies, score """ + qt_target_sql """ select * from ${db}.${tableName} where name match "andy" order by id, name, hobbies, score """ + qt_target_sql """ select * from ${db}.${tableName} where hobbies match "pear" order by id, name, hobbies, score """ + qt_target_sql """ select * from ${db}.${tableName} where score < 99 order by id, name, hobbies, score """ + } else { + qt_sql """ select * from ${db}.${tableName} order by id, name, hobbies, score """ + qt_sql """ select * from ${db}.${tableName} where name match "andy" order by id, name, hobbies, score """ + qt_sql """ select * from ${db}.${tableName} where hobbies match "pear" order by id, name, hobbies, score """ + qt_sql """ select * from ${db}.${tableName} where score < 99 order by id, name, hobbies, score """ + } } def run_test = { -> insert_data.call() - + sql """ALTER TABLE ${tableName} set ("binlog.enable" = "true")""" sql "sync"