Skip to content

Commit

Permalink
PS-9380: Add checks if compressed columns don't work with VECTOR
Browse files Browse the repository at this point in the history
  • Loading branch information
inikep committed Oct 7, 2024
1 parent 006ab90 commit 00dc0dc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
25 changes: 25 additions & 0 deletions mysql-test/suite/percona_innodb/r/xtradb_compressed_columns.result
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,31 @@ Table Create Table
t10 CREATE TABLE `t10` (
`a` json /*!50633 COLUMN_FORMAT COMPRESSED */ DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
# confirm that compressed columns are not supported for VECTOR
CREATE TABLE v1 (v VECTOR(128) COLUMN_FORMAT COMPRESSED) ENGINE=InnoDB;
ERROR HY000: Can not define column 'v' in compressed format
CREATE TABLE v2 (a TEXT COLUMN_FORMAT COMPRESSED, v VECTOR(1) COLUMN_FORMAT COMPRESSED) ENGINE=InnoDB;
ERROR HY000: Can not define column 'v' in compressed format
CREATE TABLE v3 (
id BIGINT UNSIGNED NOT NULL,
v VECTOR(8) COLUMN_FORMAT COMPRESSED
) ENGINE=InnoDB
PARTITION BY RANGE (id) (
PARTITION p1 VALUES LESS THAN (100),
PARTITION p2 VALUES LESS THAN MAXVALUE
);
ERROR HY000: Can not define column 'v' in compressed format
CREATE TABLE v4 (v VECTOR(128)) ENGINE=InnoDB;
SHOW CREATE TABLE v4;
Table Create Table
v4 CREATE TABLE `v4` (
`v` vector(128) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
ALTER TABLE v4 MODIFY COLUMN v VECTOR(128) COLUMN_FORMAT COMPRESSED;
ERROR HY000: Can not define column 'v' in compressed format
ALTER TABLE v4 ADD COLUMN c VECTOR COLUMN_FORMAT COMPRESSED;
ERROR HY000: Can not define column 'c' in compressed format
DROP TABLE v4;
# test index creation
# compressed columns are not allowed to defined as a part or a key
CREATE TABLE t1(a BLOB COLUMN_FORMAT COMPRESSED, KEY(a(10)));
Expand Down
22 changes: 22 additions & 0 deletions mysql-test/suite/percona_innodb/t/xtradb_compressed_columns.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@ SHOW CREATE TABLE t9;
CREATE TABLE t10 (a JSON COLUMN_FORMAT COMPRESSED) ENGINE=InnoDB;
SHOW CREATE TABLE t10;

--echo # confirm that compressed columns are not supported for VECTOR
--error ER_UNSUPPORTED_COMPRESSED_COLUMN_TYPE
CREATE TABLE v1 (v VECTOR(128) COLUMN_FORMAT COMPRESSED) ENGINE=InnoDB;
--error ER_UNSUPPORTED_COMPRESSED_COLUMN_TYPE
CREATE TABLE v2 (a TEXT COLUMN_FORMAT COMPRESSED, v VECTOR(1) COLUMN_FORMAT COMPRESSED) ENGINE=InnoDB;
--error ER_UNSUPPORTED_COMPRESSED_COLUMN_TYPE
CREATE TABLE v3 (
id BIGINT UNSIGNED NOT NULL,
v VECTOR(8) COLUMN_FORMAT COMPRESSED
) ENGINE=InnoDB
PARTITION BY RANGE (id) (
PARTITION p1 VALUES LESS THAN (100),
PARTITION p2 VALUES LESS THAN MAXVALUE
);
CREATE TABLE v4 (v VECTOR(128)) ENGINE=InnoDB;
SHOW CREATE TABLE v4;
--error ER_UNSUPPORTED_COMPRESSED_COLUMN_TYPE
ALTER TABLE v4 MODIFY COLUMN v VECTOR(128) COLUMN_FORMAT COMPRESSED;
--error ER_UNSUPPORTED_COMPRESSED_COLUMN_TYPE
ALTER TABLE v4 ADD COLUMN c VECTOR COLUMN_FORMAT COMPRESSED;
DROP TABLE v4;

--echo # test index creation
--echo # compressed columns are not allowed to defined as a part or a key
--error ER_COMPRESSED_COLUMN_USED_AS_KEY
Expand Down

0 comments on commit 00dc0dc

Please sign in to comment.