diff --git a/executor/executor_legacy_test.go b/executor/executor_legacy_test.go index 8b31f528667cc..5de18019dd4af 100644 --- a/executor/executor_legacy_test.go +++ b/executor/executor_legacy_test.go @@ -58,7 +58,6 @@ import ( "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/sessionctx/stmtctx" "github.com/pingcap/tidb/sessionctx/variable" - "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/store/copr" error2 "github.com/pingcap/tidb/store/driver/error" "github.com/pingcap/tidb/store/mockstore" @@ -93,10 +92,8 @@ func TestT(t *testing.T) { } var _ = Suite(&testSuite{&baseTestSuite{}}) -var _ = Suite(&testSuiteP1{&baseTestSuite{}}) var _ = Suite(&testSuiteP2{&baseTestSuite{}}) var _ = Suite(&testSuite1{}) -var _ = SerialSuites(&testSerialSuite2{}) var _ = SerialSuites(&testSuiteWithCliBaseCharset{}) var _ = Suite(&testSuite2{&baseTestSuite{}}) var _ = Suite(&testSuite3{&baseTestSuite{}}) @@ -106,14 +103,11 @@ var _ = SerialSuites(&testRecoverTable{}) var _ = SerialSuites(&testClusterTableSuite{}) var _ = SerialSuites(&testSplitTable{&baseTestSuite{}}) var _ = SerialSuites(&testSerialSuite1{&baseTestSuite{}}) -var _ = SerialSuites(&globalIndexSuite{&baseTestSuite{}}) var _ = SerialSuites(&testSerialSuite{&baseTestSuite{}}) type testSuite struct{ *baseTestSuite } -type testSuiteP1 struct{ *baseTestSuite } type testSuiteP2 struct{ *baseTestSuite } type testSplitTable struct{ *baseTestSuite } -type globalIndexSuite struct{ *baseTestSuite } type testSerialSuite struct{ *baseTestSuite } // MockGC is used to make GC work in the test environment. @@ -175,13 +169,6 @@ func (s *baseTestSuite) TearDownSuite(c *C) { c.Assert(s.store.Close(), IsNil) } -func (s *globalIndexSuite) SetUpSuite(c *C) { - s.baseTestSuite.SetUpSuite(c) - config.UpdateGlobal(func(conf *config.Config) { - conf.EnableGlobalIndex = true - }) -} - func (s *testSuite) TearDownTest(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") @@ -2088,10 +2075,6 @@ type testSuite1 struct { testSuiteWithCliBase } -type testSerialSuite2 struct { - testSuiteWithCliBase -} - func (s *testSuiteWithCliBase) SetUpSuite(c *C) { cli := &checkRequestClient{} hijackClient := func(c tikv.Client) tikv.Client { @@ -3277,22 +3260,6 @@ func (s *testSuiteP2) TestIssue10435(c *C) { ) } -func (s *testSerialSuite2) TestUnsignedFeedback(c *C) { - tk := testkit.NewTestKit(c, s.store) - oriProbability := statistics.FeedbackProbability.Load() - statistics.FeedbackProbability.Store(1.0) - defer func() { statistics.FeedbackProbability.Store(oriProbability) }() - tk.MustExec("use test") - tk.MustExec("drop table if exists t") - tk.MustExec("create table t(a bigint unsigned, b int, primary key(a))") - tk.MustExec("insert into t values (1,1),(2,2)") - tk.MustExec("analyze table t") - tk.MustQuery("select count(distinct b) from t").Check(testkit.Rows("2")) - result := tk.MustQuery("explain analyze select count(distinct b) from t") - c.Assert(result.Rows()[2][4], Equals, "table:t") - c.Assert(result.Rows()[2][6], Equals, "keep order:false") -} - func (s *testSuiteWithCliBaseCharset) TestCharsetFeature(c *C) { tk := testkit.NewTestKit(c, s.store) tk.MustExec("use test") diff --git a/executor/executor_test.go b/executor/executor_test.go index 7f09b575c5d9a..525877a8b84e8 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -23,6 +23,7 @@ import ( "github.com/pingcap/tidb/domain" "github.com/pingcap/tidb/parser/mysql" "github.com/pingcap/tidb/sessionctx/variable" + "github.com/pingcap/tidb/statistics" "github.com/pingcap/tidb/testkit" "github.com/pingcap/tidb/testkit/testdata" "github.com/pingcap/tidb/util/dbterror" @@ -1523,3 +1524,21 @@ func TestDropColWithPrimaryKey(t *testing.T) { tk.MustExec("set global tidb_enable_change_multi_schema = on") tk.MustExec("alter table t drop column c3") } + +func TestUnsignedFeedback(t *testing.T) { + store, clean := testkit.CreateMockStore(t) + defer clean() + + tk := testkit.NewTestKit(t, store) + oriProbability := statistics.FeedbackProbability.Load() + statistics.FeedbackProbability.Store(1.0) + defer func() { statistics.FeedbackProbability.Store(oriProbability) }() + tk.MustExec("use test") + tk.MustExec("create table t(a bigint unsigned, b int, primary key(a))") + tk.MustExec("insert into t values (1,1),(2,2)") + tk.MustExec("analyze table t") + tk.MustQuery("select count(distinct b) from t").Check(testkit.Rows("2")) + result := tk.MustQuery("explain analyze select count(distinct b) from t") + require.Equal(t, "table:t", result.Rows()[2][4]) + require.Equal(t, "keep order:false", result.Rows()[2][6]) +}