From ebbfe127a4ab035e57537f7ec1bc6ceb48307f0d Mon Sep 17 00:00:00 2001 From: sylzd Date: Wed, 4 Aug 2021 22:58:40 +0800 Subject: [PATCH] add test case of show table regions / split table in local temporary tables --- executor/executor_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/executor/executor_test.go b/executor/executor_test.go index 966bf12503b5d..16455159e9b39 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -5227,6 +5227,23 @@ func (s *testSplitTable) TestShowTableRegion(c *C) { _, err = tk.Exec("create global temporary table temporary_table_pre_split(id int ) pre_split_regions=2 ON COMMIT DELETE ROWS;") c.Assert(err.Error(), Equals, ddl.ErrOptOnTemporaryTable.GenWithStackByArgs("pre split regions").Error()) + // Test show table regions and split table on local temporary table + tk.MustExec("drop table if exists t_regions_local_temporary_table") + tk.MustExec("set @@tidb_enable_noop_functions=1;") + tk.MustExec("create temporary table t_regions_local_temporary_table (a int key, b int, c int, index idx(b), index idx2(c));") + // Test show table regions. + _, err = tk.Exec("show table t_regions_local_temporary_table regions") + c.Assert(err.Error(), Equals, plannercore.ErrOptOnTemporaryTable.GenWithStackByArgs("show table regions").Error()) + // Test split table. + _, err = tk.Exec("split table t_regions_local_temporary_table between (-10000) and (10000) regions 4;") + c.Assert(err.Error(), Equals, plannercore.ErrOptOnTemporaryTable.GenWithStackByArgs("split table").Error()) + _, err = tk.Exec("split partition table t_regions_local_temporary_table partition (p1,p2) index idx between (0) and (20000) regions 2;") + c.Assert(err.Error(), Equals, plannercore.ErrOptOnTemporaryTable.GenWithStackByArgs("split table").Error()) + tk.MustExec("drop table if exists t_regions_local_temporary_table") + // Test pre split regions + _, err = tk.Exec("create temporary table local_temporary_table_pre_split(id int ) pre_split_regions=2;") + c.Assert(err.Error(), Equals, ddl.ErrOptOnTemporaryTable.GenWithStackByArgs("pre split regions").Error()) + rows := re.Rows() // Table t_regions should have 5 regions now. // 4 regions to store record data.