File tree Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import (
29
29
"github.com/pingcap/tidb/pkg/planner/util/optimizetrace"
30
30
"github.com/pingcap/tidb/pkg/sessionctx/variable"
31
31
"github.com/pingcap/tidb/pkg/statistics"
32
+ "github.com/pingcap/tidb/pkg/util/intest"
32
33
"github.com/pingcap/tidb/pkg/util/paging"
33
34
)
34
35
@@ -87,6 +88,7 @@ func (p *PhysicalProjection) GetCost(count float64) float64 {
87
88
88
89
// GetPlanCostVer1 calculates the cost of the plan if it has not been calculated yet and returns the cost.
89
90
func (p * PhysicalProjection ) GetPlanCostVer1 (taskType property.TaskType , option * optimizetrace.PlanCostOption ) (float64 , error ) {
91
+ intest .Assert (p .SCtx ().GetSessionVars ().CostModelVersion != 0 )
90
92
costFlag := option .CostFlag
91
93
if p .PlanCostInit && ! hasCostFlag (costFlag , costusage .CostFlagRecalculate ) {
92
94
return p .PlanCost , nil
Original file line number Diff line number Diff line change @@ -2189,6 +2189,7 @@ func NewSessionVars(hctx HookContext) *SessionVars {
2189
2189
GroupConcatMaxLen : DefGroupConcatMaxLen ,
2190
2190
EnableRedactLog : DefTiDBRedactLog ,
2191
2191
EnableWindowFunction : DefEnableWindowFunction ,
2192
+ CostModelVersion : DefTiDBCostModelVer ,
2192
2193
}
2193
2194
vars .status .Store (uint32 (mysql .ServerStatusAutocommit ))
2194
2195
vars .StmtCtx .ResourceGroupName = resourcegroup .DefaultResourceGroupName
You can’t perform that action at this time.
0 commit comments