diff --git a/planner/core/casetest/hint/hint_test.go b/planner/core/casetest/hint/hint_test.go index 69f650a0a599f..a232019cf6267 100644 --- a/planner/core/casetest/hint/hint_test.go +++ b/planner/core/casetest/hint/hint_test.go @@ -647,3 +647,16 @@ func TestInvalidHint(t *testing.T) { tk.MustQuery(tt).Check(testkit.Rows(output[i].Plan...)) } } + +func TestIssue46160(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + + tk.MustExec("use test") + tk.MustExec(`create table t1 (a int, key(a))`) + tk.MustExec(`create table t2 (a int, key(a))`) + + query := `select /*+ tidb_inlj(bb) */ aa.* from (select * from t1) as aa left join + (select t2.a, t2.a*2 as a2 from t2) as bb on aa.a=bb.a;` + tk.HasPlan(query, "IndexJoin") +}