From 300fc952389da5dcb3fd3523537430cd6d6cad4a Mon Sep 17 00:00:00 2001 From: JmPotato Date: Fri, 21 May 2021 13:40:12 +0800 Subject: [PATCH] Remove the unnecessary use of fmt.Sprintf Signed-off-by: JmPotato --- executor/partition_table_test.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/executor/partition_table_test.go b/executor/partition_table_test.go index 7398789eadba5..9590c7ed4ceb2 100644 --- a/executor/partition_table_test.go +++ b/executor/partition_table_test.go @@ -469,8 +469,8 @@ func (s *partitionTableSuite) TestDirectReadingwithIndexJoin(c *C) { tk.MustExec("insert ignore into touter values " + strings.Join(vals, ",")) // test indexLookUp + hash - queryPartition := fmt.Sprintf("select /*+ INL_JOIN(touter, thash) */ * from touter join thash use index(idx_b) on touter.b = thash.b") - queryRegular := fmt.Sprintf("select /*+ INL_JOIN(touter, tnormal) */ * from touter join tnormal use index(idx_b) on touter.b = tnormal.b") + queryPartition := "select /*+ INL_JOIN(touter, thash) */ * from touter join thash use index(idx_b) on touter.b = thash.b" + queryRegular := "select /*+ INL_JOIN(touter, tnormal) */ * from touter join tnormal use index(idx_b) on touter.b = tnormal.b" tk.MustQuery("explain format = 'brief' " + queryPartition).Check(testkit.Rows( "IndexJoin 12487.50 root inner join, inner:IndexLookUp, outer key:test_dr_join.touter.b, inner key:test_dr_join.thash.b, equal cond:eq(test_dr_join.touter.b, test_dr_join.thash.b)", "├─TableReader(Build) 9990.00 root data:Selection", @@ -483,8 +483,8 @@ func (s *partitionTableSuite) TestDirectReadingwithIndexJoin(c *C) { tk.MustQuery(queryPartition).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) // test tableReader + hash - queryPartition = fmt.Sprintf("select /*+ INL_JOIN(touter, thash) */ * from touter join thash on touter.a = thash.a") - queryRegular = fmt.Sprintf("select /*+ INL_JOIN(touter, tnormal) */ * from touter join tnormal on touter.a = tnormal.a") + queryPartition = "select /*+ INL_JOIN(touter, thash) */ * from touter join thash on touter.a = thash.a" + queryRegular = "select /*+ INL_JOIN(touter, tnormal) */ * from touter join tnormal on touter.a = tnormal.a" tk.MustQuery("explain format = 'brief' " + queryPartition).Check(testkit.Rows( "IndexJoin 12487.50 root inner join, inner:TableReader, outer key:test_dr_join.touter.a, inner key:test_dr_join.thash.a, equal cond:eq(test_dr_join.touter.a, test_dr_join.thash.a)", "├─TableReader(Build) 9990.00 root data:Selection", @@ -495,8 +495,8 @@ func (s *partitionTableSuite) TestDirectReadingwithIndexJoin(c *C) { tk.MustQuery(queryPartition).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) // test indexReader + hash - queryPartition = fmt.Sprintf("select /*+ INL_JOIN(touter, thash) */ thash.b from touter join thash use index(idx_b) on touter.b = thash.b;") - queryRegular = fmt.Sprintf("select /*+ INL_JOIN(touter, tnormal) */ tnormal.b from touter join tnormal use index(idx_b) on touter.b = tnormal.b;") + queryPartition = "select /*+ INL_JOIN(touter, thash) */ thash.b from touter join thash use index(idx_b) on touter.b = thash.b;" + queryRegular = "select /*+ INL_JOIN(touter, tnormal) */ tnormal.b from touter join tnormal use index(idx_b) on touter.b = tnormal.b;" tk.MustQuery("explain format = 'brief' " + queryPartition).Check(testkit.Rows( "IndexJoin 12487.50 root inner join, inner:IndexReader, outer key:test_dr_join.touter.b, inner key:test_dr_join.thash.b, equal cond:eq(test_dr_join.touter.b, test_dr_join.thash.b)", "├─TableReader(Build) 9990.00 root data:Selection", @@ -509,8 +509,8 @@ func (s *partitionTableSuite) TestDirectReadingwithIndexJoin(c *C) { // test indexLookUp + range // explain select /*+ INL_JOIN(touter, tinner) */ * from touter join tinner use index(a) on touter.a = tinner.a; - queryPartition = fmt.Sprintf("select /*+ INL_JOIN(touter, trange) */ * from touter join trange use index(idx_b) on touter.b = trange.b;") - queryRegular = fmt.Sprintf("select /*+ INL_JOIN(touter, tnormal) */ * from touter join tnormal use index(idx_b) on touter.b = tnormal.b;") + queryPartition = "select /*+ INL_JOIN(touter, trange) */ * from touter join trange use index(idx_b) on touter.b = trange.b;" + queryRegular = "select /*+ INL_JOIN(touter, tnormal) */ * from touter join tnormal use index(idx_b) on touter.b = tnormal.b;" tk.MustQuery("explain format = 'brief' " + queryPartition).Check(testkit.Rows( "IndexJoin 12487.50 root inner join, inner:IndexLookUp, outer key:test_dr_join.touter.b, inner key:test_dr_join.trange.b, equal cond:eq(test_dr_join.touter.b, test_dr_join.trange.b)", "├─TableReader(Build) 9990.00 root data:Selection", @@ -523,8 +523,8 @@ func (s *partitionTableSuite) TestDirectReadingwithIndexJoin(c *C) { tk.MustQuery(queryPartition).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) // test tableReader + range - queryPartition = fmt.Sprintf("select /*+ INL_JOIN(touter, trange) */ * from touter join trange on touter.a = trange.a;") - queryRegular = fmt.Sprintf("select /*+ INL_JOIN(touter, tnormal) */ * from touter join tnormal on touter.a = tnormal.a;") + queryPartition = "select /*+ INL_JOIN(touter, trange) */ * from touter join trange on touter.a = trange.a;" + queryRegular = "select /*+ INL_JOIN(touter, tnormal) */ * from touter join tnormal on touter.a = tnormal.a;" tk.MustQuery("explain format = 'brief' " + queryPartition).Check(testkit.Rows( "IndexJoin 12487.50 root inner join, inner:TableReader, outer key:test_dr_join.touter.a, inner key:test_dr_join.trange.a, equal cond:eq(test_dr_join.touter.a, test_dr_join.trange.a)", "├─TableReader(Build) 9990.00 root data:Selection", @@ -536,8 +536,8 @@ func (s *partitionTableSuite) TestDirectReadingwithIndexJoin(c *C) { // test indexReader + range // explain select /*+ INL_JOIN(touter, tinner) */ tinner.a from touter join tinner on touter.a = tinner.a; - queryPartition = fmt.Sprintf("select /*+ INL_JOIN(touter, trange) */ trange.b from touter join trange use index(idx_b) on touter.b = trange.b;") - queryRegular = fmt.Sprintf("select /*+ INL_JOIN(touter, tnormal) */ tnormal.b from touter join tnormal use index(idx_b) on touter.b = tnormal.b;") + queryPartition = "select /*+ INL_JOIN(touter, trange) */ trange.b from touter join trange use index(idx_b) on touter.b = trange.b;" + queryRegular = "select /*+ INL_JOIN(touter, tnormal) */ tnormal.b from touter join tnormal use index(idx_b) on touter.b = tnormal.b;" tk.MustQuery("explain format = 'brief' " + queryPartition).Check(testkit.Rows( "IndexJoin 12487.50 root inner join, inner:IndexReader, outer key:test_dr_join.touter.b, inner key:test_dr_join.trange.b, equal cond:eq(test_dr_join.touter.b, test_dr_join.trange.b)", "├─TableReader(Build) 9990.00 root data:Selection",