MCPcopy
hub / github.com/pingcap/tidb / TestIssue40679

Function TestIssue40679

pkg/planner/core/plan_cache_test.go:462–479  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

460}
461
462func TestIssue40679(t *testing.T) {
463 store := testkit.CreateMockStore(t)
464 tk := testkit.NewTestKit(t, store)
465 tk.MustExec("use test")
466 tk.MustExec("create table t (a int, key(a));")
467 tk.MustExec("prepare st from 'select * from t use index(a) where a < ?'")
468 tk.MustExec("set @a1=1.1")
469 tk.MustExec("execute st using @a1")
470
471 tkProcess := tk.Session().ShowProcess()
472 ps := []*util.ProcessInfo{tkProcess}
473 tk.Session().SetSessionManager(&testkit.MockSessionManager{PS: ps})
474 rows := tk.MustQuery(fmt.Sprintf("explain for connection %d", tkProcess.ID)).Rows()
475 require.True(t, strings.Contains(rows[1][0].(string), "RangeScan")) // RangeScan not FullScan
476
477 tk.MustExec("execute st using @a1")
478 tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1105 skip prepared plan-cache: '1.1' may be converted to INT"))
479}
480
481func TestPlanCacheWithLimit(t *testing.T) {
482 store := testkit.CreateMockStore(t)

Callers

nothing calls this directly

Calls 11

MustExecMethod · 0.95
SessionMethod · 0.95
MustQueryMethod · 0.95
CreateMockStoreFunction · 0.92
NewTestKitFunction · 0.92
RowsFunction · 0.92
ShowProcessMethod · 0.65
SetSessionManagerMethod · 0.65
RowsMethod · 0.65
ContainsMethod · 0.65
CheckMethod · 0.65

Tested by

no test coverage detected