From db512d3fed52bc63a2159023dcbcd54c6cb30286 Mon Sep 17 00:00:00 2001 From: Jason Mo Date: Fri, 17 May 2024 14:38:33 +0800 Subject: [PATCH 1/5] update --- tests/integrationtest/r/ddl/partition.result | 101 +----------------- tests/integrationtest/t/ddl/partition.test | 102 +------------------ 2 files changed, 3 insertions(+), 200 deletions(-) diff --git a/tests/integrationtest/r/ddl/partition.result b/tests/integrationtest/r/ddl/partition.result index 44b97995d520a..c6868838870a7 100644 --- a/tests/integrationtest/r/ddl/partition.result +++ b/tests/integrationtest/r/ddl/partition.result @@ -41,106 +41,7 @@ a b 3 Hi drop table if exists t; create table t (a int primary key, b varchar(255), key (b)); -insert into t values (0,'filler0'); -insert into t values (1,'filler0'); -insert into t values (2,'filler0'); -insert into t values (3,'filler1'); -insert into t values (4,'filler1'); -insert into t values (5,'filler1'); -insert into t values (6,'filler2'); -insert into t values (7,'filler2'); -insert into t values (8,'filler2'); -insert into t values (9,'filler3'); -insert into t values (10,'filler3'); -insert into t values (11,'filler3'); -insert into t values (12,'filler4'); -insert into t values (13,'filler4'); -insert into t values (14,'filler4'); -insert into t values (15,'filler5'); -insert into t values (16,'filler5'); -insert into t values (17,'filler5'); -insert into t values (18,'filler6'); -insert into t values (19,'filler6'); -insert into t values (20,'filler6'); -insert into t values (21,'filler7'); -insert into t values (22,'filler7'); -insert into t values (23,'filler7'); -insert into t values (24,'filler8'); -insert into t values (25,'filler8'); -insert into t values (26,'filler8'); -insert into t values (27,'filler9'); -insert into t values (28,'filler9'); -insert into t values (29,'filler9'); -insert into t values (30,'filler10'); -insert into t values (31,'filler10'); -insert into t values (32,'filler10'); -insert into t values (33,'filler11'); -insert into t values (34,'filler11'); -insert into t values (35,'filler11'); -insert into t values (36,'filler12'); -insert into t values (37,'filler12'); -insert into t values (38,'filler12'); -insert into t values (39,'filler13'); -insert into t values (40,'filler13'); -insert into t values (41,'filler13'); -insert into t values (42,'filler14'); -insert into t values (43,'filler14'); -insert into t values (44,'filler14'); -insert into t values (45,'filler15'); -insert into t values (46,'filler15'); -insert into t values (47,'filler15'); -insert into t values (48,'filler16'); -insert into t values (49,'filler16'); -insert into t values (50,'filler16'); -insert into t values (51,'filler17'); -insert into t values (52,'filler17'); -insert into t values (53,'filler17'); -insert into t values (54,'filler18'); -insert into t values (55,'filler18'); -insert into t values (56,'filler18'); -insert into t values (57,'filler19'); -insert into t values (58,'filler19'); -insert into t values (59,'filler19'); -insert into t values (60,'filler20'); -insert into t values (61,'filler20'); -insert into t values (62,'filler20'); -insert into t values (63,'filler21'); -insert into t values (64,'filler21'); -insert into t values (65,'filler21'); -insert into t values (66,'filler22'); -insert into t values (67,'filler22'); -insert into t values (68,'filler22'); -insert into t values (69,'filler23'); -insert into t values (70,'filler23'); -insert into t values (71,'filler23'); -insert into t values (72,'filler24'); -insert into t values (73,'filler24'); -insert into t values (74,'filler24'); -insert into t values (75,'filler25'); -insert into t values (76,'filler25'); -insert into t values (77,'filler25'); -insert into t values (78,'filler26'); -insert into t values (79,'filler26'); -insert into t values (80,'filler26'); -insert into t values (81,'filler27'); -insert into t values (82,'filler27'); -insert into t values (83,'filler27'); -insert into t values (84,'filler28'); -insert into t values (85,'filler28'); -insert into t values (86,'filler28'); -insert into t values (87,'filler29'); -insert into t values (88,'filler29'); -insert into t values (89,'filler29'); -insert into t values (90,'filler30'); -insert into t values (91,'filler30'); -insert into t values (92,'filler30'); -insert into t values (93,'filler31'); -insert into t values (94,'filler31'); -insert into t values (95,'filler31'); -insert into t values (96,'filler32'); -insert into t values (97,'filler32'); -insert into t values (98,'filler32'); -insert into t values (99,'filler33'); +insert into t values (0,'filler0'), (1,'filler0'), (2,'filler0'), (3,'filler1'), (4,'filler1'), (5,'filler1'), (6,'filler2'), (7,'filler2'), (8,'filler2'), (9,'filler3'), (10,'filler3'), (11,'filler3'), (12,'filler4'), (13,'filler4'), (14,'filler4'), (15,'filler5'), (16,'filler5'), (17,'filler5'), (18,'filler6'), (19,'filler6'), (20,'filler6'), (21,'filler7'), (22,'filler7'), (23,'filler7'), (24,'filler8'), (25,'filler8'), (26,'filler8'), (27,'filler9'), (28,'filler9'), (29,'filler9'), (30,'filler10'), (31,'filler10'), (32,'filler10'), (33,'filler11'), (34,'filler11'), (35,'filler11'), (36,'filler12'), (37,'filler12'), (38,'filler12'), (39,'filler13'), (40,'filler13'), (41,'filler13'), (42,'filler14'), (43,'filler14'), (44,'filler14'), (45,'filler15'), (46,'filler15'), (47,'filler15'), (48,'filler16'), (49,'filler16'), (50,'filler16'), (51,'filler17'), (52,'filler17'), (53,'filler17'), (54,'filler18'), (55,'filler18'), (56,'filler18'), (57,'filler19'), (58,'filler19'), (59,'filler19'), (60,'filler20'), (61,'filler20'), (62,'filler20'), (63,'filler21'), (64,'filler21'), (65,'filler21'), (66,'filler22'), (67,'filler22'), (68,'filler22'), (69,'filler23'), (70,'filler23'), (71,'filler23'), (72,'filler24'), (73,'filler24'), (74,'filler24'), (75,'filler25'), (76,'filler25'), (77,'filler25'), (78,'filler26'), (79,'filler26'), (80,'filler26'), (81,'filler27'), (82,'filler27'), (83,'filler27'), (84,'filler28'), (85,'filler28'), (86,'filler28'), (87,'filler29'), (88,'filler29'), (89,'filler29'), (90,'filler30'), (91,'filler30'), (92,'filler30'), (93,'filler31'), (94,'filler31'), (95,'filler31'), (96,'filler32'), (97,'filler32'), (98,'filler32'), (99,'filler33'); alter table t partition by range (a) (partition p0 values less than (1000000), partition p1 values less than (2000000), partition pMax values less than (maxvalue)); show warnings; Level Code Message diff --git a/tests/integrationtest/t/ddl/partition.test b/tests/integrationtest/t/ddl/partition.test index 0e243251ab599..4ce18f4f319cb 100644 --- a/tests/integrationtest/t/ddl/partition.test +++ b/tests/integrationtest/t/ddl/partition.test @@ -27,106 +27,7 @@ select * from t; # TestAlterPartitionBy drop table if exists t; create table t (a int primary key, b varchar(255), key (b)); -insert into t values (0,'filler0'); -insert into t values (1,'filler0'); -insert into t values (2,'filler0'); -insert into t values (3,'filler1'); -insert into t values (4,'filler1'); -insert into t values (5,'filler1'); -insert into t values (6,'filler2'); -insert into t values (7,'filler2'); -insert into t values (8,'filler2'); -insert into t values (9,'filler3'); -insert into t values (10,'filler3'); -insert into t values (11,'filler3'); -insert into t values (12,'filler4'); -insert into t values (13,'filler4'); -insert into t values (14,'filler4'); -insert into t values (15,'filler5'); -insert into t values (16,'filler5'); -insert into t values (17,'filler5'); -insert into t values (18,'filler6'); -insert into t values (19,'filler6'); -insert into t values (20,'filler6'); -insert into t values (21,'filler7'); -insert into t values (22,'filler7'); -insert into t values (23,'filler7'); -insert into t values (24,'filler8'); -insert into t values (25,'filler8'); -insert into t values (26,'filler8'); -insert into t values (27,'filler9'); -insert into t values (28,'filler9'); -insert into t values (29,'filler9'); -insert into t values (30,'filler10'); -insert into t values (31,'filler10'); -insert into t values (32,'filler10'); -insert into t values (33,'filler11'); -insert into t values (34,'filler11'); -insert into t values (35,'filler11'); -insert into t values (36,'filler12'); -insert into t values (37,'filler12'); -insert into t values (38,'filler12'); -insert into t values (39,'filler13'); -insert into t values (40,'filler13'); -insert into t values (41,'filler13'); -insert into t values (42,'filler14'); -insert into t values (43,'filler14'); -insert into t values (44,'filler14'); -insert into t values (45,'filler15'); -insert into t values (46,'filler15'); -insert into t values (47,'filler15'); -insert into t values (48,'filler16'); -insert into t values (49,'filler16'); -insert into t values (50,'filler16'); -insert into t values (51,'filler17'); -insert into t values (52,'filler17'); -insert into t values (53,'filler17'); -insert into t values (54,'filler18'); -insert into t values (55,'filler18'); -insert into t values (56,'filler18'); -insert into t values (57,'filler19'); -insert into t values (58,'filler19'); -insert into t values (59,'filler19'); -insert into t values (60,'filler20'); -insert into t values (61,'filler20'); -insert into t values (62,'filler20'); -insert into t values (63,'filler21'); -insert into t values (64,'filler21'); -insert into t values (65,'filler21'); -insert into t values (66,'filler22'); -insert into t values (67,'filler22'); -insert into t values (68,'filler22'); -insert into t values (69,'filler23'); -insert into t values (70,'filler23'); -insert into t values (71,'filler23'); -insert into t values (72,'filler24'); -insert into t values (73,'filler24'); -insert into t values (74,'filler24'); -insert into t values (75,'filler25'); -insert into t values (76,'filler25'); -insert into t values (77,'filler25'); -insert into t values (78,'filler26'); -insert into t values (79,'filler26'); -insert into t values (80,'filler26'); -insert into t values (81,'filler27'); -insert into t values (82,'filler27'); -insert into t values (83,'filler27'); -insert into t values (84,'filler28'); -insert into t values (85,'filler28'); -insert into t values (86,'filler28'); -insert into t values (87,'filler29'); -insert into t values (88,'filler29'); -insert into t values (89,'filler29'); -insert into t values (90,'filler30'); -insert into t values (91,'filler30'); -insert into t values (92,'filler30'); -insert into t values (93,'filler31'); -insert into t values (94,'filler31'); -insert into t values (95,'filler31'); -insert into t values (96,'filler32'); -insert into t values (97,'filler32'); -insert into t values (98,'filler32'); -insert into t values (99,'filler33'); +insert into t values (0,'filler0'), (1,'filler0'), (2,'filler0'), (3,'filler1'), (4,'filler1'), (5,'filler1'), (6,'filler2'), (7,'filler2'), (8,'filler2'), (9,'filler3'), (10,'filler3'), (11,'filler3'), (12,'filler4'), (13,'filler4'), (14,'filler4'), (15,'filler5'), (16,'filler5'), (17,'filler5'), (18,'filler6'), (19,'filler6'), (20,'filler6'), (21,'filler7'), (22,'filler7'), (23,'filler7'), (24,'filler8'), (25,'filler8'), (26,'filler8'), (27,'filler9'), (28,'filler9'), (29,'filler9'), (30,'filler10'), (31,'filler10'), (32,'filler10'), (33,'filler11'), (34,'filler11'), (35,'filler11'), (36,'filler12'), (37,'filler12'), (38,'filler12'), (39,'filler13'), (40,'filler13'), (41,'filler13'), (42,'filler14'), (43,'filler14'), (44,'filler14'), (45,'filler15'), (46,'filler15'), (47,'filler15'), (48,'filler16'), (49,'filler16'), (50,'filler16'), (51,'filler17'), (52,'filler17'), (53,'filler17'), (54,'filler18'), (55,'filler18'), (56,'filler18'), (57,'filler19'), (58,'filler19'), (59,'filler19'), (60,'filler20'), (61,'filler20'), (62,'filler20'), (63,'filler21'), (64,'filler21'), (65,'filler21'), (66,'filler22'), (67,'filler22'), (68,'filler22'), (69,'filler23'), (70,'filler23'), (71,'filler23'), (72,'filler24'), (73,'filler24'), (74,'filler24'), (75,'filler25'), (76,'filler25'), (77,'filler25'), (78,'filler26'), (79,'filler26'), (80,'filler26'), (81,'filler27'), (82,'filler27'), (83,'filler27'), (84,'filler28'), (85,'filler28'), (86,'filler28'), (87,'filler29'), (88,'filler29'), (89,'filler29'), (90,'filler30'), (91,'filler30'), (92,'filler30'), (93,'filler31'), (94,'filler31'), (95,'filler31'), (96,'filler32'), (97,'filler32'), (98,'filler32'), (99,'filler33'); alter table t partition by range (a) (partition p0 values less than (1000000), partition p1 values less than (2000000), partition pMax values less than (maxvalue)); show warnings; show create table t; @@ -269,3 +170,4 @@ alter table child_with_partition exchange partition p1 with table child; alter table child drop foreign key fk_1; alter table child drop key fk_1; alter table child_with_partition exchange partition p1 with table child; + From c1316ad6f1b6e597c7caca527f22d08b9191d802 Mon Sep 17 00:00:00 2001 From: Jason Mo Date: Fri, 17 May 2024 14:56:53 +0800 Subject: [PATCH 2/5] update db_partition --- .../integrationtest/r/ddl/db_partition.result | 168 +-------------- .../r/executor/executor.result | 202 +----------------- tests/integrationtest/t/ddl/db_partition.test | 162 +------------- .../integrationtest/t/executor/executor.test | 202 +----------------- 4 files changed, 11 insertions(+), 723 deletions(-) diff --git a/tests/integrationtest/r/ddl/db_partition.result b/tests/integrationtest/r/ddl/db_partition.result index f7897f467f9a2..b8d643774e071 100644 --- a/tests/integrationtest/r/ddl/db_partition.result +++ b/tests/integrationtest/r/ddl/db_partition.result @@ -1538,36 +1538,7 @@ signed date ) partition by hash( month(signed) ) partitions 12; -insert into t values (0, "Joe", "Doe", from_days(738974 + 0)); -insert into t values (1, "Joe", "Doe", from_days(738974 + 3)); -insert into t values (2, "Joe", "Doe", from_days(738974 + 6)); -insert into t values (3, "Joe", "Doe", from_days(738974 + 9)); -insert into t values (4, "Joe", "Doe", from_days(738974 + 12)); -insert into t values (5, "Joe", "Doe", from_days(738974 + 15)); -insert into t values (6, "Joe", "Doe", from_days(738974 + 18)); -insert into t values (7, "Joe", "Doe", from_days(738974 + 21)); -insert into t values (8, "Joe", "Doe", from_days(738974 + 24)); -insert into t values (9, "Joe", "Doe", from_days(738974 + 27)); -insert into t values (10, "Joe", "Doe", from_days(738974 + 30)); -insert into t values (11, "Joe", "Doe", from_days(738974 + 33)); -insert into t values (12, "Joe", "Doe", from_days(738974 + 36)); -insert into t values (13, "Joe", "Doe", from_days(738974 + 39)); -insert into t values (14, "Joe", "Doe", from_days(738974 + 42)); -insert into t values (15, "Joe", "Doe", from_days(738974 + 45)); -insert into t values (16, "Joe", "Doe", from_days(738974 + 48)); -insert into t values (17, "Joe", "Doe", from_days(738974 + 51)); -insert into t values (18, "Joe", "Doe", from_days(738974 + 54)); -insert into t values (19, "Joe", "Doe", from_days(738974 + 57)); -insert into t values (20, "Joe", "Doe", from_days(738974 + 60)); -insert into t values (21, "Joe", "Doe", from_days(738974 + 63)); -insert into t values (22, "Joe", "Doe", from_days(738974 + 66)); -insert into t values (23, "Joe", "Doe", from_days(738974 + 69)); -insert into t values (24, "Joe", "Doe", from_days(738974 + 72)); -insert into t values (25, "Joe", "Doe", from_days(738974 + 75)); -insert into t values (26, "Joe", "Doe", from_days(738974 + 78)); -insert into t values (27, "Joe", "Doe", from_days(738974 + 81)); -insert into t values (28, "Joe", "Doe", from_days(738974 + 84)); -insert into t values (29, "Joe", "Doe", from_days(738974 + 87)); +insert into t values (0, "Joe", "Doe", from_days(738974 + 0)), (1, "Joe", "Doe", from_days(738974 + 3)), (2, "Joe", "Doe", from_days(738974 + 6)), (3, "Joe", "Doe", from_days(738974 + 9)), (4, "Joe", "Doe", from_days(738974 + 12)), (5, "Joe", "Doe", from_days(738974 + 15)), (6, "Joe", "Doe", from_days(738974 + 18)), (7, "Joe", "Doe", from_days(738974 + 21)), (8, "Joe", "Doe", from_days(738974 + 24)), (9, "Joe", "Doe", from_days(738974 + 27)), (10, "Joe", "Doe", from_days(738974 + 30)), (11, "Joe", "Doe", from_days(738974 + 33)), (12, "Joe", "Doe", from_days(738974 + 36)), (13, "Joe", "Doe", from_days(738974 + 39)), (14, "Joe", "Doe", from_days(738974 + 42)), (15, "Joe", "Doe", from_days(738974 + 45)), (16, "Joe", "Doe", from_days(738974 + 48)), (17, "Joe", "Doe", from_days(738974 + 51)), (18, "Joe", "Doe", from_days(738974 + 54)), (19, "Joe", "Doe", from_days(738974 + 57)), (20, "Joe", "Doe", from_days(738974 + 60)), (21, "Joe", "Doe", from_days(738974 + 63)), (22, "Joe", "Doe", from_days(738974 + 66)), (23, "Joe", "Doe", from_days(738974 + 69)), (24, "Joe", "Doe", from_days(738974 + 72)), (25, "Joe", "Doe", from_days(738974 + 75)), (26, "Joe", "Doe", from_days(738974 + 78)), (27, "Joe", "Doe", from_days(738974 + 81)), (28, "Joe", "Doe", from_days(738974 + 84)), (29, "Joe", "Doe", from_days(738974 + 87)); alter table t coalesce partition 4; show create table t; Table Create Table @@ -1608,36 +1579,7 @@ signed date ) partition by key(signed,fname) partitions 12; -insert into t values (0, "Joe", "Doe", from_days(738974 + 0)); -insert into t values (1, "Joe", "Doe", from_days(738974 + 3)); -insert into t values (2, "Joe", "Doe", from_days(738974 + 6)); -insert into t values (3, "Joe", "Doe", from_days(738974 + 9)); -insert into t values (4, "Joe", "Doe", from_days(738974 + 12)); -insert into t values (5, "Joe", "Doe", from_days(738974 + 15)); -insert into t values (6, "Joe", "Doe", from_days(738974 + 18)); -insert into t values (7, "Joe", "Doe", from_days(738974 + 21)); -insert into t values (8, "Joe", "Doe", from_days(738974 + 24)); -insert into t values (9, "Joe", "Doe", from_days(738974 + 27)); -insert into t values (10, "Joe", "Doe", from_days(738974 + 30)); -insert into t values (11, "Joe", "Doe", from_days(738974 + 33)); -insert into t values (12, "Joe", "Doe", from_days(738974 + 36)); -insert into t values (13, "Joe", "Doe", from_days(738974 + 39)); -insert into t values (14, "Joe", "Doe", from_days(738974 + 42)); -insert into t values (15, "Joe", "Doe", from_days(738974 + 45)); -insert into t values (16, "Joe", "Doe", from_days(738974 + 48)); -insert into t values (17, "Joe", "Doe", from_days(738974 + 51)); -insert into t values (18, "Joe", "Doe", from_days(738974 + 54)); -insert into t values (19, "Joe", "Doe", from_days(738974 + 57)); -insert into t values (20, "Joe", "Doe", from_days(738974 + 60)); -insert into t values (21, "Joe", "Doe", from_days(738974 + 63)); -insert into t values (22, "Joe", "Doe", from_days(738974 + 66)); -insert into t values (23, "Joe", "Doe", from_days(738974 + 69)); -insert into t values (24, "Joe", "Doe", from_days(738974 + 72)); -insert into t values (25, "Joe", "Doe", from_days(738974 + 75)); -insert into t values (26, "Joe", "Doe", from_days(738974 + 78)); -insert into t values (27, "Joe", "Doe", from_days(738974 + 81)); -insert into t values (28, "Joe", "Doe", from_days(738974 + 84)); -insert into t values (29, "Joe", "Doe", from_days(738974 + 87)); +insert into t values (0, "Joe", "Doe", from_days(738974 + 0)), (1, "Joe", "Doe", from_days(738974 + 3)), (2, "Joe", "Doe", from_days(738974 + 6)), (3, "Joe", "Doe", from_days(738974 + 9)), (4, "Joe", "Doe", from_days(738974 + 12)), (5, "Joe", "Doe", from_days(738974 + 15)), (6, "Joe", "Doe", from_days(738974 + 18)), (7, "Joe", "Doe", from_days(738974 + 21)), (8, "Joe", "Doe", from_days(738974 + 24)), (9, "Joe", "Doe", from_days(738974 + 27)), (10, "Joe", "Doe", from_days(738974 + 30)), (11, "Joe", "Doe", from_days(738974 + 33)), (12, "Joe", "Doe", from_days(738974 + 36)), (13, "Joe", "Doe", from_days(738974 + 39)), (14, "Joe", "Doe", from_days(738974 + 42)), (15, "Joe", "Doe", from_days(738974 + 45)), (16, "Joe", "Doe", from_days(738974 + 48)), (17, "Joe", "Doe", from_days(738974 + 51)), (18, "Joe", "Doe", from_days(738974 + 54)), (19, "Joe", "Doe", from_days(738974 + 57)), (20, "Joe", "Doe", from_days(738974 + 60)), (21, "Joe", "Doe", from_days(738974 + 63)), (22, "Joe", "Doe", from_days(738974 + 66)), (23, "Joe", "Doe", from_days(738974 + 69)), (24, "Joe", "Doe", from_days(738974 + 72)), (25, "Joe", "Doe", from_days(738974 + 75)), (26, "Joe", "Doe", from_days(738974 + 78)), (27, "Joe", "Doe", from_days(738974 + 81)), (28, "Joe", "Doe", from_days(738974 + 84)), (29, "Joe", "Doe", from_days(738974 + 87)); alter table t coalesce partition 4; show create table t; Table Create Table @@ -1687,13 +1629,9 @@ insert into t select id + 4, fname, lname, hired, separated, job_code, store_id insert into t select id + 8, fname, lname, hired, separated, job_code, store_id + 8 from t; insert into t select id + 16, fname, lname, hired, separated, job_code, store_id + 16 from t; insert into t select id + 32, fname, lname, hired, separated, job_code, store_id + 32 from t; -insert into t select id + 64, fname, lname, hired, separated, job_code, store_id + 64 from t; -insert into t select id + 128, fname, lname, hired, separated, job_code, store_id + 128 from t; -insert into t select id + 256, fname, lname, hired, separated, job_code, store_id + 256 from t; -insert into t select id + 512, fname, lname, hired, separated, job_code, store_id + 512 from t; select sum(store_id), avg(store_id), max(store_id), min(store_id), sum(id) from t; sum(store_id) avg(store_id) max(store_id) min(store_id) sum(id) -524800 512.5000 1024 1 524800 +2080 32.5000 64 1 2080 alter table t add partition (partition pHist history); Error 1480 (HY000): Only SYSTEM_TIME PARTITIONING can use VALUES HISTORY in partition definition alter table t add partition (partition pList values in (22)); @@ -1703,7 +1641,7 @@ Error 1480 (HY000): Only RANGE PARTITIONING can use VALUES LESS THAN in partitio insert into t values (20, "Joe", "Doe", '2020-01-05', null, 1,1), (21, "Jane", "Doe", '2021-07-05', null, 2,1); select sum(store_id), avg(store_id), max(store_id), min(store_id), sum(id) from t; sum(store_id) avg(store_id) max(store_id) min(store_id) sum(id) -524802 511.5029 1024 1 524841 +2082 31.5455 64 1 2121 alter table t add partition partitions 8; show create table t; Table Create Table @@ -1840,7 +1778,7 @@ t CREATE TABLE `t` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![placement] PLACEMENT POLICY=`fourreplicas` */ select sum(store_id), avg(store_id), max(store_id), min(store_id), sum(id) from t; sum(store_id) avg(store_id) max(store_id) min(store_id) sum(id) -524802 511.5029 1024 1 524841 +2082 31.5455 64 1 2121 alter table t placement policy default; drop placement policy tworeplicas; drop placement policy threereplicas; @@ -3057,101 +2995,7 @@ tRange CREATE TABLE `tRange` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin drop table if exists t; create table t (a int, b varchar(255), key (a,b), key (b)) partition by hash (a) partitions 7; -insert into t values (32,char(32,32,32,32)); -insert into t values (33,char(33,33,33,33)); -insert into t values (34,char(34,34,34,34)); -insert into t values (35,char(35,35,35,35)); -insert into t values (36,char(36,36,36,36)); -insert into t values (37,char(37,37,37,37)); -insert into t values (38,char(38,38,38,38)); -insert into t values (39,char(39,39,39,39)); -insert into t values (40,char(40,40,40,40)); -insert into t values (41,char(41,41,41,41)); -insert into t values (42,char(42,42,42,42)); -insert into t values (43,char(43,43,43,43)); -insert into t values (44,char(44,44,44,44)); -insert into t values (45,char(45,45,45,45)); -insert into t values (46,char(46,46,46,46)); -insert into t values (47,char(47,47,47,47)); -insert into t values (48,char(48,48,48,48)); -insert into t values (49,char(49,49,49,49)); -insert into t values (50,char(50,50,50,50)); -insert into t values (51,char(51,51,51,51)); -insert into t values (52,char(52,52,52,52)); -insert into t values (53,char(53,53,53,53)); -insert into t values (54,char(54,54,54,54)); -insert into t values (55,char(55,55,55,55)); -insert into t values (56,char(56,56,56,56)); -insert into t values (57,char(57,57,57,57)); -insert into t values (58,char(58,58,58,58)); -insert into t values (59,char(59,59,59,59)); -insert into t values (60,char(60,60,60,60)); -insert into t values (61,char(61,61,61,61)); -insert into t values (62,char(62,62,62,62)); -insert into t values (63,char(63,63,63,63)); -insert into t values (64,char(64,64,64,64)); -insert into t values (65,char(65,65,65,65)); -insert into t values (66,char(66,66,66,66)); -insert into t values (67,char(67,67,67,67)); -insert into t values (68,char(68,68,68,68)); -insert into t values (69,char(69,69,69,69)); -insert into t values (70,char(70,70,70,70)); -insert into t values (71,char(71,71,71,71)); -insert into t values (72,char(72,72,72,72)); -insert into t values (73,char(73,73,73,73)); -insert into t values (74,char(74,74,74,74)); -insert into t values (75,char(75,75,75,75)); -insert into t values (76,char(76,76,76,76)); -insert into t values (77,char(77,77,77,77)); -insert into t values (78,char(78,78,78,78)); -insert into t values (79,char(79,79,79,79)); -insert into t values (80,char(80,80,80,80)); -insert into t values (81,char(81,81,81,81)); -insert into t values (82,char(82,82,82,82)); -insert into t values (83,char(83,83,83,83)); -insert into t values (84,char(84,84,84,84)); -insert into t values (85,char(85,85,85,85)); -insert into t values (86,char(86,86,86,86)); -insert into t values (87,char(87,87,87,87)); -insert into t values (88,char(88,88,88,88)); -insert into t values (89,char(89,89,89,89)); -insert into t values (90,char(90,90,90,90)); -insert into t values (91,char(91,91,91,91)); -insert into t values (92,char(92,92,92,92)); -insert into t values (93,char(93,93,93,93)); -insert into t values (94,char(94,94,94,94)); -insert into t values (95,char(95,95,95,95)); -insert into t values (96,char(96,96,96,96)); -insert into t values (97,char(97,97,97,97)); -insert into t values (98,char(98,98,98,98)); -insert into t values (99,char(99,99,99,99)); -insert into t values (100,char(100,100,100,100)); -insert into t values (101,char(101,101,101,101)); -insert into t values (102,char(102,102,102,102)); -insert into t values (103,char(103,103,103,103)); -insert into t values (104,char(104,104,104,104)); -insert into t values (105,char(105,105,105,105)); -insert into t values (106,char(106,106,106,106)); -insert into t values (107,char(107,107,107,107)); -insert into t values (108,char(108,108,108,108)); -insert into t values (109,char(109,109,109,109)); -insert into t values (110,char(110,110,110,110)); -insert into t values (111,char(111,111,111,111)); -insert into t values (112,char(112,112,112,112)); -insert into t values (113,char(113,113,113,113)); -insert into t values (114,char(114,114,114,114)); -insert into t values (115,char(115,115,115,115)); -insert into t values (116,char(116,116,116,116)); -insert into t values (117,char(117,117,117,117)); -insert into t values (118,char(118,118,118,118)); -insert into t values (119,char(119,119,119,119)); -insert into t values (120,char(120,120,120,120)); -insert into t values (121,char(121,121,121,121)); -insert into t values (122,char(122,122,122,122)); -insert into t values (123,char(123,123,123,123)); -insert into t values (124,char(124,124,124,124)); -insert into t values (125,char(125,125,125,125)); -insert into t values (126,char(126,126,126,126)); +insert into t values (32,char(32,32,32,32)), (33,char(33,33,33,33)), (34,char(34,34,34,34)), (35,char(35,35,35,35)), (36,char(36,36,36,36)), (37,char(37,37,37,37)), (38,char(38,38,38,38)), (39,char(39,39,39,39)), (40,char(40,40,40,40)), (41,char(41,41,41,41)), (42,char(42,42,42,42)), (43,char(43,43,43,43)), (44,char(44,44,44,44)), (45,char(45,45,45,45)), (46,char(46,46,46,46)), (47,char(47,47,47,47)), (48,char(48,48,48,48)), (49,char(49,49,49,49)), (50,char(50,50,50,50)), (51,char(51,51,51,51)), (52,char(52,52,52,52)), (53,char(53,53,53,53)), (54,char(54,54,54,54)), (55,char(55,55,55,55)), (56,char(56,56,56,56)), (57,char(57,57,57,57)), (58,char(58,58,58,58)), (59,char(59,59,59,59)), (60,char(60,60,60,60)), (61,char(61,61,61,61)), (62,char(62,62,62,62)), (63,char(63,63,63,63)), (64,char(64,64,64,64)), (65,char(65,65,65,65)), (66,char(66,66,66,66)), (67,char(67,67,67,67)), (68,char(68,68,68,68)), (69,char(69,69,69,69)), (70,char(70,70,70,70)), (71,char(71,71,71,71)), (72,char(72,72,72,72)), (73,char(73,73,73,73)), (74,char(74,74,74,74)), (75,char(75,75,75,75)), (76,char(76,76,76,76)), (77,char(77,77,77,77)), (78,char(78,78,78,78)), (79,char(79,79,79,79)), (80,char(80,80,80,80)), (81,char(81,81,81,81)), (82,char(82,82,82,82)), (83,char(83,83,83,83)), (84,char(84,84,84,84)), (85,char(85,85,85,85)), (86,char(86,86,86,86)), (87,char(87,87,87,87)), (88,char(88,88,88,88)), (89,char(89,89,89,89)), (90,char(90,90,90,90)), (91,char(91,91,91,91)), (92,char(92,92,92,92)), (93,char(93,93,93,93)), (94,char(94,94,94,94)), (95,char(95,95,95,95)), (96,char(96,96,96,96)), (97,char(97,97,97,97)), (98,char(98,98,98,98)), (99,char(99,99,99,99)), (100,char(100,100,100,100)), (101,char(101,101,101,101)), (102,char(102,102,102,102)), (103,char(103,103,103,103)), (104,char(104,104,104,104)), (105,char(105,105,105,105)), (106,char(106,106,106,106)), (107,char(107,107,107,107)), (108,char(108,108,108,108)), (109,char(109,109,109,109)), (110,char(110,110,110,110)), (111,char(111,111,111,111)), (112,char(112,112,112,112)), (113,char(113,113,113,113)), (114,char(114,114,114,114)), (115,char(115,115,115,115)), (116,char(116,116,116,116)), (117,char(117,117,117,117)), (118,char(118,118,118,118)), (119,char(119,119,119,119)), (120,char(120,120,120,120)), (121,char(121,121,121,121)), (122,char(122,122,122,122)), (123,char(123,123,123,123)), (124,char(124,124,124,124)), (125,char(125,125,125,125)), (126,char(126,126,126,126)); analyze table t; select partition_name, table_rows from information_schema.partitions where table_schema = 'ddl__db_partition' and table_name = 't'; partition_name table_rows diff --git a/tests/integrationtest/r/executor/executor.result b/tests/integrationtest/r/executor/executor.result index 4da5e76bb7746..848fa5fe92096 100644 --- a/tests/integrationtest/r/executor/executor.result +++ b/tests/integrationtest/r/executor/executor.result @@ -1442,207 +1442,7 @@ select * from test having (select 1, 1); Error 1146 (42S02): Table 'executor__executor.test' doesn't exist drop table if exists t; create table t (c1 int primary key, c2 int, key c (c2)); -insert t values(0, 0); -insert t values(1, 1); -insert t values(2, 2); -insert t values(3, 3); -insert t values(4, 4); -insert t values(5, 5); -insert t values(6, 6); -insert t values(7, 7); -insert t values(8, 8); -insert t values(9, 9); -insert t values(10, 10); -insert t values(11, 11); -insert t values(12, 12); -insert t values(13, 13); -insert t values(14, 14); -insert t values(15, 15); -insert t values(16, 16); -insert t values(17, 17); -insert t values(18, 18); -insert t values(19, 19); -insert t values(20, 20); -insert t values(21, 21); -insert t values(22, 22); -insert t values(23, 23); -insert t values(24, 24); -insert t values(25, 25); -insert t values(26, 26); -insert t values(27, 27); -insert t values(28, 28); -insert t values(29, 29); -insert t values(30, 30); -insert t values(31, 31); -insert t values(32, 32); -insert t values(33, 33); -insert t values(34, 34); -insert t values(35, 35); -insert t values(36, 36); -insert t values(37, 37); -insert t values(38, 38); -insert t values(39, 39); -insert t values(40, 40); -insert t values(41, 41); -insert t values(42, 42); -insert t values(43, 43); -insert t values(44, 44); -insert t values(45, 45); -insert t values(46, 46); -insert t values(47, 47); -insert t values(48, 48); -insert t values(49, 49); -insert t values(50, 50); -insert t values(51, 51); -insert t values(52, 52); -insert t values(53, 53); -insert t values(54, 54); -insert t values(55, 55); -insert t values(56, 56); -insert t values(57, 57); -insert t values(58, 58); -insert t values(59, 59); -insert t values(60, 60); -insert t values(61, 61); -insert t values(62, 62); -insert t values(63, 63); -insert t values(64, 64); -insert t values(65, 65); -insert t values(66, 66); -insert t values(67, 67); -insert t values(68, 68); -insert t values(69, 69); -insert t values(70, 70); -insert t values(71, 71); -insert t values(72, 72); -insert t values(73, 73); -insert t values(74, 74); -insert t values(75, 75); -insert t values(76, 76); -insert t values(77, 77); -insert t values(78, 78); -insert t values(79, 79); -insert t values(80, 80); -insert t values(81, 81); -insert t values(82, 82); -insert t values(83, 83); -insert t values(84, 84); -insert t values(85, 85); -insert t values(86, 86); -insert t values(87, 87); -insert t values(88, 88); -insert t values(89, 89); -insert t values(90, 90); -insert t values(91, 91); -insert t values(92, 92); -insert t values(93, 93); -insert t values(94, 94); -insert t values(95, 95); -insert t values(96, 96); -insert t values(97, 97); -insert t values(98, 98); -insert t values(99, 99); -insert t values(100, 100); -insert t values(101, 101); -insert t values(102, 102); -insert t values(103, 103); -insert t values(104, 104); -insert t values(105, 105); -insert t values(106, 106); -insert t values(107, 107); -insert t values(108, 108); -insert t values(109, 109); -insert t values(110, 110); -insert t values(111, 111); -insert t values(112, 112); -insert t values(113, 113); -insert t values(114, 114); -insert t values(115, 115); -insert t values(116, 116); -insert t values(117, 117); -insert t values(118, 118); -insert t values(119, 119); -insert t values(120, 120); -insert t values(121, 121); -insert t values(122, 122); -insert t values(123, 123); -insert t values(124, 124); -insert t values(125, 125); -insert t values(126, 126); -insert t values(127, 127); -insert t values(128, 128); -insert t values(129, 129); -insert t values(130, 130); -insert t values(131, 131); -insert t values(132, 132); -insert t values(133, 133); -insert t values(134, 134); -insert t values(135, 135); -insert t values(136, 136); -insert t values(137, 137); -insert t values(138, 138); -insert t values(139, 139); -insert t values(140, 140); -insert t values(141, 141); -insert t values(142, 142); -insert t values(143, 143); -insert t values(144, 144); -insert t values(145, 145); -insert t values(146, 146); -insert t values(147, 147); -insert t values(148, 148); -insert t values(149, 149); -insert t values(150, 150); -insert t values(151, 151); -insert t values(152, 152); -insert t values(153, 153); -insert t values(154, 154); -insert t values(155, 155); -insert t values(156, 156); -insert t values(157, 157); -insert t values(158, 158); -insert t values(159, 159); -insert t values(160, 160); -insert t values(161, 161); -insert t values(162, 162); -insert t values(163, 163); -insert t values(164, 164); -insert t values(165, 165); -insert t values(166, 166); -insert t values(167, 167); -insert t values(168, 168); -insert t values(169, 169); -insert t values(170, 170); -insert t values(171, 171); -insert t values(172, 172); -insert t values(173, 173); -insert t values(174, 174); -insert t values(175, 175); -insert t values(176, 176); -insert t values(177, 177); -insert t values(178, 178); -insert t values(179, 179); -insert t values(180, 180); -insert t values(181, 181); -insert t values(182, 182); -insert t values(183, 183); -insert t values(184, 184); -insert t values(185, 185); -insert t values(186, 186); -insert t values(187, 187); -insert t values(188, 188); -insert t values(189, 189); -insert t values(190, 190); -insert t values(191, 191); -insert t values(192, 192); -insert t values(193, 193); -insert t values(194, 194); -insert t values(195, 195); -insert t values(196, 196); -insert t values(197, 197); -insert t values(198, 198); -insert t values(199, 199); -insert t values(200, 200); +insert t values(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12), (13, 13), (14, 14), (15, 15), (16, 16), (17, 17), (18, 18), (19, 19), (20, 20), (21, 21), (22, 22), (23, 23), (24, 24), (25, 25), (26, 26), (27, 27), (28, 28), (29, 29), (30, 30), (31, 31), (32, 32), (33, 33), (34, 34), (35, 35), (36, 36), (37, 37), (38, 38), (39, 39), (40, 40), (41, 41), (42, 42), (43, 43), (44, 44), (45, 45), (46, 46), (47, 47), (48, 48), (49, 49), (50, 50), (51, 51), (52, 52), (53, 53), (54, 54), (55, 55), (56, 56), (57, 57), (58, 58), (59, 59), (60, 60), (61, 61), (62, 62), (63, 63), (64, 64), (65, 65), (66, 66), (67, 67), (68, 68), (69, 69), (70, 70), (71, 71), (72, 72), (73, 73), (74, 74), (75, 75), (76, 76), (77, 77), (78, 78), (79, 79), (80, 80), (81, 81), (82, 82), (83, 83), (84, 84), (85, 85), (86, 86), (87, 87), (88, 88), (89, 89), (90, 90), (91, 91), (92, 92), (93, 93), (94, 94), (95, 95), (96, 96), (97, 97), (98, 98), (99, 99), (100, 100), (101, 101), (102, 102), (103, 103), (104, 104), (105, 105), (106, 106), (107, 107), (108, 108), (109, 109), (110, 110), (111, 111), (112, 112), (113, 113), (114, 114), (115, 115), (116, 116), (117, 117), (118, 118), (119, 119), (120, 120), (121, 121), (122, 122), (123, 123), (124, 124), (125, 125), (126, 126), (127, 127), (128, 128), (129, 129), (130, 130), (131, 131), (132, 132), (133, 133), (134, 134), (135, 135), (136, 136), (137, 137), (138, 138), (139, 139), (140, 140), (141, 141), (142, 142), (143, 143), (144, 144), (145, 145), (146, 146), (147, 147), (148, 148), (149, 149), (150, 150), (151, 151), (152, 152), (153, 153), (154, 154), (155, 155), (156, 156), (157, 157), (158, 158), (159, 159), (160, 160), (161, 161), (162, 162), (163, 163), (164, 164), (165, 165), (166, 166), (167, 167), (168, 168), (169, 169), (170, 170), (171, 171), (172, 172), (173, 173), (174, 174), (175, 175), (176, 176), (177, 177), (178, 178), (179, 179), (180, 180), (181, 181), (182, 182), (183, 183), (184, 184), (185, 185), (186, 186), (187, 187), (188, 188), (189, 189), (190, 190), (191, 191), (192, 192), (193, 193), (194, 194), (195, 195), (196, 196), (197, 197), (198, 198), (199, 199), (200, 200); select c2 from t where c1 in ('7', '10', '112', '111', '98', '106', '100', '9', '18', '17') order by c2; c2 7 diff --git a/tests/integrationtest/t/ddl/db_partition.test b/tests/integrationtest/t/ddl/db_partition.test index 16079fbb88620..67502dad6aa22 100644 --- a/tests/integrationtest/t/ddl/db_partition.test +++ b/tests/integrationtest/t/ddl/db_partition.test @@ -1120,36 +1120,7 @@ create table t ( ) partition by hash( month(signed) ) partitions 12; -insert into t values (0, "Joe", "Doe", from_days(738974 + 0)); -insert into t values (1, "Joe", "Doe", from_days(738974 + 3)); -insert into t values (2, "Joe", "Doe", from_days(738974 + 6)); -insert into t values (3, "Joe", "Doe", from_days(738974 + 9)); -insert into t values (4, "Joe", "Doe", from_days(738974 + 12)); -insert into t values (5, "Joe", "Doe", from_days(738974 + 15)); -insert into t values (6, "Joe", "Doe", from_days(738974 + 18)); -insert into t values (7, "Joe", "Doe", from_days(738974 + 21)); -insert into t values (8, "Joe", "Doe", from_days(738974 + 24)); -insert into t values (9, "Joe", "Doe", from_days(738974 + 27)); -insert into t values (10, "Joe", "Doe", from_days(738974 + 30)); -insert into t values (11, "Joe", "Doe", from_days(738974 + 33)); -insert into t values (12, "Joe", "Doe", from_days(738974 + 36)); -insert into t values (13, "Joe", "Doe", from_days(738974 + 39)); -insert into t values (14, "Joe", "Doe", from_days(738974 + 42)); -insert into t values (15, "Joe", "Doe", from_days(738974 + 45)); -insert into t values (16, "Joe", "Doe", from_days(738974 + 48)); -insert into t values (17, "Joe", "Doe", from_days(738974 + 51)); -insert into t values (18, "Joe", "Doe", from_days(738974 + 54)); -insert into t values (19, "Joe", "Doe", from_days(738974 + 57)); -insert into t values (20, "Joe", "Doe", from_days(738974 + 60)); -insert into t values (21, "Joe", "Doe", from_days(738974 + 63)); -insert into t values (22, "Joe", "Doe", from_days(738974 + 66)); -insert into t values (23, "Joe", "Doe", from_days(738974 + 69)); -insert into t values (24, "Joe", "Doe", from_days(738974 + 72)); -insert into t values (25, "Joe", "Doe", from_days(738974 + 75)); -insert into t values (26, "Joe", "Doe", from_days(738974 + 78)); -insert into t values (27, "Joe", "Doe", from_days(738974 + 81)); -insert into t values (28, "Joe", "Doe", from_days(738974 + 84)); -insert into t values (29, "Joe", "Doe", from_days(738974 + 87)); +insert into t values (0, "Joe", "Doe", from_days(738974 + 0)), (1, "Joe", "Doe", from_days(738974 + 3)), (2, "Joe", "Doe", from_days(738974 + 6)), (3, "Joe", "Doe", from_days(738974 + 9)), (4, "Joe", "Doe", from_days(738974 + 12)), (5, "Joe", "Doe", from_days(738974 + 15)), (6, "Joe", "Doe", from_days(738974 + 18)), (7, "Joe", "Doe", from_days(738974 + 21)), (8, "Joe", "Doe", from_days(738974 + 24)), (9, "Joe", "Doe", from_days(738974 + 27)), (10, "Joe", "Doe", from_days(738974 + 30)), (11, "Joe", "Doe", from_days(738974 + 33)), (12, "Joe", "Doe", from_days(738974 + 36)), (13, "Joe", "Doe", from_days(738974 + 39)), (14, "Joe", "Doe", from_days(738974 + 42)), (15, "Joe", "Doe", from_days(738974 + 45)), (16, "Joe", "Doe", from_days(738974 + 48)), (17, "Joe", "Doe", from_days(738974 + 51)), (18, "Joe", "Doe", from_days(738974 + 54)), (19, "Joe", "Doe", from_days(738974 + 57)), (20, "Joe", "Doe", from_days(738974 + 60)), (21, "Joe", "Doe", from_days(738974 + 63)), (22, "Joe", "Doe", from_days(738974 + 66)), (23, "Joe", "Doe", from_days(738974 + 69)), (24, "Joe", "Doe", from_days(738974 + 72)), (25, "Joe", "Doe", from_days(738974 + 75)), (26, "Joe", "Doe", from_days(738974 + 78)), (27, "Joe", "Doe", from_days(738974 + 81)), (28, "Joe", "Doe", from_days(738974 + 84)), (29, "Joe", "Doe", from_days(738974 + 87)); alter table t coalesce partition 4; show create table t; analyze table t; @@ -1165,36 +1136,7 @@ create table t ( ) partition by key(signed,fname) partitions 12; -insert into t values (0, "Joe", "Doe", from_days(738974 + 0)); -insert into t values (1, "Joe", "Doe", from_days(738974 + 3)); -insert into t values (2, "Joe", "Doe", from_days(738974 + 6)); -insert into t values (3, "Joe", "Doe", from_days(738974 + 9)); -insert into t values (4, "Joe", "Doe", from_days(738974 + 12)); -insert into t values (5, "Joe", "Doe", from_days(738974 + 15)); -insert into t values (6, "Joe", "Doe", from_days(738974 + 18)); -insert into t values (7, "Joe", "Doe", from_days(738974 + 21)); -insert into t values (8, "Joe", "Doe", from_days(738974 + 24)); -insert into t values (9, "Joe", "Doe", from_days(738974 + 27)); -insert into t values (10, "Joe", "Doe", from_days(738974 + 30)); -insert into t values (11, "Joe", "Doe", from_days(738974 + 33)); -insert into t values (12, "Joe", "Doe", from_days(738974 + 36)); -insert into t values (13, "Joe", "Doe", from_days(738974 + 39)); -insert into t values (14, "Joe", "Doe", from_days(738974 + 42)); -insert into t values (15, "Joe", "Doe", from_days(738974 + 45)); -insert into t values (16, "Joe", "Doe", from_days(738974 + 48)); -insert into t values (17, "Joe", "Doe", from_days(738974 + 51)); -insert into t values (18, "Joe", "Doe", from_days(738974 + 54)); -insert into t values (19, "Joe", "Doe", from_days(738974 + 57)); -insert into t values (20, "Joe", "Doe", from_days(738974 + 60)); -insert into t values (21, "Joe", "Doe", from_days(738974 + 63)); -insert into t values (22, "Joe", "Doe", from_days(738974 + 66)); -insert into t values (23, "Joe", "Doe", from_days(738974 + 69)); -insert into t values (24, "Joe", "Doe", from_days(738974 + 72)); -insert into t values (25, "Joe", "Doe", from_days(738974 + 75)); -insert into t values (26, "Joe", "Doe", from_days(738974 + 78)); -insert into t values (27, "Joe", "Doe", from_days(738974 + 81)); -insert into t values (28, "Joe", "Doe", from_days(738974 + 84)); -insert into t values (29, "Joe", "Doe", from_days(738974 + 87)); +insert into t values (0, "Joe", "Doe", from_days(738974 + 0)), (1, "Joe", "Doe", from_days(738974 + 3)), (2, "Joe", "Doe", from_days(738974 + 6)), (3, "Joe", "Doe", from_days(738974 + 9)), (4, "Joe", "Doe", from_days(738974 + 12)), (5, "Joe", "Doe", from_days(738974 + 15)), (6, "Joe", "Doe", from_days(738974 + 18)), (7, "Joe", "Doe", from_days(738974 + 21)), (8, "Joe", "Doe", from_days(738974 + 24)), (9, "Joe", "Doe", from_days(738974 + 27)), (10, "Joe", "Doe", from_days(738974 + 30)), (11, "Joe", "Doe", from_days(738974 + 33)), (12, "Joe", "Doe", from_days(738974 + 36)), (13, "Joe", "Doe", from_days(738974 + 39)), (14, "Joe", "Doe", from_days(738974 + 42)), (15, "Joe", "Doe", from_days(738974 + 45)), (16, "Joe", "Doe", from_days(738974 + 48)), (17, "Joe", "Doe", from_days(738974 + 51)), (18, "Joe", "Doe", from_days(738974 + 54)), (19, "Joe", "Doe", from_days(738974 + 57)), (20, "Joe", "Doe", from_days(738974 + 60)), (21, "Joe", "Doe", from_days(738974 + 63)), (22, "Joe", "Doe", from_days(738974 + 66)), (23, "Joe", "Doe", from_days(738974 + 69)), (24, "Joe", "Doe", from_days(738974 + 72)), (25, "Joe", "Doe", from_days(738974 + 75)), (26, "Joe", "Doe", from_days(738974 + 78)), (27, "Joe", "Doe", from_days(738974 + 81)), (28, "Joe", "Doe", from_days(738974 + 84)), (29, "Joe", "Doe", from_days(738974 + 87)); alter table t coalesce partition 4; show create table t; analyze table t; @@ -1221,10 +1163,6 @@ insert into t select id + 4, fname, lname, hired, separated, job_code, store_id insert into t select id + 8, fname, lname, hired, separated, job_code, store_id + 8 from t; insert into t select id + 16, fname, lname, hired, separated, job_code, store_id + 16 from t; insert into t select id + 32, fname, lname, hired, separated, job_code, store_id + 32 from t; -insert into t select id + 64, fname, lname, hired, separated, job_code, store_id + 64 from t; -insert into t select id + 128, fname, lname, hired, separated, job_code, store_id + 128 from t; -insert into t select id + 256, fname, lname, hired, separated, job_code, store_id + 256 from t; -insert into t select id + 512, fname, lname, hired, separated, job_code, store_id + 512 from t; select sum(store_id), avg(store_id), max(store_id), min(store_id), sum(id) from t; -- error 1480 alter table t add partition (partition pHist history); @@ -1982,101 +1920,7 @@ show create table tRange; # TestRemoveHashPartitioning drop table if exists t; create table t (a int, b varchar(255), key (a,b), key (b)) partition by hash (a) partitions 7; -insert into t values (32,char(32,32,32,32)); -insert into t values (33,char(33,33,33,33)); -insert into t values (34,char(34,34,34,34)); -insert into t values (35,char(35,35,35,35)); -insert into t values (36,char(36,36,36,36)); -insert into t values (37,char(37,37,37,37)); -insert into t values (38,char(38,38,38,38)); -insert into t values (39,char(39,39,39,39)); -insert into t values (40,char(40,40,40,40)); -insert into t values (41,char(41,41,41,41)); -insert into t values (42,char(42,42,42,42)); -insert into t values (43,char(43,43,43,43)); -insert into t values (44,char(44,44,44,44)); -insert into t values (45,char(45,45,45,45)); -insert into t values (46,char(46,46,46,46)); -insert into t values (47,char(47,47,47,47)); -insert into t values (48,char(48,48,48,48)); -insert into t values (49,char(49,49,49,49)); -insert into t values (50,char(50,50,50,50)); -insert into t values (51,char(51,51,51,51)); -insert into t values (52,char(52,52,52,52)); -insert into t values (53,char(53,53,53,53)); -insert into t values (54,char(54,54,54,54)); -insert into t values (55,char(55,55,55,55)); -insert into t values (56,char(56,56,56,56)); -insert into t values (57,char(57,57,57,57)); -insert into t values (58,char(58,58,58,58)); -insert into t values (59,char(59,59,59,59)); -insert into t values (60,char(60,60,60,60)); -insert into t values (61,char(61,61,61,61)); -insert into t values (62,char(62,62,62,62)); -insert into t values (63,char(63,63,63,63)); -insert into t values (64,char(64,64,64,64)); -insert into t values (65,char(65,65,65,65)); -insert into t values (66,char(66,66,66,66)); -insert into t values (67,char(67,67,67,67)); -insert into t values (68,char(68,68,68,68)); -insert into t values (69,char(69,69,69,69)); -insert into t values (70,char(70,70,70,70)); -insert into t values (71,char(71,71,71,71)); -insert into t values (72,char(72,72,72,72)); -insert into t values (73,char(73,73,73,73)); -insert into t values (74,char(74,74,74,74)); -insert into t values (75,char(75,75,75,75)); -insert into t values (76,char(76,76,76,76)); -insert into t values (77,char(77,77,77,77)); -insert into t values (78,char(78,78,78,78)); -insert into t values (79,char(79,79,79,79)); -insert into t values (80,char(80,80,80,80)); -insert into t values (81,char(81,81,81,81)); -insert into t values (82,char(82,82,82,82)); -insert into t values (83,char(83,83,83,83)); -insert into t values (84,char(84,84,84,84)); -insert into t values (85,char(85,85,85,85)); -insert into t values (86,char(86,86,86,86)); -insert into t values (87,char(87,87,87,87)); -insert into t values (88,char(88,88,88,88)); -insert into t values (89,char(89,89,89,89)); -insert into t values (90,char(90,90,90,90)); -insert into t values (91,char(91,91,91,91)); -insert into t values (92,char(92,92,92,92)); -insert into t values (93,char(93,93,93,93)); -insert into t values (94,char(94,94,94,94)); -insert into t values (95,char(95,95,95,95)); -insert into t values (96,char(96,96,96,96)); -insert into t values (97,char(97,97,97,97)); -insert into t values (98,char(98,98,98,98)); -insert into t values (99,char(99,99,99,99)); -insert into t values (100,char(100,100,100,100)); -insert into t values (101,char(101,101,101,101)); -insert into t values (102,char(102,102,102,102)); -insert into t values (103,char(103,103,103,103)); -insert into t values (104,char(104,104,104,104)); -insert into t values (105,char(105,105,105,105)); -insert into t values (106,char(106,106,106,106)); -insert into t values (107,char(107,107,107,107)); -insert into t values (108,char(108,108,108,108)); -insert into t values (109,char(109,109,109,109)); -insert into t values (110,char(110,110,110,110)); -insert into t values (111,char(111,111,111,111)); -insert into t values (112,char(112,112,112,112)); -insert into t values (113,char(113,113,113,113)); -insert into t values (114,char(114,114,114,114)); -insert into t values (115,char(115,115,115,115)); -insert into t values (116,char(116,116,116,116)); -insert into t values (117,char(117,117,117,117)); -insert into t values (118,char(118,118,118,118)); -insert into t values (119,char(119,119,119,119)); -insert into t values (120,char(120,120,120,120)); -insert into t values (121,char(121,121,121,121)); -insert into t values (122,char(122,122,122,122)); -insert into t values (123,char(123,123,123,123)); -insert into t values (124,char(124,124,124,124)); -insert into t values (125,char(125,125,125,125)); -insert into t values (126,char(126,126,126,126)); +insert into t values (32,char(32,32,32,32)), (33,char(33,33,33,33)), (34,char(34,34,34,34)), (35,char(35,35,35,35)), (36,char(36,36,36,36)), (37,char(37,37,37,37)), (38,char(38,38,38,38)), (39,char(39,39,39,39)), (40,char(40,40,40,40)), (41,char(41,41,41,41)), (42,char(42,42,42,42)), (43,char(43,43,43,43)), (44,char(44,44,44,44)), (45,char(45,45,45,45)), (46,char(46,46,46,46)), (47,char(47,47,47,47)), (48,char(48,48,48,48)), (49,char(49,49,49,49)), (50,char(50,50,50,50)), (51,char(51,51,51,51)), (52,char(52,52,52,52)), (53,char(53,53,53,53)), (54,char(54,54,54,54)), (55,char(55,55,55,55)), (56,char(56,56,56,56)), (57,char(57,57,57,57)), (58,char(58,58,58,58)), (59,char(59,59,59,59)), (60,char(60,60,60,60)), (61,char(61,61,61,61)), (62,char(62,62,62,62)), (63,char(63,63,63,63)), (64,char(64,64,64,64)), (65,char(65,65,65,65)), (66,char(66,66,66,66)), (67,char(67,67,67,67)), (68,char(68,68,68,68)), (69,char(69,69,69,69)), (70,char(70,70,70,70)), (71,char(71,71,71,71)), (72,char(72,72,72,72)), (73,char(73,73,73,73)), (74,char(74,74,74,74)), (75,char(75,75,75,75)), (76,char(76,76,76,76)), (77,char(77,77,77,77)), (78,char(78,78,78,78)), (79,char(79,79,79,79)), (80,char(80,80,80,80)), (81,char(81,81,81,81)), (82,char(82,82,82,82)), (83,char(83,83,83,83)), (84,char(84,84,84,84)), (85,char(85,85,85,85)), (86,char(86,86,86,86)), (87,char(87,87,87,87)), (88,char(88,88,88,88)), (89,char(89,89,89,89)), (90,char(90,90,90,90)), (91,char(91,91,91,91)), (92,char(92,92,92,92)), (93,char(93,93,93,93)), (94,char(94,94,94,94)), (95,char(95,95,95,95)), (96,char(96,96,96,96)), (97,char(97,97,97,97)), (98,char(98,98,98,98)), (99,char(99,99,99,99)), (100,char(100,100,100,100)), (101,char(101,101,101,101)), (102,char(102,102,102,102)), (103,char(103,103,103,103)), (104,char(104,104,104,104)), (105,char(105,105,105,105)), (106,char(106,106,106,106)), (107,char(107,107,107,107)), (108,char(108,108,108,108)), (109,char(109,109,109,109)), (110,char(110,110,110,110)), (111,char(111,111,111,111)), (112,char(112,112,112,112)), (113,char(113,113,113,113)), (114,char(114,114,114,114)), (115,char(115,115,115,115)), (116,char(116,116,116,116)), (117,char(117,117,117,117)), (118,char(118,118,118,118)), (119,char(119,119,119,119)), (120,char(120,120,120,120)), (121,char(121,121,121,121)), (122,char(122,122,122,122)), (123,char(123,123,123,123)), (124,char(124,124,124,124)), (125,char(125,125,125,125)), (126,char(126,126,126,126)); analyze table t; --sorted_result select partition_name, table_rows from information_schema.partitions where table_schema = 'ddl__db_partition' and table_name = 't'; diff --git a/tests/integrationtest/t/executor/executor.test b/tests/integrationtest/t/executor/executor.test index e177f2cd6df01..de7ecf4bcf5dc 100644 --- a/tests/integrationtest/t/executor/executor.test +++ b/tests/integrationtest/t/executor/executor.test @@ -810,207 +810,7 @@ select * from test having (select 1, 1); # TestIn drop table if exists t; create table t (c1 int primary key, c2 int, key c (c2)); -insert t values(0, 0); -insert t values(1, 1); -insert t values(2, 2); -insert t values(3, 3); -insert t values(4, 4); -insert t values(5, 5); -insert t values(6, 6); -insert t values(7, 7); -insert t values(8, 8); -insert t values(9, 9); -insert t values(10, 10); -insert t values(11, 11); -insert t values(12, 12); -insert t values(13, 13); -insert t values(14, 14); -insert t values(15, 15); -insert t values(16, 16); -insert t values(17, 17); -insert t values(18, 18); -insert t values(19, 19); -insert t values(20, 20); -insert t values(21, 21); -insert t values(22, 22); -insert t values(23, 23); -insert t values(24, 24); -insert t values(25, 25); -insert t values(26, 26); -insert t values(27, 27); -insert t values(28, 28); -insert t values(29, 29); -insert t values(30, 30); -insert t values(31, 31); -insert t values(32, 32); -insert t values(33, 33); -insert t values(34, 34); -insert t values(35, 35); -insert t values(36, 36); -insert t values(37, 37); -insert t values(38, 38); -insert t values(39, 39); -insert t values(40, 40); -insert t values(41, 41); -insert t values(42, 42); -insert t values(43, 43); -insert t values(44, 44); -insert t values(45, 45); -insert t values(46, 46); -insert t values(47, 47); -insert t values(48, 48); -insert t values(49, 49); -insert t values(50, 50); -insert t values(51, 51); -insert t values(52, 52); -insert t values(53, 53); -insert t values(54, 54); -insert t values(55, 55); -insert t values(56, 56); -insert t values(57, 57); -insert t values(58, 58); -insert t values(59, 59); -insert t values(60, 60); -insert t values(61, 61); -insert t values(62, 62); -insert t values(63, 63); -insert t values(64, 64); -insert t values(65, 65); -insert t values(66, 66); -insert t values(67, 67); -insert t values(68, 68); -insert t values(69, 69); -insert t values(70, 70); -insert t values(71, 71); -insert t values(72, 72); -insert t values(73, 73); -insert t values(74, 74); -insert t values(75, 75); -insert t values(76, 76); -insert t values(77, 77); -insert t values(78, 78); -insert t values(79, 79); -insert t values(80, 80); -insert t values(81, 81); -insert t values(82, 82); -insert t values(83, 83); -insert t values(84, 84); -insert t values(85, 85); -insert t values(86, 86); -insert t values(87, 87); -insert t values(88, 88); -insert t values(89, 89); -insert t values(90, 90); -insert t values(91, 91); -insert t values(92, 92); -insert t values(93, 93); -insert t values(94, 94); -insert t values(95, 95); -insert t values(96, 96); -insert t values(97, 97); -insert t values(98, 98); -insert t values(99, 99); -insert t values(100, 100); -insert t values(101, 101); -insert t values(102, 102); -insert t values(103, 103); -insert t values(104, 104); -insert t values(105, 105); -insert t values(106, 106); -insert t values(107, 107); -insert t values(108, 108); -insert t values(109, 109); -insert t values(110, 110); -insert t values(111, 111); -insert t values(112, 112); -insert t values(113, 113); -insert t values(114, 114); -insert t values(115, 115); -insert t values(116, 116); -insert t values(117, 117); -insert t values(118, 118); -insert t values(119, 119); -insert t values(120, 120); -insert t values(121, 121); -insert t values(122, 122); -insert t values(123, 123); -insert t values(124, 124); -insert t values(125, 125); -insert t values(126, 126); -insert t values(127, 127); -insert t values(128, 128); -insert t values(129, 129); -insert t values(130, 130); -insert t values(131, 131); -insert t values(132, 132); -insert t values(133, 133); -insert t values(134, 134); -insert t values(135, 135); -insert t values(136, 136); -insert t values(137, 137); -insert t values(138, 138); -insert t values(139, 139); -insert t values(140, 140); -insert t values(141, 141); -insert t values(142, 142); -insert t values(143, 143); -insert t values(144, 144); -insert t values(145, 145); -insert t values(146, 146); -insert t values(147, 147); -insert t values(148, 148); -insert t values(149, 149); -insert t values(150, 150); -insert t values(151, 151); -insert t values(152, 152); -insert t values(153, 153); -insert t values(154, 154); -insert t values(155, 155); -insert t values(156, 156); -insert t values(157, 157); -insert t values(158, 158); -insert t values(159, 159); -insert t values(160, 160); -insert t values(161, 161); -insert t values(162, 162); -insert t values(163, 163); -insert t values(164, 164); -insert t values(165, 165); -insert t values(166, 166); -insert t values(167, 167); -insert t values(168, 168); -insert t values(169, 169); -insert t values(170, 170); -insert t values(171, 171); -insert t values(172, 172); -insert t values(173, 173); -insert t values(174, 174); -insert t values(175, 175); -insert t values(176, 176); -insert t values(177, 177); -insert t values(178, 178); -insert t values(179, 179); -insert t values(180, 180); -insert t values(181, 181); -insert t values(182, 182); -insert t values(183, 183); -insert t values(184, 184); -insert t values(185, 185); -insert t values(186, 186); -insert t values(187, 187); -insert t values(188, 188); -insert t values(189, 189); -insert t values(190, 190); -insert t values(191, 191); -insert t values(192, 192); -insert t values(193, 193); -insert t values(194, 194); -insert t values(195, 195); -insert t values(196, 196); -insert t values(197, 197); -insert t values(198, 198); -insert t values(199, 199); -insert t values(200, 200); +insert t values(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12), (13, 13), (14, 14), (15, 15), (16, 16), (17, 17), (18, 18), (19, 19), (20, 20), (21, 21), (22, 22), (23, 23), (24, 24), (25, 25), (26, 26), (27, 27), (28, 28), (29, 29), (30, 30), (31, 31), (32, 32), (33, 33), (34, 34), (35, 35), (36, 36), (37, 37), (38, 38), (39, 39), (40, 40), (41, 41), (42, 42), (43, 43), (44, 44), (45, 45), (46, 46), (47, 47), (48, 48), (49, 49), (50, 50), (51, 51), (52, 52), (53, 53), (54, 54), (55, 55), (56, 56), (57, 57), (58, 58), (59, 59), (60, 60), (61, 61), (62, 62), (63, 63), (64, 64), (65, 65), (66, 66), (67, 67), (68, 68), (69, 69), (70, 70), (71, 71), (72, 72), (73, 73), (74, 74), (75, 75), (76, 76), (77, 77), (78, 78), (79, 79), (80, 80), (81, 81), (82, 82), (83, 83), (84, 84), (85, 85), (86, 86), (87, 87), (88, 88), (89, 89), (90, 90), (91, 91), (92, 92), (93, 93), (94, 94), (95, 95), (96, 96), (97, 97), (98, 98), (99, 99), (100, 100), (101, 101), (102, 102), (103, 103), (104, 104), (105, 105), (106, 106), (107, 107), (108, 108), (109, 109), (110, 110), (111, 111), (112, 112), (113, 113), (114, 114), (115, 115), (116, 116), (117, 117), (118, 118), (119, 119), (120, 120), (121, 121), (122, 122), (123, 123), (124, 124), (125, 125), (126, 126), (127, 127), (128, 128), (129, 129), (130, 130), (131, 131), (132, 132), (133, 133), (134, 134), (135, 135), (136, 136), (137, 137), (138, 138), (139, 139), (140, 140), (141, 141), (142, 142), (143, 143), (144, 144), (145, 145), (146, 146), (147, 147), (148, 148), (149, 149), (150, 150), (151, 151), (152, 152), (153, 153), (154, 154), (155, 155), (156, 156), (157, 157), (158, 158), (159, 159), (160, 160), (161, 161), (162, 162), (163, 163), (164, 164), (165, 165), (166, 166), (167, 167), (168, 168), (169, 169), (170, 170), (171, 171), (172, 172), (173, 173), (174, 174), (175, 175), (176, 176), (177, 177), (178, 178), (179, 179), (180, 180), (181, 181), (182, 182), (183, 183), (184, 184), (185, 185), (186, 186), (187, 187), (188, 188), (189, 189), (190, 190), (191, 191), (192, 192), (193, 193), (194, 194), (195, 195), (196, 196), (197, 197), (198, 198), (199, 199), (200, 200); select c2 from t where c1 in ('7', '10', '112', '111', '98', '106', '100', '9', '18', '17') order by c2; select c2 from t where c1 in ('7a'); From 1b609c9f2a0a55414aa0416a23985e1a0383303d Mon Sep 17 00:00:00 2001 From: Jason Mo Date: Fri, 17 May 2024 16:48:06 +0800 Subject: [PATCH 3/5] update --- .../r/executor/partition/global_index.result | 16 +++++----------- .../t/executor/partition/global_index.test | 18 +++++------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/tests/integrationtest/r/executor/partition/global_index.result b/tests/integrationtest/r/executor/partition/global_index.result index 653aaf1d6db66..bd1f6b2064436 100644 --- a/tests/integrationtest/r/executor/partition/global_index.result +++ b/tests/integrationtest/r/executor/partition/global_index.result @@ -1,10 +1,9 @@ set tidb_enable_global_index=true; drop table if exists p; -create table p (id int, c int) partition by range (c) ( +create table p (id int, c int, unique index idx(id)) partition by range (c) ( partition p0 values less than (4), partition p1 values less than (7), partition p2 values less than (10)); -alter table p add unique idx(id); insert into p values (1,3), (3,4), (5,6), (7,9); analyze table p; drop table if exists t; @@ -48,11 +47,10 @@ select /*+ INL_JOIN(p, t) */ p.id from p partition(p0) inner join t on p.id = t. id 1 drop table if exists p, t; -create table p (id int, c int, d int, e int, primary key(d, c) clustered) partition by range (c) ( +create table p (id int, c int, d int, e int, primary key(d, c) clustered, unique index idx(id)) partition by range (c) ( partition p0 values less than (4), partition p1 values less than (7), partition p2 values less than (10)); -alter table p add unique idx(id); insert into p values (1,3,1,1), (3,4,3,3), (5,6,5,5), (7,9,7,7); analyze table p; create table t (id int, c int); @@ -68,8 +66,7 @@ select /*+ INL_JOIN(p, t) */ p.id from p partition(p0) inner join t on p.id = t. id 1 drop table if exists p; -create table p (a int, b int GENERATED ALWAYS AS (3*a-2*a) VIRTUAL) partition by hash(b) partitions 2; -alter table p add unique index idx (a); +create table p (a int, b int GENERATED ALWAYS AS (3*a-2*a) VIRTUAL, unique index idx(a)) partition by hash(b) partitions 2; insert into p (a) values (1),(2),(3); analyze table p; select * from p use index (idx); @@ -81,13 +78,13 @@ drop table if exists test_t1; CREATE TABLE test_t1 ( a int(11) NOT NULL, b int(11) DEFAULT NULL, -c int(11) DEFAULT NULL +c int(11) DEFAULT NULL, +unique index p_a(a) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin PARTITION BY RANGE (c) ( PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (MAXVALUE) ); -alter table test_t1 add unique p_a (a); insert into test_t1 values (1,1,1); explain format='brief' select * from test_t1 where a = 1; id estRows task access object operator info @@ -102,7 +99,6 @@ Point_Get 1.00 root table:test_t1, index:p_a(a) select * from test_t1 where a = 1; a b c 1 1 1 -SET session tidb_enable_index_merge = ON; drop table if exists t; CREATE TABLE t ( a int(11) NOT NULL, @@ -118,7 +114,6 @@ PARTITION p1 VALUES LESS THAN (MAXVALUE) ); insert into t values (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4),(5,5,5,5),(6,6,6,6),(7,7,7,7),(8,8,8,8); analyze table t; -# when index_merge has global index as its partial path, ignore it. explain select /*+ use_index_merge(t, uidx_ac, idx_bc) */ * from t where a=1 or b=2; id estRows task access object operator info IndexMerge_12 1.88 root partition:all type: union @@ -129,7 +124,6 @@ select /*+ use_index_merge(t, uidx_ac, idx_bc) */ * from t where a=1 or b=2; a b c d 1 1 1 1 2 2 2 2 -SET session tidb_enable_index_merge = DEFAULT; drop table if exists t; create table t (a varchar(10), b varchar(1) GENERATED ALWAYS AS (substr(a,1,1)) VIRTUAL) partition by list columns(b) (partition p0 values in ('a','c'), partition p1 values in ('b','d')); alter table t add unique index (a); diff --git a/tests/integrationtest/t/executor/partition/global_index.test b/tests/integrationtest/t/executor/partition/global_index.test index 99867eaa13344..3f2a979a8b08e 100644 --- a/tests/integrationtest/t/executor/partition/global_index.test +++ b/tests/integrationtest/t/executor/partition/global_index.test @@ -2,11 +2,10 @@ set tidb_enable_global_index=true; # Prepare data drop table if exists p; -create table p (id int, c int) partition by range (c) ( +create table p (id int, c int, unique index idx(id)) partition by range (c) ( partition p0 values less than (4), partition p1 values less than (7), partition p2 values less than (10)); -alter table p add unique idx(id); insert into p values (1,3), (3,4), (5,6), (7,9); analyze table p; drop table if exists t; @@ -44,11 +43,10 @@ select /*+ INL_JOIN(p, t) */ p.id from p partition(p0) inner join t on p.id = t. # Prepare tables with clustered index drop table if exists p, t; -create table p (id int, c int, d int, e int, primary key(d, c) clustered) partition by range (c) ( +create table p (id int, c int, d int, e int, primary key(d, c) clustered, unique index idx(id)) partition by range (c) ( partition p0 values less than (4), partition p1 values less than (7), partition p2 values less than (10)); -alter table p add unique idx(id); insert into p values (1,3,1,1), (3,4,3,3), (5,6,5,5), (7,9,7,7); analyze table p; create table t (id int, c int); @@ -65,8 +63,7 @@ select /*+ INL_JOIN(p, t) */ p.id from p partition(p0) inner join t on p.id = t. # TestIssue21732 drop table if exists p; -create table p (a int, b int GENERATED ALWAYS AS (3*a-2*a) VIRTUAL) partition by hash(b) partitions 2; -alter table p add unique index idx (a); +create table p (a int, b int GENERATED ALWAYS AS (3*a-2*a) VIRTUAL, unique index idx(a)) partition by hash(b) partitions 2; insert into p (a) values (1),(2),(3); analyze table p; --sorted_result @@ -78,13 +75,13 @@ drop table if exists test_t1; CREATE TABLE test_t1 ( a int(11) NOT NULL, b int(11) DEFAULT NULL, - c int(11) DEFAULT NULL + c int(11) DEFAULT NULL, + unique index p_a(a) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin PARTITION BY RANGE (c) ( PARTITION p0 VALUES LESS THAN (10), PARTITION p1 VALUES LESS THAN (MAXVALUE) ); -alter table test_t1 add unique p_a (a); insert into test_t1 values (1,1,1); explain format='brief' select * from test_t1 where a = 1; @@ -96,7 +93,6 @@ select * from test_t1 where a = 1; # TestGlobalIndexMerge -SET session tidb_enable_index_merge = ON; drop table if exists t; CREATE TABLE t ( a int(11) NOT NULL, @@ -112,14 +108,10 @@ PARTITION BY RANGE (c) ( ); insert into t values (1,1,1,1),(2,2,2,2),(3,3,3,3),(4,4,4,4),(5,5,5,5),(6,6,6,6),(7,7,7,7),(8,8,8,8); analyze table t; ---echo # when index_merge has global index as its partial path, ignore it. explain select /*+ use_index_merge(t, uidx_ac, idx_bc) */ * from t where a=1 or b=2; --sorted_result select /*+ use_index_merge(t, uidx_ac, idx_bc) */ * from t where a=1 or b=2; -SET session tidb_enable_index_merge = DEFAULT; - - # TestListColumnsPartitionWithGlobalIndex ## Test generated column with global index drop table if exists t; From 536839e7fc72b70f0e5b7182165ea834cb2bbf40 Mon Sep 17 00:00:00 2001 From: Jason Mo Date: Fri, 17 May 2024 17:07:35 +0800 Subject: [PATCH 4/5] update --- .../r/executor/aggregate.result | 3 +- .../r/executor/jointest/hash_join.result | 3 +- tests/integrationtest/r/util/admin.result | 101 +---------------- .../integrationtest/t/executor/aggregate.test | 3 +- .../t/executor/jointest/hash_join.test | 3 +- tests/integrationtest/t/util/admin.test | 103 +----------------- 6 files changed, 10 insertions(+), 206 deletions(-) diff --git a/tests/integrationtest/r/executor/aggregate.result b/tests/integrationtest/r/executor/aggregate.result index 6ae9d7a13980f..ebd58e49753ff 100644 --- a/tests/integrationtest/r/executor/aggregate.result +++ b/tests/integrationtest/r/executor/aggregate.result @@ -50,8 +50,7 @@ a MIN(b) MAX(b) 1 11 11 3 NULL NULL drop table if exists t; -create table t (a int, b int, c int); -alter table t add index idx(a, b, c); +create table t (a int, b int, c int, index idx(a, b, c)); select count(a) from t group by a; count(a) select count(a) from t; diff --git a/tests/integrationtest/r/executor/jointest/hash_join.result b/tests/integrationtest/r/executor/jointest/hash_join.result index 5821b8aa19d0f..dc1a59baa0d4b 100644 --- a/tests/integrationtest/r/executor/jointest/hash_join.result +++ b/tests/integrationtest/r/executor/jointest/hash_join.result @@ -215,8 +215,7 @@ a b a 2 NULL NULL drop table if exists t,s; create table t(a int primary key auto_increment, b time); -create table s(a int, b time); -alter table s add index idx(a,b); +create table s(a int, b time, index idx(a, b)); set @@tidb_index_join_batch_size=4; set @@tidb_init_chunk_size=1; set @@tidb_max_chunk_size=32; diff --git a/tests/integrationtest/r/util/admin.result b/tests/integrationtest/r/util/admin.result index 6903d3c1eb77e..5fc461ab575c6 100644 --- a/tests/integrationtest/r/util/admin.result +++ b/tests/integrationtest/r/util/admin.result @@ -1,3 +1,4 @@ +set global tidb_enable_dist_task = false; drop table if exists t; create table t(a bigint unsigned primary key, b int, c int, index idx(a, b)); insert into t values(1, 1, 1); @@ -138,105 +139,6 @@ insert into t values (97, '97', 97); insert into t values (98, '98', 98); insert into t values (99, '99', 99); insert into t values (100, '100', 100); -insert into t values (101, '101', 101); -insert into t values (102, '102', 102); -insert into t values (103, '103', 103); -insert into t values (104, '104', 104); -insert into t values (105, '105', 105); -insert into t values (106, '106', 106); -insert into t values (107, '107', 107); -insert into t values (108, '108', 108); -insert into t values (109, '109', 109); -insert into t values (110, '110', 110); -insert into t values (111, '111', 111); -insert into t values (112, '112', 112); -insert into t values (113, '113', 113); -insert into t values (114, '114', 114); -insert into t values (115, '115', 115); -insert into t values (116, '116', 116); -insert into t values (117, '117', 117); -insert into t values (118, '118', 118); -insert into t values (119, '119', 119); -insert into t values (120, '120', 120); -insert into t values (121, '121', 121); -insert into t values (122, '122', 122); -insert into t values (123, '123', 123); -insert into t values (124, '124', 124); -insert into t values (125, '125', 125); -insert into t values (126, '126', 126); -insert into t values (127, '127', 127); -insert into t values (128, '128', 128); -insert into t values (129, '129', 129); -insert into t values (130, '130', 130); -insert into t values (131, '131', 131); -insert into t values (132, '132', 132); -insert into t values (133, '133', 133); -insert into t values (134, '134', 134); -insert into t values (135, '135', 135); -insert into t values (136, '136', 136); -insert into t values (137, '137', 137); -insert into t values (138, '138', 138); -insert into t values (139, '139', 139); -insert into t values (140, '140', 140); -insert into t values (141, '141', 141); -insert into t values (142, '142', 142); -insert into t values (143, '143', 143); -insert into t values (144, '144', 144); -insert into t values (145, '145', 145); -insert into t values (146, '146', 146); -insert into t values (147, '147', 147); -insert into t values (148, '148', 148); -insert into t values (149, '149', 149); -insert into t values (150, '150', 150); -insert into t values (151, '151', 151); -insert into t values (152, '152', 152); -insert into t values (153, '153', 153); -insert into t values (154, '154', 154); -insert into t values (155, '155', 155); -insert into t values (156, '156', 156); -insert into t values (157, '157', 157); -insert into t values (158, '158', 158); -insert into t values (159, '159', 159); -insert into t values (160, '160', 160); -insert into t values (161, '161', 161); -insert into t values (162, '162', 162); -insert into t values (163, '163', 163); -insert into t values (164, '164', 164); -insert into t values (165, '165', 165); -insert into t values (166, '166', 166); -insert into t values (167, '167', 167); -insert into t values (168, '168', 168); -insert into t values (169, '169', 169); -insert into t values (170, '170', 170); -insert into t values (171, '171', 171); -insert into t values (172, '172', 172); -insert into t values (173, '173', 173); -insert into t values (174, '174', 174); -insert into t values (175, '175', 175); -insert into t values (176, '176', 176); -insert into t values (177, '177', 177); -insert into t values (178, '178', 178); -insert into t values (179, '179', 179); -insert into t values (180, '180', 180); -insert into t values (181, '181', 181); -insert into t values (182, '182', 182); -insert into t values (183, '183', 183); -insert into t values (184, '184', 184); -insert into t values (185, '185', 185); -insert into t values (186, '186', 186); -insert into t values (187, '187', 187); -insert into t values (188, '188', 188); -insert into t values (189, '189', 189); -insert into t values (190, '190', 190); -insert into t values (191, '191', 191); -insert into t values (192, '192', 192); -insert into t values (193, '193', 193); -insert into t values (194, '194', 194); -insert into t values (195, '195', 195); -insert into t values (196, '196', 196); -insert into t values (197, '197', 197); -insert into t values (198, '198', 198); -insert into t values (199, '199', 199); admin check table t; create index idx_2 on t (c); admin check table t; @@ -248,3 +150,4 @@ alter table t add column d char(36) NULL DEFAULT ''; admin check table t; insert into t values (1000, '1000', 1000, '1000', '1000'); admin check table t; +set global tidb_enable_dist_task = default; diff --git a/tests/integrationtest/t/executor/aggregate.test b/tests/integrationtest/t/executor/aggregate.test index 66a542c0829bd..daae0a4d136fc 100644 --- a/tests/integrationtest/t/executor/aggregate.test +++ b/tests/integrationtest/t/executor/aggregate.test @@ -21,8 +21,7 @@ SELECT a, MIN(b), MAX(b) FROM t GROUP BY a; # TestAggPushDown drop table if exists t; -create table t (a int, b int, c int); -alter table t add index idx(a, b, c); +create table t (a int, b int, c int, index idx(a, b, c)); select count(a) from t group by a; select count(a) from t; insert t values(0,0,0); diff --git a/tests/integrationtest/t/executor/jointest/hash_join.test b/tests/integrationtest/t/executor/jointest/hash_join.test index ad56e58526b8b..a792449db8a90 100644 --- a/tests/integrationtest/t/executor/jointest/hash_join.test +++ b/tests/integrationtest/t/executor/jointest/hash_join.test @@ -107,8 +107,7 @@ select /*+ INL_HASH_JOIN(t3)*/ * from t1 left join t3 on t1.b = t3.a; select /*+ INL_MERGE_JOIN(t3)*/ * from t1 left join t3 on t1.b = t3.a; drop table if exists t,s; create table t(a int primary key auto_increment, b time); -create table s(a int, b time); -alter table s add index idx(a,b); +create table s(a int, b time, index idx(a, b)); set @@tidb_index_join_batch_size=4; set @@tidb_init_chunk_size=1; set @@tidb_max_chunk_size=32; diff --git a/tests/integrationtest/t/util/admin.test b/tests/integrationtest/t/util/admin.test index 984e65a8abb5c..657bd63e46322 100644 --- a/tests/integrationtest/t/util/admin.test +++ b/tests/integrationtest/t/util/admin.test @@ -1,3 +1,6 @@ +# To speed up tests +set global tidb_enable_dist_task = false; + # TestAdminCheckTable drop table if exists t; create table t(a bigint unsigned primary key, b int, c int, index idx(a, b)); @@ -141,105 +144,6 @@ insert into t values (97, '97', 97); insert into t values (98, '98', 98); insert into t values (99, '99', 99); insert into t values (100, '100', 100); -insert into t values (101, '101', 101); -insert into t values (102, '102', 102); -insert into t values (103, '103', 103); -insert into t values (104, '104', 104); -insert into t values (105, '105', 105); -insert into t values (106, '106', 106); -insert into t values (107, '107', 107); -insert into t values (108, '108', 108); -insert into t values (109, '109', 109); -insert into t values (110, '110', 110); -insert into t values (111, '111', 111); -insert into t values (112, '112', 112); -insert into t values (113, '113', 113); -insert into t values (114, '114', 114); -insert into t values (115, '115', 115); -insert into t values (116, '116', 116); -insert into t values (117, '117', 117); -insert into t values (118, '118', 118); -insert into t values (119, '119', 119); -insert into t values (120, '120', 120); -insert into t values (121, '121', 121); -insert into t values (122, '122', 122); -insert into t values (123, '123', 123); -insert into t values (124, '124', 124); -insert into t values (125, '125', 125); -insert into t values (126, '126', 126); -insert into t values (127, '127', 127); -insert into t values (128, '128', 128); -insert into t values (129, '129', 129); -insert into t values (130, '130', 130); -insert into t values (131, '131', 131); -insert into t values (132, '132', 132); -insert into t values (133, '133', 133); -insert into t values (134, '134', 134); -insert into t values (135, '135', 135); -insert into t values (136, '136', 136); -insert into t values (137, '137', 137); -insert into t values (138, '138', 138); -insert into t values (139, '139', 139); -insert into t values (140, '140', 140); -insert into t values (141, '141', 141); -insert into t values (142, '142', 142); -insert into t values (143, '143', 143); -insert into t values (144, '144', 144); -insert into t values (145, '145', 145); -insert into t values (146, '146', 146); -insert into t values (147, '147', 147); -insert into t values (148, '148', 148); -insert into t values (149, '149', 149); -insert into t values (150, '150', 150); -insert into t values (151, '151', 151); -insert into t values (152, '152', 152); -insert into t values (153, '153', 153); -insert into t values (154, '154', 154); -insert into t values (155, '155', 155); -insert into t values (156, '156', 156); -insert into t values (157, '157', 157); -insert into t values (158, '158', 158); -insert into t values (159, '159', 159); -insert into t values (160, '160', 160); -insert into t values (161, '161', 161); -insert into t values (162, '162', 162); -insert into t values (163, '163', 163); -insert into t values (164, '164', 164); -insert into t values (165, '165', 165); -insert into t values (166, '166', 166); -insert into t values (167, '167', 167); -insert into t values (168, '168', 168); -insert into t values (169, '169', 169); -insert into t values (170, '170', 170); -insert into t values (171, '171', 171); -insert into t values (172, '172', 172); -insert into t values (173, '173', 173); -insert into t values (174, '174', 174); -insert into t values (175, '175', 175); -insert into t values (176, '176', 176); -insert into t values (177, '177', 177); -insert into t values (178, '178', 178); -insert into t values (179, '179', 179); -insert into t values (180, '180', 180); -insert into t values (181, '181', 181); -insert into t values (182, '182', 182); -insert into t values (183, '183', 183); -insert into t values (184, '184', 184); -insert into t values (185, '185', 185); -insert into t values (186, '186', 186); -insert into t values (187, '187', 187); -insert into t values (188, '188', 188); -insert into t values (189, '189', 189); -insert into t values (190, '190', 190); -insert into t values (191, '191', 191); -insert into t values (192, '192', 192); -insert into t values (193, '193', 193); -insert into t values (194, '194', 194); -insert into t values (195, '195', 195); -insert into t values (196, '196', 196); -insert into t values (197, '197', 197); -insert into t values (198, '198', 198); -insert into t values (199, '199', 199); admin check table t; # Test back filled created index data. create index idx_2 on t (c); @@ -254,3 +158,4 @@ admin check table t; insert into t values (1000, '1000', 1000, '1000', '1000'); admin check table t; +set global tidb_enable_dist_task = default; \ No newline at end of file From bc52016de2d92474c5ead6b044c6882ba3082db7 Mon Sep 17 00:00:00 2001 From: Hangjie Mo Date: Tue, 21 May 2024 11:40:27 +0800 Subject: [PATCH 5/5] Update tests/integrationtest/t/util/admin.test Co-authored-by: tangenta --- tests/integrationtest/t/util/admin.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integrationtest/t/util/admin.test b/tests/integrationtest/t/util/admin.test index 657bd63e46322..b0fb1cd760908 100644 --- a/tests/integrationtest/t/util/admin.test +++ b/tests/integrationtest/t/util/admin.test @@ -158,4 +158,4 @@ admin check table t; insert into t values (1000, '1000', 1000, '1000', '1000'); admin check table t; -set global tidb_enable_dist_task = default; \ No newline at end of file +set global tidb_enable_dist_task = default;