Skip to content

Commit a197b2a

Browse files
authored
Custom Index: Test corrections (#651)
Update syntax tests to use custom types instead of built-in types.
1 parent bdd55eb commit a197b2a

4 files changed

Lines changed: 67 additions & 35 deletions

File tree

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
1-
CREATE TABLE t (id INT PRIMARY KEY, val INT);
2-
ALTER TABLE t ADD INDEX idx (id) USING EXTENDED(hnsw);
1+
SET PERSIST vsql_allow_preview_extensions = ON;
2+
INSTALL EXTENSION vsql_index_test;
3+
CREATE TABLE t (id INT PRIMARY KEY, a dummy_type_vector);
4+
ALTER TABLE t ADD INDEX idx (a) USING EXTENDED(dummy_index_hnsw);
35
ERROR HY000: Extended Index feature not yet implemented
4-
ALTER TABLE t ADD INDEX idx (id) USING EXTENDED(myext.hnsw);
6+
ALTER TABLE t ADD INDEX idx (a) USING EXTENDED(vsql_index_test.dummy_index_hnsw);
57
ERROR HY000: Extended Index feature not yet implemented
6-
ALTER TABLE t ADD INDEX idx (id) USING EXTENDED(hnsw) WITH (M = 16, metric = 'l2');
8+
ALTER TABLE t ADD INDEX idx (a) USING EXTENDED(dummy_index_hnsw) WITH (M = 16, metric = 'l2');
79
ERROR HY000: Extended Index feature not yet implemented
8-
ALTER TABLE t ADD INDEX idx (id) WITH (M = 16);
10+
ALTER TABLE t ADD INDEX idx (a) WITH (M = 16);
911
ERROR HY000: Extended Index feature not yet implemented
10-
ALTER TABLE t ADD INDEX idx (id hnsw_l2_profile) USING EXTENDED(hnsw);
12+
ALTER TABLE t ADD INDEX idx (a dummy_profile_hnsw_l2) USING EXTENDED(dummy_index_hnsw);
1113
ERROR HY000: Extended Index feature not yet implemented
12-
ALTER TABLE t ADD INDEX idx (id hnsw_l2_profile) USING EXTENDED(myext.hnsw) WITH (M = 16, metric = 'l2');
14+
ALTER TABLE t ADD INDEX idx (a dummy_profile_hnsw_l2) USING EXTENDED(vsql_index_test.dummy_index_hnsw) WITH (M = 16, metric = 'l2');
1315
ERROR HY000: Extended Index feature not yet implemented
14-
ALTER TABLE t ADD INDEX idx (id myext.hnsw_l2_profile) USING EXTENDED(hnsw);
16+
ALTER TABLE t ADD INDEX idx (a vsql_index_test.dummy_profile_hnsw_l2) USING EXTENDED(dummy_index_hnsw);
1517
ERROR HY000: Extended Index feature not yet implemented
16-
ALTER TABLE t ADD INDEX idx (id myext.hnsw_l2_profile) USING EXTENDED(myext.hnsw) WITH (M = 16, metric = 'l2');
18+
ALTER TABLE t ADD INDEX idx (a vsql_index_test.dummy_profile_hnsw_l2) USING EXTENDED(vsql_index_test.dummy_index_hnsw) WITH (M = 16, metric = 'l2');
1719
ERROR HY000: Extended Index feature not yet implemented
1820
SHOW CREATE TABLE t;
1921
Table Create Table
2022
t CREATE TABLE `t` (
2123
`id` int NOT NULL,
22-
`val` int DEFAULT NULL,
24+
`a` vsql_index_test.dummy_type_vector DEFAULT NULL,
2325
PRIMARY KEY (`id`)
2426
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
2527
DROP TABLE t;
28+
UNINSTALL EXTENSION vsql_index_test;
29+
SET PERSIST vsql_allow_preview_extensions = OFF;
30+
RESET PERSIST vsql_allow_preview_extensions;
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,53 @@
1-
CREATE TABLE t1 (id INT PRIMARY KEY, INDEX idx (id) USING EXTENDED(hnsw));
1+
SET PERSIST vsql_allow_preview_extensions = ON;
2+
INSTALL EXTENSION vsql_index_test;
3+
CREATE TABLE t1 (id INT PRIMARY KEY, a dummy_type_vector, INDEX idx (a) USING EXTENDED(dummy_index_hnsw));
24
ERROR HY000: Extended Index feature not yet implemented
35
SHOW CREATE TABLE t1;
46
ERROR 42S02: Table 'test.t1' doesn't exist
5-
CREATE TABLE t2 (id INT PRIMARY KEY, INDEX idx (id) USING EXTENDED(myext.hnsw));
7+
CREATE TABLE t2 (id INT PRIMARY KEY, a dummy_type_vector, INDEX idx (a) USING EXTENDED(vsql_index_test.dummy_index_hnsw));
68
ERROR HY000: Extended Index feature not yet implemented
79
SHOW CREATE TABLE t2;
810
ERROR 42S02: Table 'test.t2' doesn't exist
911
CREATE TABLE t3 (
1012
id INT PRIMARY KEY,
11-
INDEX idx (id) USING EXTENDED(hnsw) WITH (M = 16, metric = 'l2')
13+
a dummy_type_vector,
14+
INDEX idx (a) USING EXTENDED(dummy_index_hnsw) WITH (M = 16, metric = 'l2')
1215
);
1316
ERROR HY000: Extended Index feature not yet implemented
1417
SHOW CREATE TABLE t3;
1518
ERROR 42S02: Table 'test.t3' doesn't exist
16-
CREATE TABLE t4 (id INT PRIMARY KEY, INDEX idx (id) WITH (M = 16));
19+
CREATE TABLE t4 (id INT PRIMARY KEY, a dummy_type_vector, INDEX idx (a) WITH (M = 16));
1720
ERROR HY000: Extended Index feature not yet implemented
1821
SHOW CREATE TABLE t4;
1922
ERROR 42S02: Table 'test.t4' doesn't exist
20-
CREATE TABLE t5 (id INT PRIMARY KEY, INDEX idx (id hnsw_l2_profile) USING EXTENDED(hnsw));
23+
CREATE TABLE t5 (id INT PRIMARY KEY, a dummy_type_vector, INDEX idx (a dummy_profile_hnsw_l2) USING EXTENDED(dummy_index_hnsw));
2124
ERROR HY000: Extended Index feature not yet implemented
2225
SHOW CREATE TABLE t5;
2326
ERROR 42S02: Table 'test.t5' doesn't exist
2427
CREATE TABLE t6 (
2528
id INT PRIMARY KEY,
26-
INDEX idx (id hnsw_l2_profile) USING EXTENDED(myext.hnsw) WITH (M = 16)
29+
a dummy_type_vector,
30+
INDEX idx (a dummy_profile_hnsw_l2) USING EXTENDED(vsql_index_test.dummy_index_hnsw) WITH (M = 16)
2731
);
2832
ERROR HY000: Extended Index feature not yet implemented
2933
SHOW CREATE TABLE t6;
3034
ERROR 42S02: Table 'test.t6' doesn't exist
3135
CREATE TABLE t7 (
3236
id INT PRIMARY KEY,
33-
INDEX idx (id myext.hnsw_l2_profile) USING EXTENDED(hnsw)
37+
a dummy_type_vector,
38+
INDEX idx (a vsql_index_test.dummy_profile_hnsw_l2) USING EXTENDED(dummy_index_hnsw)
3439
);
3540
ERROR HY000: Extended Index feature not yet implemented
3641
SHOW CREATE TABLE t7;
3742
ERROR 42S02: Table 'test.t7' doesn't exist
3843
CREATE TABLE t8 (
3944
id INT PRIMARY KEY,
40-
INDEX idx (id myext.hnsw_l2_profile) USING EXTENDED(myext.hnsw) WITH (M = 16, metric = 'l2')
45+
a dummy_type_vector,
46+
INDEX idx (a vsql_index_test.dummy_profile_hnsw_l2) USING EXTENDED(vsql_index_test.dummy_index_hnsw) WITH (M = 16, metric = 'l2')
4147
);
4248
ERROR HY000: Extended Index feature not yet implemented
4349
SHOW CREATE TABLE t8;
4450
ERROR 42S02: Table 'test.t8' doesn't exist
51+
UNINSTALL EXTENSION vsql_index_test;
52+
SET PERSIST vsql_allow_preview_extensions = OFF;
53+
RESET PERSIST vsql_allow_preview_extensions;

mysql-test/suite/villagesql/extension/vsql-index-test/t/alter_table_index.test

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,48 @@
22
# A failed ADD INDEX leaves the table and its existing indexes intact.
33
# TODO(villagesql-indexing): Remove --error directives and replace with functional tests once custom index execution is implemented.
44

5-
CREATE TABLE t (id INT PRIMARY KEY, val INT);
5+
SET PERSIST vsql_allow_preview_extensions = ON;
6+
INSTALL EXTENSION vsql_index_test;
7+
8+
CREATE TABLE t (id INT PRIMARY KEY, a dummy_type_vector);
69

710
# ADD INDEX USING EXTENDED -- unqualified type name
811
--error ER_VILLAGESQL_GENERIC_ERROR
9-
ALTER TABLE t ADD INDEX idx (id) USING EXTENDED(hnsw);
12+
ALTER TABLE t ADD INDEX idx (a) USING EXTENDED(dummy_index_hnsw);
1013

1114
# ADD INDEX USING EXTENDED -- qualified extension.type_name
1215
--error ER_VILLAGESQL_GENERIC_ERROR
13-
ALTER TABLE t ADD INDEX idx (id) USING EXTENDED(myext.hnsw);
16+
ALTER TABLE t ADD INDEX idx (a) USING EXTENDED(vsql_index_test.dummy_index_hnsw);
1417

1518
# ADD INDEX USING EXTENDED + WITH -- numeric and string params
1619
--error ER_VILLAGESQL_GENERIC_ERROR
17-
ALTER TABLE t ADD INDEX idx (id) USING EXTENDED(hnsw) WITH (M = 16, metric = 'l2');
20+
ALTER TABLE t ADD INDEX idx (a) USING EXTENDED(dummy_index_hnsw) WITH (M = 16, metric = 'l2');
1821

1922
# ADD INDEX WITH standalone -- exercises PT_index_with_options path in ALTER TABLE context
2023
--error ER_VILLAGESQL_GENERIC_ERROR
21-
ALTER TABLE t ADD INDEX idx (id) WITH (M = 16);
24+
ALTER TABLE t ADD INDEX idx (a) WITH (M = 16);
2225

2326
# Column with index profile + USING EXTENDED
2427
--error ER_VILLAGESQL_GENERIC_ERROR
25-
ALTER TABLE t ADD INDEX idx (id hnsw_l2_profile) USING EXTENDED(hnsw);
28+
ALTER TABLE t ADD INDEX idx (a dummy_profile_hnsw_l2) USING EXTENDED(dummy_index_hnsw);
2629

2730
# Column with index profile + qualified type + WITH params
2831
--error ER_VILLAGESQL_GENERIC_ERROR
29-
ALTER TABLE t ADD INDEX idx (id hnsw_l2_profile) USING EXTENDED(myext.hnsw) WITH (M = 16, metric = 'l2');
32+
ALTER TABLE t ADD INDEX idx (a dummy_profile_hnsw_l2) USING EXTENDED(vsql_index_test.dummy_index_hnsw) WITH (M = 16, metric = 'l2');
3033

3134
# Column with qualified extension.profile (extension.profile_name syntax)
3235
--error ER_VILLAGESQL_GENERIC_ERROR
33-
ALTER TABLE t ADD INDEX idx (id myext.hnsw_l2_profile) USING EXTENDED(hnsw);
36+
ALTER TABLE t ADD INDEX idx (a vsql_index_test.dummy_profile_hnsw_l2) USING EXTENDED(dummy_index_hnsw);
3437

3538
# Qualified profile + qualified extension type + WITH params
3639
--error ER_VILLAGESQL_GENERIC_ERROR
37-
ALTER TABLE t ADD INDEX idx (id myext.hnsw_l2_profile) USING EXTENDED(myext.hnsw) WITH (M = 16, metric = 'l2');
40+
ALTER TABLE t ADD INDEX idx (a vsql_index_test.dummy_profile_hnsw_l2) USING EXTENDED(vsql_index_test.dummy_index_hnsw) WITH (M = 16, metric = 'l2');
3841

3942
# Table must be unaffected by the failed ALTER TABLE statements above
4043
SHOW CREATE TABLE t;
4144

4245
DROP TABLE t;
46+
47+
UNINSTALL EXTENSION vsql_index_test;
48+
SET PERSIST vsql_allow_preview_extensions = OFF;
49+
RESET PERSIST vsql_allow_preview_extensions;

mysql-test/suite/villagesql/extension/vsql-index-test/t/create_table_index.test

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
# A failed CREATE TABLE leaves no table behind.
44
# TODO(villagesql-indexing): Remove --error directives and replace with functional tests once custom index execution is implemented.
55

6+
SET PERSIST vsql_allow_preview_extensions = ON;
7+
INSTALL EXTENSION vsql_index_test;
8+
69
# Inline USING EXTENDED -- unqualified type name
710
--error ER_VILLAGESQL_GENERIC_ERROR
8-
CREATE TABLE t1 (id INT PRIMARY KEY, INDEX idx (id) USING EXTENDED(hnsw));
11+
CREATE TABLE t1 (id INT PRIMARY KEY, a dummy_type_vector, INDEX idx (a) USING EXTENDED(dummy_index_hnsw));
912

1013
--error ER_NO_SUCH_TABLE
1114
SHOW CREATE TABLE t1;
1215

1316
# Inline USING EXTENDED -- qualified extension.type_name
1417
--error ER_VILLAGESQL_GENERIC_ERROR
15-
CREATE TABLE t2 (id INT PRIMARY KEY, INDEX idx (id) USING EXTENDED(myext.hnsw));
18+
CREATE TABLE t2 (id INT PRIMARY KEY, a dummy_type_vector, INDEX idx (a) USING EXTENDED(vsql_index_test.dummy_index_hnsw));
1619

1720
--error ER_NO_SUCH_TABLE
1821
SHOW CREATE TABLE t2;
@@ -21,22 +24,23 @@ SHOW CREATE TABLE t2;
2124
--error ER_VILLAGESQL_GENERIC_ERROR
2225
CREATE TABLE t3 (
2326
id INT PRIMARY KEY,
24-
INDEX idx (id) USING EXTENDED(hnsw) WITH (M = 16, metric = 'l2')
27+
a dummy_type_vector,
28+
INDEX idx (a) USING EXTENDED(dummy_index_hnsw) WITH (M = 16, metric = 'l2')
2529
);
2630

2731
--error ER_NO_SUCH_TABLE
2832
SHOW CREATE TABLE t3;
2933

3034
# Inline WITH standalone -- exercises PT_index_with_options path in CREATE TABLE context
3135
--error ER_VILLAGESQL_GENERIC_ERROR
32-
CREATE TABLE t4 (id INT PRIMARY KEY, INDEX idx (id) WITH (M = 16));
36+
CREATE TABLE t4 (id INT PRIMARY KEY, a dummy_type_vector, INDEX idx (a) WITH (M = 16));
3337

3438
--error ER_NO_SUCH_TABLE
3539
SHOW CREATE TABLE t4;
3640

3741
# Inline column with index profile + USING EXTENDED
3842
--error ER_VILLAGESQL_GENERIC_ERROR
39-
CREATE TABLE t5 (id INT PRIMARY KEY, INDEX idx (id hnsw_l2_profile) USING EXTENDED(hnsw));
43+
CREATE TABLE t5 (id INT PRIMARY KEY, a dummy_type_vector, INDEX idx (a dummy_profile_hnsw_l2) USING EXTENDED(dummy_index_hnsw));
4044

4145
--error ER_NO_SUCH_TABLE
4246
SHOW CREATE TABLE t5;
@@ -45,7 +49,8 @@ SHOW CREATE TABLE t5;
4549
--error ER_VILLAGESQL_GENERIC_ERROR
4650
CREATE TABLE t6 (
4751
id INT PRIMARY KEY,
48-
INDEX idx (id hnsw_l2_profile) USING EXTENDED(myext.hnsw) WITH (M = 16)
52+
a dummy_type_vector,
53+
INDEX idx (a dummy_profile_hnsw_l2) USING EXTENDED(vsql_index_test.dummy_index_hnsw) WITH (M = 16)
4954
);
5055

5156
--error ER_NO_SUCH_TABLE
@@ -55,7 +60,8 @@ SHOW CREATE TABLE t6;
5560
--error ER_VILLAGESQL_GENERIC_ERROR
5661
CREATE TABLE t7 (
5762
id INT PRIMARY KEY,
58-
INDEX idx (id myext.hnsw_l2_profile) USING EXTENDED(hnsw)
63+
a dummy_type_vector,
64+
INDEX idx (a vsql_index_test.dummy_profile_hnsw_l2) USING EXTENDED(dummy_index_hnsw)
5965
);
6066

6167
--error ER_NO_SUCH_TABLE
@@ -65,8 +71,13 @@ SHOW CREATE TABLE t7;
6571
--error ER_VILLAGESQL_GENERIC_ERROR
6672
CREATE TABLE t8 (
6773
id INT PRIMARY KEY,
68-
INDEX idx (id myext.hnsw_l2_profile) USING EXTENDED(myext.hnsw) WITH (M = 16, metric = 'l2')
74+
a dummy_type_vector,
75+
INDEX idx (a vsql_index_test.dummy_profile_hnsw_l2) USING EXTENDED(vsql_index_test.dummy_index_hnsw) WITH (M = 16, metric = 'l2')
6976
);
7077

7178
--error ER_NO_SUCH_TABLE
7279
SHOW CREATE TABLE t8;
80+
81+
UNINSTALL EXTENSION vsql_index_test;
82+
SET PERSIST vsql_allow_preview_extensions = OFF;
83+
RESET PERSIST vsql_allow_preview_extensions;

0 commit comments

Comments
 (0)