diff --git a/pkg/planner/core/BUILD.bazel b/pkg/planner/core/BUILD.bazel index b8dae9df6d796..248ffa2b37e30 100644 --- a/pkg/planner/core/BUILD.bazel +++ b/pkg/planner/core/BUILD.bazel @@ -30,6 +30,7 @@ go_library( "pb_to_plan.go", "physical_plans.go", "plan.go", + "plan_base.go", "plan_cache.go", "plan_cache_lru.go", "plan_cache_param.go", @@ -77,6 +78,7 @@ go_library( "stats.go", "stringer.go", "task.go", + "task_base.go", "tiflash_selection_late_materialization.go", "trace.go", "util.go", @@ -117,6 +119,7 @@ go_library( "//pkg/planner/funcdep", "//pkg/planner/property", "//pkg/planner/util", + "//pkg/planner/util/coreusage", "//pkg/planner/util/debugtrace", "//pkg/planner/util/fixcontrol", "//pkg/privilege", @@ -249,6 +252,7 @@ go_test( "//pkg/planner/core/internal", "//pkg/planner/property", "//pkg/planner/util", + "//pkg/planner/util/coreusage", "//pkg/session", "//pkg/session/types", "//pkg/sessionctx", diff --git a/pkg/planner/core/optimizer.go b/pkg/planner/core/optimizer.go index a7de886760594..1ea82e71ba9aa 100644 --- a/pkg/planner/core/optimizer.go +++ b/pkg/planner/core/optimizer.go @@ -18,7 +18,6 @@ import ( "cmp" "context" "fmt" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "math" "runtime" "slices" @@ -41,6 +40,7 @@ import ( "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/pingcap/tidb/pkg/planner/property" plannerutil "github.com/pingcap/tidb/pkg/planner/util" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/planner/util/debugtrace" "github.com/pingcap/tidb/pkg/privilege" "github.com/pingcap/tidb/pkg/sessionctx" diff --git a/pkg/planner/core/plan_cost_ver1.go b/pkg/planner/core/plan_cost_ver1.go index b49a07854616b..18a60c1c15b0e 100644 --- a/pkg/planner/core/plan_cost_ver1.go +++ b/pkg/planner/core/plan_cost_ver1.go @@ -15,7 +15,6 @@ package core import ( - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "math" "github.com/pingcap/errors" @@ -23,6 +22,7 @@ import ( "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/planner/cardinality" "github.com/pingcap/tidb/pkg/planner/property" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/sessionctx/variable" "github.com/pingcap/tidb/pkg/statistics" "github.com/pingcap/tidb/pkg/util/paging" diff --git a/pkg/planner/core/rule_eliminate_projection.go b/pkg/planner/core/rule_eliminate_projection.go index 98d1b40db3f21..0cab6be023909 100644 --- a/pkg/planner/core/rule_eliminate_projection.go +++ b/pkg/planner/core/rule_eliminate_projection.go @@ -18,12 +18,12 @@ import ( "bytes" "context" "fmt" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/failpoint" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/parser/mysql" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" ) // canProjectionBeEliminatedLoose checks whether a projection can be eliminated, diff --git a/pkg/planner/core/rule_generate_column_substitute.go b/pkg/planner/core/rule_generate_column_substitute.go index f7ce622f44925..3a34bf00ec04c 100644 --- a/pkg/planner/core/rule_generate_column_substitute.go +++ b/pkg/planner/core/rule_generate_column_substitute.go @@ -17,10 +17,10 @@ package core import ( "bytes" "context" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/parser/ast" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/types" h "github.com/pingcap/tidb/pkg/util/hint" ) diff --git a/pkg/planner/core/rule_join_elimination.go b/pkg/planner/core/rule_join_elimination.go index b9476394230bf..f01c1090b1158 100644 --- a/pkg/planner/core/rule_join_elimination.go +++ b/pkg/planner/core/rule_join_elimination.go @@ -18,10 +18,10 @@ import ( "bytes" "context" "fmt" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/parser/ast" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/util/set" ) diff --git a/pkg/planner/core/rule_join_reorder.go b/pkg/planner/core/rule_join_reorder.go index 09fd05d018405..ccc6831b1d64c 100644 --- a/pkg/planner/core/rule_join_reorder.go +++ b/pkg/planner/core/rule_join_reorder.go @@ -18,11 +18,11 @@ import ( "bytes" "context" "fmt" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "slices" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/parser/ast" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" h "github.com/pingcap/tidb/pkg/util/hint" "github.com/pingcap/tidb/pkg/util/plancodec" "github.com/pingcap/tidb/pkg/util/tracing" diff --git a/pkg/planner/core/rule_max_min_eliminate.go b/pkg/planner/core/rule_max_min_eliminate.go index 329020d77c13d..66e8754f79af3 100644 --- a/pkg/planner/core/rule_max_min_eliminate.go +++ b/pkg/planner/core/rule_max_min_eliminate.go @@ -18,7 +18,6 @@ import ( "bytes" "context" "fmt" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/expression/aggregation" @@ -26,6 +25,7 @@ import ( "github.com/pingcap/tidb/pkg/parser/model" "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/pingcap/tidb/pkg/planner/util" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/types" "github.com/pingcap/tidb/pkg/util/ranger" ) diff --git a/pkg/planner/core/rule_partition_processor.go b/pkg/planner/core/rule_partition_processor.go index 6d6d4cf949231..5831d5d190acc 100644 --- a/pkg/planner/core/rule_partition_processor.go +++ b/pkg/planner/core/rule_partition_processor.go @@ -19,7 +19,6 @@ import ( "cmp" "context" "fmt" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "math" "slices" "sort" @@ -30,6 +29,7 @@ import ( "github.com/pingcap/tidb/pkg/parser/ast" "github.com/pingcap/tidb/pkg/parser/model" "github.com/pingcap/tidb/pkg/parser/mysql" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/table" "github.com/pingcap/tidb/pkg/table/tables" "github.com/pingcap/tidb/pkg/types" diff --git a/pkg/planner/core/rule_predicate_push_down.go b/pkg/planner/core/rule_predicate_push_down.go index 9f4f73753599e..1b9f9aa2dcfa7 100644 --- a/pkg/planner/core/rule_predicate_push_down.go +++ b/pkg/planner/core/rule_predicate_push_down.go @@ -18,13 +18,13 @@ import ( "bytes" "context" "fmt" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/kv" "github.com/pingcap/tidb/pkg/parser/ast" "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/pingcap/tidb/pkg/planner/util" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/types" "github.com/pingcap/tidb/pkg/util/logutil" "github.com/pingcap/tidb/pkg/util/ranger" diff --git a/pkg/planner/core/rule_predicate_simplification.go b/pkg/planner/core/rule_predicate_simplification.go index 0b26f734a1d42..a3e3ddc02bab3 100644 --- a/pkg/planner/core/rule_predicate_simplification.go +++ b/pkg/planner/core/rule_predicate_simplification.go @@ -17,11 +17,11 @@ package core import ( "context" "errors" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "slices" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/parser/ast" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" ) // predicateSimplification consolidates different predcicates on a column and its equivalence classes. Initial out is for diff --git a/pkg/planner/core/rule_result_reorder.go b/pkg/planner/core/rule_result_reorder.go index 42764f028cb86..5f3d557227493 100644 --- a/pkg/planner/core/rule_result_reorder.go +++ b/pkg/planner/core/rule_result_reorder.go @@ -16,10 +16,10 @@ package core import ( "context" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/planner/util" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" ) /* diff --git a/pkg/planner/core/rule_semi_join_rewrite.go b/pkg/planner/core/rule_semi_join_rewrite.go index fc9222b9784b1..c794871ad1b02 100644 --- a/pkg/planner/core/rule_semi_join_rewrite.go +++ b/pkg/planner/core/rule_semi_join_rewrite.go @@ -16,11 +16,11 @@ package core import ( "context" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/expression/aggregation" "github.com/pingcap/tidb/pkg/parser/ast" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" h "github.com/pingcap/tidb/pkg/util/hint" ) diff --git a/pkg/planner/core/rule_topn_push_down.go b/pkg/planner/core/rule_topn_push_down.go index d1802374b7f4f..4bd7d64e7a92a 100644 --- a/pkg/planner/core/rule_topn_push_down.go +++ b/pkg/planner/core/rule_topn_push_down.go @@ -18,10 +18,10 @@ import ( "bytes" "context" "fmt" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/expression" "github.com/pingcap/tidb/pkg/planner/util" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" ) // pushDownTopNOptimizer pushes down the topN or limit. In the future we will remove the limit from `requiredProperty` in CBO phase. diff --git a/pkg/planner/core/util.go b/pkg/planner/core/util.go index ad3dd1a25b4cb..95bf09d0f38f0 100644 --- a/pkg/planner/core/util.go +++ b/pkg/planner/core/util.go @@ -16,7 +16,6 @@ package core import ( "fmt" - "github.com/pingcap/tidb/pkg/planner/util/coreusage" "slices" "strings" @@ -26,6 +25,7 @@ import ( "github.com/pingcap/tidb/pkg/parser/model" "github.com/pingcap/tidb/pkg/parser/mysql" "github.com/pingcap/tidb/pkg/planner/core/internal/base" + "github.com/pingcap/tidb/pkg/planner/util/coreusage" "github.com/pingcap/tidb/pkg/sessionctx" "github.com/pingcap/tidb/pkg/table" "github.com/pingcap/tidb/pkg/tablecodec" diff --git a/pkg/planner/util/BUILD.bazel b/pkg/planner/util/BUILD.bazel index e1ab66724eb81..af04ffaa5c027 100644 --- a/pkg/planner/util/BUILD.bazel +++ b/pkg/planner/util/BUILD.bazel @@ -6,7 +6,6 @@ go_library( "byitem.go", "expression.go", "misc.go", - "optTracer.go", "path.go", ], importpath = "github.com/pingcap/tidb/pkg/planner/util", @@ -21,7 +20,6 @@ go_library( "//pkg/util/collate", "//pkg/util/ranger", "//pkg/util/size", - "//pkg/util/tracing", ], ) diff --git a/pkg/planner/util/coreusage/BUILD.bazel b/pkg/planner/util/coreusage/BUILD.bazel new file mode 100644 index 0000000000000..a85085832c0bf --- /dev/null +++ b/pkg/planner/util/coreusage/BUILD.bazel @@ -0,0 +1,12 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "coreusage", + srcs = [ + "costMisc.go", + "optTracer.go", + ], + importpath = "github.com/pingcap/tidb/pkg/planner/util/coreusage", + visibility = ["//visibility:public"], + deps = ["//pkg/util/tracing"], +)