Skip to content

Commit 2ce8b56

Browse files
authored
planner: remove internal pkg and move base code to certain place (#52620)
ref #51664
1 parent 2e1d9e1 commit 2ce8b56

28 files changed

+65
-65
lines changed

pkg/planner/core/BUILD.bazel

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,8 @@ go_library(
113113
"//pkg/planner/cardinality",
114114
"//pkg/planner/context",
115115
"//pkg/planner/core/base",
116-
"//pkg/planner/core/internal",
117-
"//pkg/planner/core/internal/base",
118116
"//pkg/planner/core/metrics",
117+
"//pkg/planner/core/operator/base",
119118
"//pkg/planner/funcdep",
120119
"//pkg/planner/property",
121120
"//pkg/planner/util",
@@ -251,9 +250,9 @@ go_test(
251250
"//pkg/parser/terror",
252251
"//pkg/planner",
253252
"//pkg/planner/core/base",
254-
"//pkg/planner/core/internal",
255253
"//pkg/planner/property",
256254
"//pkg/planner/util",
255+
"//pkg/planner/util/coretestsdk",
257256
"//pkg/planner/util/coreusage",
258257
"//pkg/session",
259258
"//pkg/session/types",

pkg/planner/core/casetest/enforcempp/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ go_test(
1313
deps = [
1414
"//pkg/domain",
1515
"//pkg/parser/model",
16-
"//pkg/planner/core/internal",
16+
"//pkg/planner/util/coretestsdk",
1717
"//pkg/sessionctx/stmtctx",
1818
"//pkg/testkit",
1919
"//pkg/testkit/external",

pkg/planner/core/casetest/enforcempp/enforce_mpp_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
"github.com/pingcap/tidb/pkg/domain"
2323
"github.com/pingcap/tidb/pkg/parser/model"
24-
"github.com/pingcap/tidb/pkg/planner/core/internal"
24+
"github.com/pingcap/tidb/pkg/planner/util/coretestsdk"
2525
"github.com/pingcap/tidb/pkg/sessionctx/stmtctx"
2626
"github.com/pingcap/tidb/pkg/testkit"
2727
"github.com/pingcap/tidb/pkg/testkit/external"
@@ -532,7 +532,7 @@ func TestMPPSingleDistinct3Stage(t *testing.T) {
532532
//
533533
// since it doesn't change the schema out (index ref is still the right), so by now it's fine. SEE case: EXPLAIN select count(distinct a), count(distinct b), sum(c) from t.
534534
func TestMPPMultiDistinct3Stage(t *testing.T) {
535-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2))
535+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(2))
536536
tk := testkit.NewTestKit(t, store)
537537

538538
// test table
@@ -590,7 +590,7 @@ func TestMPPMultiDistinct3Stage(t *testing.T) {
590590

591591
// Test null-aware semi join push down for MPP mode
592592
func TestMPPNullAwareSemiJoinPushDown(t *testing.T) {
593-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2))
593+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(2))
594594
tk := testkit.NewTestKit(t, store)
595595

596596
// test table
@@ -638,7 +638,7 @@ func TestMPPNullAwareSemiJoinPushDown(t *testing.T) {
638638
}
639639

640640
func TestMPPSharedCTEScan(t *testing.T) {
641-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2))
641+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(2))
642642
tk := testkit.NewTestKit(t, store)
643643

644644
// test table
@@ -686,7 +686,7 @@ func TestMPPSharedCTEScan(t *testing.T) {
686686
}
687687

688688
func TestRollupMPP(t *testing.T) {
689-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2))
689+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(2))
690690
tk := testkit.NewTestKit(t, store)
691691

692692
tk.MustExec("use test")

pkg/planner/core/casetest/hint/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ go_test(
1414
"//pkg/config",
1515
"//pkg/domain",
1616
"//pkg/parser/model",
17-
"//pkg/planner/core/internal",
17+
"//pkg/planner/util/coretestsdk",
1818
"//pkg/sessionctx/variable",
1919
"//pkg/testkit",
2020
"//pkg/testkit/testdata",

pkg/planner/core/casetest/hint/hint_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919

2020
"github.com/pingcap/tidb/pkg/domain"
2121
"github.com/pingcap/tidb/pkg/parser/model"
22-
"github.com/pingcap/tidb/pkg/planner/core/internal"
22+
"github.com/pingcap/tidb/pkg/planner/util/coretestsdk"
2323
"github.com/pingcap/tidb/pkg/sessionctx/variable"
2424
"github.com/pingcap/tidb/pkg/testkit"
2525
"github.com/pingcap/tidb/pkg/testkit/testdata"
@@ -74,7 +74,7 @@ func TestReadFromStorageHint(t *testing.T) {
7474
}
7575

7676
func TestAllViewHintType(t *testing.T) {
77-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2))
77+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(2))
7878
tk := testkit.NewTestKit(t, store)
7979

8080
tk.MustExec("use test")
@@ -140,7 +140,7 @@ func TestAllViewHintType(t *testing.T) {
140140
}
141141

142142
func TestJoinHintCompatibility(t *testing.T) {
143-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2))
143+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(2))
144144
tk := testkit.NewTestKit(t, store)
145145

146146
tk.MustExec("use test")

