From f286923b77e3f5126ed7b7521f9917d930a144d5 Mon Sep 17 00:00:00 2001 From: yisaer Date: Mon, 13 Dec 2021 18:24:51 +0800 Subject: [PATCH] address the comment Signed-off-by: yisaer address the comment Signed-off-by: yisaer address the comment Signed-off-by: yisaer address the comment Signed-off-by: yisaer --- ddl/db_partition_test.go | 12 ------------ planner/core/mock.go | 2 ++ planner/core/rule_partition_processor.go | 4 ++-- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/ddl/db_partition_test.go b/ddl/db_partition_test.go index cb012e8b9668d..647c421ab6b0d 100644 --- a/ddl/db_partition_test.go +++ b/ddl/db_partition_test.go @@ -1304,18 +1304,6 @@ func (s *testIntegrationSuite3) TestCreateTableWithKeyPartition(c *C) { tk.MustExec(`create table tm2 (a char(5), unique key(a(5))) partition by key() partitions 5;`) } -func (s *testIntegrationSuite5) TestTry(c *C) { - tk := testkit.NewTestKit(c, s.store) - tk.MustExec("use test;") - tk.MustExec("create table t (x int) partition by hash(x) partitions 4;") - ctx := tk.Se.(sessionctx.Context) - is := domain.GetDomain(ctx).InfoSchema() - tbl, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("t")) - c.Assert(err, IsNil) - p := tbl.Meta().Partition - fmt.Println(p) -} - func (s *testIntegrationSuite5) TestAlterTableAddPartition(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test;") diff --git a/planner/core/mock.go b/planner/core/mock.go index 4419c6f1c8b7e..4161e235244f4 100644 --- a/planner/core/mock.go +++ b/planner/core/mock.go @@ -470,6 +470,7 @@ func MockRangePartitionTable() *model.TableInfo { return tableInfo } +// MockHashPartitionTable mocks a hash partition table for test func MockHashPartitionTable() *model.TableInfo { definitions := []model.PartitionDefinition{ { @@ -505,6 +506,7 @@ func MockHashPartitionTable() *model.TableInfo { return tableInfo } +// MockListPartitionTable mocks a list partition table for test func MockListPartitionTable() *model.TableInfo { definitions := []model.PartitionDefinition{ { diff --git a/planner/core/rule_partition_processor.go b/planner/core/rule_partition_processor.go index e39404dfd300b..f438b46d6d992 100644 --- a/planner/core/rule_partition_processor.go +++ b/planner/core/rule_partition_processor.go @@ -1396,7 +1396,7 @@ func (s *partitionProcessor) makeUnionAllChildren(ds *DataSource, pi *model.Part children := make([]LogicalPlan, 0, len(pi.Definitions)) partitionNameSet := make(set.StringSet) - usedDefinition := make(map[int64]model.PartitionDefinition, 0) + usedDefinition := make(map[int64]model.PartitionDefinition) for _, r := range or { for i := r.start; i < r.end; i++ { // This is for `table partition (p0,p1)` syntax, only union the specified partition if has specified partitions. @@ -1607,7 +1607,7 @@ func appendMakeUnionAllChildrenTranceStep(ds *DataSource, usedMap map[int64]mode if i > 0 { buffer.WriteString(",") } - buffer.WriteString(fmt.Sprintf("%s", u.Name)) + buffer.WriteString(u.Name.String()) } buffer.WriteString("] after partition pruning") return buffer.String()