Skip to content

Commit 38c394d

Browse files
author
Ariznawlll
authored
add alter table drop fulltext index case. (#21261)
add alter table drop fulltext index case Approved by: @heni02
1 parent cc9ad9e commit 38c394d

File tree

5 files changed

+86
-43
lines changed

5 files changed

+86
-43
lines changed

test/distributed/cases/fulltext/fulltext2.result

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Rapier Abigail F Human Resources 38
2626
create fulltext index ftidx on fulltext01 (LastName, FirstName);
2727
alter table fulltext01 add column newcolumn decimal after LastName;
2828
show create table fulltext01;
29-
29+
Table Create Table
30+
fulltext01 CREATE TABLE `fulltext01` (\n `LastName` char(10) NOT NULL,\n `newcolumn` decimal(38,0) DEFAULT NULL,\n `FirstName` char(10) DEFAULT NULL,\n `Gender` char(1) DEFAULT NULL,\n `DepartmentName` char(20) DEFAULT NULL,\n `Age` int DEFAULT NULL,\n PRIMARY KEY (`LastName`),\n FULLTEXT `ftidx`(`LastName`,`FirstName`)\n)
3031
select * from fulltext01;
3132
lastname newcolumn firstname gender departmentname age
3233
Gilbert null Kevin M Tool Design 33
@@ -60,7 +61,8 @@ employeenumber lastname firstname extension email officecode r
6061
create fulltext index f01 on employees (LastName, FirstName);
6162
alter table employees drop column LastName;
6263
show create table employees;
63-
64+
Table Create Table
65+
employees CREATE TABLE `employees` (\n `employeeNumber` int NOT NULL,\n `firstName` varchar(50) NOT NULL,\n `extension` varchar(10) NOT NULL,\n `email` varchar(100) NOT NULL,\n `officeCode` varchar(10) NOT NULL,\n `reportsTo` int DEFAULT NULL,\n `jobTitle` varchar(50) NOT NULL,\n PRIMARY KEY (`employeeNumber`),\n FULLTEXT `f01`(`firstName`)\n)
6466
select * from employees;
6567
employeenumber firstname extension email officecode reportsto jobtitle
6668
1002 Diane x5800 [email protected] 1 null President
@@ -80,7 +82,8 @@ insert into t1 values(4, 'ab_def');
8082
create fulltext index f02 on t1 (col2);
8183
alter table t1 modify column col2 text;
8284
show create table t1;
83-
85+
Table Create Table
86+
t1 CREATE TABLE `t1` (\n `col1` int NOT NULL,\n `col2` text DEFAULT NULL,\n PRIMARY KEY (`col1`),\n FULLTEXT `f02`(`col2`)\n)
8487
select * from t1;
8588
col1 col2
8689
1 abcdef
@@ -126,7 +129,7 @@ col1 col2 col3
126129
2 3 e4r34f
127130
create fulltext index f01 on ab01 (col2);
128131
create fulltext index f02 on ab01 (col2);
129-
132+
not supported: Fulltext index are not allowed to use the same column
130133
drop table ab01;
131134
drop table if exists char01;
132135
create table char01 (col1 varchar(200) primary key , col2 char(10));
@@ -139,7 +142,8 @@ col1 col2
139142
alter table char01 add fulltext index f01(col1);
140143
alter table char01 add fulltext index f02(col2);
141144
show create table char01;
142-
145+
Table Create Table
146+
char01 CREATE TABLE `char01` (\n `col1` varchar(200) NOT NULL,\n `col2` char(10) DEFAULT NULL,\n PRIMARY KEY (`col1`),\n FULLTEXT `f01`(`col1`),\n FULLTEXT `f02`(`col2`)\n)
143147
drop table char01;
144148
drop table if exists ab02;
145149
create table ab02 (a bigint unsigned not null, primary key(a));
@@ -235,7 +239,8 @@ insert into prepare_fulltext values (1, 11), (2, 22), (3, 33);
235239
prepare stmt1 from 'create fulltext index f06 on prepare_fulltext (a)';
236240
execute stmt1;
237241
show create table prepare_fulltext;
238-
242+
Table Create Table
243+
prepare_fulltext CREATE TABLE `prepare_fulltext` (\n `a` char(1) NOT NULL,\n `b` varchar(20) DEFAULT NULL,\n PRIMARY KEY (`a`),\n FULLTEXT `f06`(`a`)\n)
239244
select * from prepare_fulltext;
240245
a b
241246
1 11
@@ -253,7 +258,8 @@ execute stmt4;
253258
prepare stmt3 from 'alter table pro add fulltext index pro2(name)';
254259
execute stmt3;
255260
show create table pro;
256-
261+
Table Create Table
262+
pro CREATE TABLE `pro` (\n `id` int NOT NULL AUTO_INCREMENT,\n `name` varchar(255) DEFAULT NULL,\n `details` json DEFAULT NULL,\n PRIMARY KEY (`id`),\n FULLTEXT `pro1`(`details`) WITH PARSER json,\n FULLTEXT `pro2`(`name`)\n)
257263
insert into pro (name, details) values('手机', '{"brand": "Apple", "model": "iPhone 12", "price": 800}');
258264
select * from pro;
259265
id name details
@@ -271,7 +277,8 @@ PRIMARY KEY (`col1`),
271277
fulltext(col5)
272278
);
273279
show create table test_table;
274-
280+
Table Create Table
281+
test_table CREATE TABLE `test_table` (\n `col1` int NOT NULL AUTO_INCREMENT,\n `col2` float DEFAULT NULL,\n `col3` bool DEFAULT NULL,\n `col4` date DEFAULT NULL,\n `col5` varchar(255) DEFAULT NULL,\n `col6` text DEFAULT NULL,\n PRIMARY KEY (`col1`),\n FULLTEXT (`col5`)\n)
275282
load data infile '$resources/load_data/test_1.csv' into table test_table fields terminated by ',' parallel 'true';
276283
select * from test_table;
277284
col1 col2 col3 col4 col5 col6
@@ -367,7 +374,8 @@ true 2 var 2020-09-07 2020-09-07 00:00:00 2020-09-07 00:00:00
367374
true 3 var 2020-09-07 2020-09-07 00:00:00 2020-09-07 00:00:00 18 121.11 ["1", 2, null, false, true, {"q": 1}] 1az null null
368375
true 4 var 2020-09-07 2020-09-07 00:00:00 2020-09-07 00:00:00 18 121.11 {"b": ["a", "b", {"q": 4}], "c": 1} 1qaz null null
369376
show create table t1;
370-
377+
Table Create Table
378+
t1 CREATE TABLE `t1` (\n `col1` bool DEFAULT NULL,\n `col2` int NOT NULL,\n `col3` varchar(100) DEFAULT NULL,\n `col4` date DEFAULT NULL,\n `col5` datetime DEFAULT NULL,\n `col6` timestamp NULL DEFAULT NULL,\n `col7` decimal(38,0) DEFAULT NULL,\n `col8` float DEFAULT NULL,\n `col9` json DEFAULT NULL,\n `col10` text DEFAULT NULL,\n `col11` json DEFAULT NULL,\n `col12` bool DEFAULT NULL,\n PRIMARY KEY (`col2`),\n FULLTEXT `f06`(`col9`)\n)
371379
drop table t1;
372380
drop table if exists articles;
373381
create table articles (
@@ -608,4 +616,28 @@ where match(comment_text) AGAINST ('全文索引' IN NATURAL LANGUAGE MODE);
608616

609617
drop table comments;
610618
drop table posts;
619+
drop table if exists fulltext_test01;
620+
create table `fulltext_test01` (
621+
`col1` bigint default NULL,
622+
`col2` int not null,
623+
`col3` varchar(200) default NULL,
624+
`col4` varchar(200) default NULL,
625+
PRIMARY KEY (`col2`),
626+
FULLTEXT f01(`col3`) WITH PARSER ngram
627+
);
628+
load data infile '$resources/external_table_file/zhwiki.txt' into table fulltext_test01 fields terminated by ':' ESCAPED BY '\t' lines terminated by '\n';
629+
show create table fulltext_test01;
630+
Table Create Table
631+
fulltext_test01 CREATE TABLE `fulltext_test01` (\n `col1` bigint DEFAULT NULL,\n `col2` int NOT NULL,\n `col3` varchar(200) DEFAULT NULL,\n `col4` varchar(200) DEFAULT NULL,\n PRIMARY KEY (`col2`),\n FULLTEXT `f01`(`col3`) WITH PARSER ngram\n)
632+
alter table fulltext_test01 drop index f01;
633+
show create table fulltext_test01;
634+
Table Create Table
635+
fulltext_test01 CREATE TABLE `fulltext_test01` (\n `col1` bigint DEFAULT NULL,\n `col2` int NOT NULL,\n `col3` varchar(200) DEFAULT NULL,\n `col4` varchar(200) DEFAULT NULL,\n PRIMARY KEY (`col2`)\n)
636+
select * from fulltext_test01;
637+
col1 col2 col3 col4
638+
608 1 Wikipedia 上载纪录/存档/2002年
639+
608 2 Wikipedia 删除纪录/档案馆/2004年3月
640+
608 26 Wikipedia 繁简分歧词表
641+
608 31 Wikipedia 宣告/2005年
642+
drop table fulltext_test01;
611643
drop database test_fulltext;

test/distributed/cases/fulltext/fulltext2.sql

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ select * from fulltext01;
2222

2323
create fulltext index ftidx on fulltext01 (LastName, FirstName);
2424
alter table fulltext01 add column newcolumn decimal after LastName;
25-
-- @bvt:issue#20613
2625
show create table fulltext01;
27-
-- @bvt:issue
2826
select * from fulltext01;
2927
truncate fulltext01;
3028
drop table fulltext01;
@@ -51,9 +49,7 @@ insert into employees(employeeNumber,lastName,firstName,extension,email,officeCo
5149
select * from employees;
5250
create fulltext index f01 on employees (LastName, FirstName);
5351
alter table employees drop column LastName;
54-
-- @bvt:issue#20613
5552
show create table employees;
56-
-- @bvt:issue
5753
select * from employees;
5854
select count(*) from employees;
5955
truncate employees;
@@ -70,9 +66,7 @@ insert into t1 values(3, 'a_cdef');
7066
insert into t1 values(4, 'ab_def');
7167
create fulltext index f02 on t1 (col2);
7268
alter table t1 modify column col2 text;
73-
-- @bvt:issue#20613
7469
show create table t1;
75-
-- @bvt:issue
7670
select * from t1;
7771
drop table t1;
7872

@@ -109,9 +103,7 @@ insert into ab01 values (1,2,'da');
109103
insert into ab01 values (2,3,'e4r34f');
110104
select * from ab01;
111105
create fulltext index f01 on ab01 (col2);
112-
-- @bvt:issue#20123
113106
create fulltext index f02 on ab01 (col2);
114-
-- @bvt:issue
115107
drop table ab01;
116108

117109

@@ -124,9 +116,7 @@ insert into char01 values ('32jhbfchjecmwd%^&^(*&)UJHFRE%^T&YUHIJKNM', null);
124116
select * from char01;
125117
alter table char01 add fulltext index f01(col1);
126118
alter table char01 add fulltext index f02(col2);
127-
-- @bvt:issue#20613
128119
show create table char01;
129-
-- @bvt:issue
130120
drop table char01;
131121

132122

@@ -208,9 +198,7 @@ create table prepare_fulltext (a char primary key , b varchar(20));
208198
insert into prepare_fulltext values (1, 11), (2, 22), (3, 33);
209199
prepare stmt1 from 'create fulltext index f06 on prepare_fulltext (a)';
210200
execute stmt1;
211-
-- @bvt:issue#20613
212201
show create table prepare_fulltext;
213-
-- @bvt:issue
214202
select * from prepare_fulltext;
215203
drop table prepare_fulltext;
216204

@@ -227,9 +215,7 @@ prepare stmt4 from 'alter table pro add fulltext index pro1(details) with PARSER
227215
execute stmt4;
228216
prepare stmt3 from 'alter table pro add fulltext index pro2(name)';
229217
execute stmt3;
230-
-- @bvt:issue#20613
231218
show create table pro;
232-
-- @bvt:issue
233219
insert into pro (name, details) values('手机', '{"brand": "Apple", "model": "iPhone 12", "price": 800}');
234220
select * from pro;
235221
drop table pro;
@@ -248,9 +234,7 @@ col6 text,
248234
PRIMARY KEY (`col1`),
249235
fulltext(col5)
250236
);
251-
-- @bvt:issue#20613
252237
show create table test_table;
253-
-- @bvt:issue
254238
load data infile '$resources/load_data/test_1.csv' into table test_table fields terminated by ',' parallel 'true';
255239
select * from test_table;
256240
drop table test_table;
@@ -291,9 +275,7 @@ create table t1(
291275
create fulltext index f06 on t1(col9);
292276
load data infile {'filepath'='$resources/load_data/jsonline_object01.jl','format'='jsonline','jsondata'='object'} into table t1;
293277
select * from t1;
294-
-- @bvt:issue#20613
295278
show create table t1;
296-
-- @bvt:issue
297279
drop table t1;
298280

299281

@@ -522,4 +504,20 @@ drop table posts;
522504

523505

524506

507+
drop table if exists fulltext_test01;
508+
create table `fulltext_test01` (
509+
`col1` bigint default NULL,
510+
`col2` int not null,
511+
`col3` varchar(200) default NULL,
512+
`col4` varchar(200) default NULL,
513+
PRIMARY KEY (`col2`),
514+
FULLTEXT f01(`col3`) WITH PARSER ngram
515+
);
516+
load data infile '$resources/external_table_file/zhwiki.txt' into table fulltext_test01 fields terminated by ':' ESCAPED BY '\t' lines terminated by '\n';
517+
show create table fulltext_test01;
518+
alter table fulltext_test01 drop index f01;
519+
show create table fulltext_test01;
520+
select * from fulltext_test01;
521+
drop table fulltext_test01;
522+
525523
drop database test_fulltext;

test/distributed/cases/snapshot/sys_create_snapshot_for_sys_db_table_level.result

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,13 @@ drop snapshot spsp01;
117117
show snapshots;
118118
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
119119
drop database if exists sp_test01;
120+
120121
create database sp_test01;
122+
121123
use sp_test01;
124+
122125
drop table if exists partition01;
126+
123127
create table partition01 (
124128
emp_no int not null,
125129
birth_date date not null,
@@ -134,30 +138,40 @@ partition p02 values less than (200001),
134138
partition p03 values less than (300001),
135139
partition p04 values less than (400001)
136140
);
141+
137142
insert into partition01 values (9001,'1980-12-17', 'SMITH', 'CLERK', 'F', '2008-12-17'),
138143
(9002,'1981-02-20', 'ALLEN', 'SALESMAN', 'F', '2008-02-20');
144+
139145
drop snapshot if exists spsp02;
146+
140147
create snapshot spsp02 for database sp_test01;
148+
141149
show snapshots;
142150
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
143151
spsp02 2024-12-30 09:08:58.518045 database sys sp_test01
144152
delete from partition01 where birth_date = '1980-12-17';
153+
145154
select * from partition01;
146155
emp_no birth_date first_name last_name gender hire_date
147156
9002 1981-02-20 ALLEN SALESMAN F 2008-02-20
148157
restore account sys database sp_test01 from snapshot spsp02 ;
158+
149159
select * from partition01;
150160
emp_no birth_date first_name last_name gender hire_date
151161
9001 1980-12-17 SMITH CLERK F 2008-12-17
152162
9002 1981-02-20 ALLEN SALESMAN F 2008-02-20
153163
drop table partition01;
164+
154165
restore account sys database sp_test01 table partition01 from snapshot spsp02;
166+
155167
select * from partition01;
156168
emp_no birth_date first_name last_name gender hire_date
157169
9001 1980-12-17 SMITH CLERK F 2008-12-17
158170
9002 1981-02-20 ALLEN SALESMAN F 2008-02-20
159171
drop database sp_test01;
172+
160173
drop snapshot spsp02;
174+
161175
drop database if exists sp_test02;
162176
create database sp_test02;
163177
use sp_test02;
@@ -166,7 +180,7 @@ drop snapshot if exists `SELECT`;
166180
create snapshot `SELECT` for database sp_test02;
167181
show snapshots;
168182
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
169-
select 2024-12-30 09:08:59.159408 database sys sp_test02
183+
select 2025-01-17 03:40:58.952534 database sys sp_test02
170184
select sname, level, account_name, database_name, table_name from mo_catalog.mo_snapshots;
171185
sname level account_name database_name table_name
172186
select database sys sp_test02
@@ -180,7 +194,7 @@ drop snapshot if exists AUTO_INCREMENT;
180194
create snapshot AUTO_INCREMENT for database sp_test03;
181195
show snapshots;
182196
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
183-
auto_increment 2024-12-30 09:08:59.409431 database sys sp_test03
197+
auto_increment 2025-01-17 03:40:59.225357 database sys sp_test03
184198
select sname, level, account_name, database_name, table_name from mo_catalog.mo_snapshots;
185199
sname level account_name database_name table_name
186200
auto_increment database sys sp_test03
@@ -236,8 +250,8 @@ create snapshot spsp02 for database db02;
236250
create snapshot spsp03 for table db02 table01;
237251
show snapshots;
238252
SNAPSHOT_NAME TIMESTAMP SNAPSHOT_LEVEL ACCOUNT_NAME DATABASE_NAME TABLE_NAME
239-
spsp03 2024-12-30 09:09:00.460849 table sys db02 table01
240-
spsp02 2024-12-30 09:09:00.424832 database sys db02
253+
spsp03 2025-01-17 03:41:00.18732 table sys db02 table01
254+
spsp02 2025-01-17 03:41:00.160928 database sys db02
241255
select sname, level, account_name, database_name, table_name from mo_catalog.mo_snapshots where level = 'database';
242256
sname level account_name database_name table_name
243257
spsp02 database sys db02
@@ -268,21 +282,18 @@ drop database db10;
268282
drop role role1;
269283
drop user user1;
270284
use mo_catalog;
271-
272285
drop table if exists t1;
273-
274286
create cluster table t1(a int);
275-
276287
insert into t1 values(1,6),(2,6),(3,6);
277-
278288
select * from t1;
279-
289+
a account_id
290+
1 6
291+
2 6
292+
3 6
280293
drop snapshot if exists spsp07;
281-
282294
create snapshot spsp07 for table mo_catalog t1;
283-
295+
internal error: can not create snapshot for cluster table mo_catalog.t1
284296
drop table t1;
285-
286297
drop database if exists db10;
287298
create database db10;
288299
use db10;
@@ -468,14 +479,14 @@ col1 load_file(col2)
468479
1 1000-01-01,0001-01-01,1970-01-01 00:00:01,0\n9999-12-31,9999-12-31,2038-01-19,1\n
469480
select * from test01;
470481
col1 col2
471-
1 file:///Users/ariznawl/matrixone/test/distributed/resources/load_data/time_date_1.csv
482+
1 file:///Users/ariznawl/code/matrixone/test/distributed/resources/load_data/time_date_1.csv
472483
drop snapshot if exists spsp10;
473484
create snapshot spsp10 for database db10;
474485
drop table test01;
475486
restore account sys database db10 table test01 from snapshot spsp10;
476487
select * from db10.test01;
477488
col1 col2
478-
1 file:///Users/ariznawl/matrixone/test/distributed/resources/load_data/time_date_1.csv
489+
1 file:///Users/ariznawl/code/matrixone/test/distributed/resources/load_data/time_date_1.csv
479490
drop database db10;
480491
drop snapshot spsp10;
481492
drop account acc01;

test/distributed/cases/snapshot/sys_create_snapshot_for_sys_db_table_level.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ drop user user1;
242242

243243

244244
-- create snapshot for cluster table
245-
-- @bvt:issue#21006
246245
use mo_catalog;
247246
drop table if exists t1;
248247
create cluster table t1(a int);
@@ -251,7 +250,6 @@ select * from t1;
251250
drop snapshot if exists spsp07;
252251
create snapshot spsp07 for table mo_catalog t1;
253252
drop table t1;
254-
-- @bvt:issue
255253

256254

257255

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
608:1:Wikipedia:上载纪录/存档/2002年
2+
608:2:Wikipedia:删除纪录/档案馆/2004年3月
3+
608:26:Wikipedia:繁简分歧词表
4+
608:31:Wikipedia:宣告/2005年

0 commit comments

Comments
 (0)