pkg/planner/core/casetest/partition/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ go_test(
1313
shard_count = 7,
1414
deps = [
1515
"//pkg/config",
16-
"//pkg/planner/core/internal",
16+
"//pkg/planner/util/coretestsdk",
1717
"//pkg/sessionctx/variable",
1818
"//pkg/testkit",
1919
"//pkg/testkit/testdata",

pkg/planner/core/casetest/partition/partition_pruner_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"testing"
2323

2424
"github.com/pingcap/failpoint"
25-
"github.com/pingcap/tidb/pkg/planner/core/internal"
25+
"github.com/pingcap/tidb/pkg/planner/util/coretestsdk"
2626
"github.com/pingcap/tidb/pkg/sessionctx/variable"
2727
"github.com/pingcap/tidb/pkg/testkit"
2828
"github.com/pingcap/tidb/pkg/testkit/testdata"
@@ -86,12 +86,12 @@ func getPartitionInfoFromPlan(plan []string) string {
8686
infos := make([]testTablePartitionInfo, 0, 2)
8787
info := testTablePartitionInfo{}
8888
for _, row := range plan {
89-
partitions := internal.GetFieldValue("partition:", row)
89+
partitions := coretestsdk.GetFieldValue("partition:", row)
9090
if partitions != "" {
9191
info.Partitions = partitions
9292
continue
9393
}
94-
tbl := internal.GetFieldValue("table:", row)
94+
tbl := coretestsdk.GetFieldValue("table:", row)
9595
if tbl != "" {
9696
info.Table = tbl
9797
infos = append(infos, info)

pkg/planner/core/casetest/physicalplantest/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ go_test(
2121
"//pkg/parser/model",
2222
"//pkg/planner",
2323
"//pkg/planner/core",
24-
"//pkg/planner/core/internal",
24+
"//pkg/planner/util/coretestsdk",
2525
"//pkg/sessionctx/stmtctx",
2626
"//pkg/testkit",
2727
"//pkg/testkit/external",

pkg/planner/core/casetest/physicalplantest/physical_plan_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
"github.com/pingcap/tidb/pkg/parser/model"
3131
"github.com/pingcap/tidb/pkg/planner"
3232
"github.com/pingcap/tidb/pkg/planner/core"
33-
"github.com/pingcap/tidb/pkg/planner/core/internal"
33+
"github.com/pingcap/tidb/pkg/planner/util/coretestsdk"
3434
"github.com/pingcap/tidb/pkg/sessionctx/stmtctx"
3535
"github.com/pingcap/tidb/pkg/testkit"
3636
"github.com/pingcap/tidb/pkg/testkit/external"
@@ -211,7 +211,7 @@ func TestUnmatchedTableInHint(t *testing.T) {
211211
}
212212

213213
func TestIssue37520(t *testing.T) {
214-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2))
214+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(2))
215215
tk := testkit.NewTestKit(t, store)
216216
tk.MustExec("use test")
217217
tk.MustExec("set tidb_cost_model_version=2")
@@ -241,7 +241,7 @@ func TestIssue37520(t *testing.T) {
241241
}
242242

243243
func TestMPPHints(t *testing.T) {
244-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2))
244+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(2))
245245
tk := testkit.NewTestKit(t, store)
246246
tk.MustExec("use test")
247247
tk.MustExec("set tidb_cost_model_version=2")
@@ -283,7 +283,7 @@ func TestMPPHints(t *testing.T) {
283283
}
284284

285285
func TestMPPHintsScope(t *testing.T) {
286-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(2))
286+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(2))
287287
tk := testkit.NewTestKit(t, store)
288288
tk.MustExec("use test")
289289
tk.MustExec("set tidb_cost_model_version=2")
@@ -340,7 +340,7 @@ func TestMPPBCJModel(t *testing.T) {
340340
Probe: sizeof(Data) * 2 / 3
341341
exchange size: Build + Probe = 4/3 * sizeof(Data)
342342
*/
343-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(3))
343+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(3))
344344
{
345345
cnt, err := store.GetMPPClient().GetMPPStoreCount()
346346
require.Equal(t, cnt, 3)
@@ -382,7 +382,7 @@ func TestMPPBCJModel(t *testing.T) {
382382
}
383383

384384
func TestMPPPreferBCJ(t *testing.T) {
385-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(3))
385+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(3))
386386
tk := testkit.NewTestKit(t, store)
387387
tk.MustExec("use test")
388388
tk.MustExec("drop table if exists t1")
@@ -449,7 +449,7 @@ func TestMPPBCJModelOneTiFlash(t *testing.T) {
449449
Probe: sizeof(Data) * 0 / 1
450450
exchange size: Build + Probe = 0 * sizeof(Data)
451451
*/
452-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(1))
452+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(1))
453453
tk := testkit.NewTestKit(t, store)
454454
tk.MustExec("use test")
455455
tk.MustExec("create table t (a int, b int, c int, index idx_a(a), index idx_b(b))")
@@ -500,7 +500,7 @@ func TestMPPBCJModelOneTiFlash(t *testing.T) {
500500
}
501501

502502
func TestMPPRightSemiJoin(t *testing.T) {
503-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(3))
503+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(3))
504504
tk := testkit.NewTestKit(t, store)
505505
tk.MustExec("use test")
506506
tk.MustExec("drop table if exists t1")
@@ -556,7 +556,7 @@ func TestMPPRightSemiJoin(t *testing.T) {
556556
}
557557

558558
func TestMPPRightOuterJoin(t *testing.T) {
559-
store := testkit.CreateMockStore(t, internal.WithMockTiFlash(3))
559+
store := testkit.CreateMockStore(t, coretestsdk.WithMockTiFlash(3))
560560
tk := testkit.NewTestKit(t, store)
561561
tk.MustExec("use test")
562562
tk.MustExec("drop table if exists t1")

pkg/planner/core/casetest/rule/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ go_test(
1919
"//pkg/parser/ast",
2020
"//pkg/parser/model",
2121
"//pkg/parser/mysql",
22-
"//pkg/planner/core/internal",
22+
"//pkg/planner/util/coretestsdk",
23+
"//pkg/planner/util/coreusage",
2324
"//pkg/testkit",
2425
"//pkg/testkit/testdata",
2526
"//pkg/testkit/testmain",

0 commit comments

Comments
 (0)