diff --git a/pkg/executor/index_lookup_merge_join.go b/pkg/executor/index_lookup_merge_join.go index 99fffebb4daec..6396731b4fd6e 100644 --- a/pkg/executor/index_lookup_merge_join.go +++ b/pkg/executor/index_lookup_merge_join.go @@ -441,12 +441,16 @@ func (imw *innerMergeWorker) handleTask(ctx context.Context, task *lookUpMergeJo } } task.memTracker.Consume(int64(cap(task.outerOrderIdx))) +<<<<<<< HEAD:pkg/executor/index_lookup_merge_join.go failpoint.Inject("IndexMergeJoinMockOOM", func(val failpoint.Value) { if val.(bool) { panic("OOM test index merge join doesn't hang here.") } }) // needOuterSort means the outer side property items can't guarantee the order of join keys. +======= + // NeedOuterSort means the outer side property items can't guarantee the order of join keys. +>>>>>>> 628b7ed6739 (planner: deprecate index lookup merge join. (#54681)):pkg/executor/join/index_lookup_merge_join.go // Because the necessary condition of merge join is both outer and inner keep order of join keys. // In this case, we need sort the outer side. if imw.outerMergeCtx.needOuterSort { diff --git a/pkg/executor/index_lookup_merge_join_test.go b/pkg/executor/index_lookup_merge_join_test.go index 502064642c2f6..40622eb44ee5b 100644 --- a/pkg/executor/index_lookup_merge_join_test.go +++ b/pkg/executor/index_lookup_merge_join_test.go @@ -22,6 +22,7 @@ import ( "github.com/stretchr/testify/require" ) +<<<<<<< HEAD:pkg/executor/index_lookup_merge_join_test.go func TestIndexLookupMergeJoinHang(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/executor/IndexMergeJoinMockOOM", `return(true)`)) defer func() { @@ -41,6 +42,8 @@ func TestIndexLookupMergeJoinHang(t *testing.T) { require.Equal(t, "OOM test index merge join doesn't hang here.", err.Error()) } +======= +>>>>>>> 628b7ed6739 (planner: deprecate index lookup merge join. (#54681)):pkg/executor/join/index_lookup_merge_join_test.go func TestIssue18068(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/executor/testIssue18068", `return(true)`)) defer func() { @@ -64,3 +67,18 @@ func TestIssue18068(t *testing.T) { tk.MustExec("select /*+ inl_merge_join(s)*/ 1 from t join s on t.a = s.a limit 1") tk.MustExec("select /*+ inl_merge_join(s)*/ 1 from t join s on t.a = s.a limit 1") } + +func TestIssue54064(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + tk.MustExec("use test") + tk.MustExec("drop table if exists A, B") + tk.MustExec("create table A\n(id int primary key nonclustered auto_increment,\nx varchar(32) not null,\ny char(5) not null,\nz varchar(25) not null,\nkey idx_sub_tsk(z,x,y)\n)") + tk.MustExec("create table B\n( y char(5) not null,\nz varchar(25) not null,\nx varchar(32) not null,\nprimary key(z, x, y) nonclustered\n)\n") + tk.MustExec("insert into A (y, z, x) values\n('CN000', '123', 'RW '),\n('CN000', '456', '123');") + tk.MustExec("insert into B values\n('CN000', '123', 'RW '),\n('CN000', '456', '123');") + tk.MustQuery("select /*+ inl_merge_join(a, b) */\na.*\nfrom a join b on a.y=b.y and a.z=b.z and a.x = b.x\nwhere a.y='CN000' order by 1,2;").Check( + testkit.Rows("1 RW CN000 123", "2 123 CN000 456")) + res := tk.MustQuery("explain format='brief' select /*+ inl_merge_join(a, b) */\na.*\nfrom a join b on a.y=b.y and a.z=b.z and a.x = b.x\nwhere a.y='CN000' order by 1,2;") + require.NotRegexp(t, "IndexMergeJoin_.*", res.Rows()[0][0]) +} diff --git a/pkg/executor/partition_table_test.go b/pkg/executor/partition_table_test.go index 6e6f8335b1d36..1d89652711846 100644 --- a/pkg/executor/partition_table_test.go +++ b/pkg/executor/partition_table_test.go @@ -1182,49 +1182,49 @@ func TestPartitionTableWithDifferentJoin(t *testing.T) { // tk.MustHavePlan(queryHash, "IndexMergeJoin") // tk.MustQuery(queryHash).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) tk.MustQuery(queryHash) - tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1815|Optimizer Hint /*+ INL_MERGE_JOIN(trange, trange2) */ is inapplicable")) + tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1815|The INDEX MERGE JOIN hint is deprecated for usage, try other hints.")) queryHash = fmt.Sprintf("select /*+ inl_merge_join(trange, trange2) */ * from trange, trange2 where trange.a=trange2.a and trange.a > %v and trange2.a > %v;", x1, x2) // queryRegular = fmt.Sprintf("select /*+ inl_merge_join(tregular2, tregular4) */ * from tregular2, tregular4 where tregular2.a=tregular4.a and tregular2.a > %v and tregular4.a > %v;", x1, x2) // tk.MustHavePlan(queryHash, "IndexMergeJoin") // tk.MustQuery(queryHash).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) tk.MustQuery(queryHash) - tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1815|Optimizer Hint /*+ INL_MERGE_JOIN(trange, trange2) */ is inapplicable")) + tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1815|The INDEX MERGE JOIN hint is deprecated for usage, try other hints.")) queryHash = fmt.Sprintf("select /*+ inl_merge_join(trange, trange2) */ * from trange, trange2 where trange.a=trange2.a and trange.a > %v and trange.b > %v;", x1, x2) // queryRegular = fmt.Sprintf("select /*+ inl_merge_join(tregular2, tregular4) */ * from tregular2, tregular4 where tregular2.a=tregular4.a and tregular2.a > %v and tregular2.b > %v;", x1, x2) // tk.MustHavePlan(queryHash, "IndexMergeJoin") // tk.MustQuery(queryHash).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) tk.MustQuery(queryHash) - tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1815|Optimizer Hint /*+ INL_MERGE_JOIN(trange, trange2) */ is inapplicable")) + tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1815|The INDEX MERGE JOIN hint is deprecated for usage, try other hints.")) queryHash = fmt.Sprintf("select /*+ inl_merge_join(trange, trange2) */ * from trange, trange2 where trange.a=trange2.a and trange.a > %v and trange2.b > %v;", x1, x2) // queryRegular = fmt.Sprintf("select /*+ inl_merge_join(tregular2, tregular4) */ * from tregular2, tregular4 where tregular2.a=tregular4.a and tregular2.a > %v and tregular4.b > %v;", x1, x2) // tk.MustHavePlan(queryHash, "IndexMergeJoin") // tk.MustQuery(queryHash).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) tk.MustQuery(queryHash) - tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1815|Optimizer Hint /*+ INL_MERGE_JOIN(trange, trange2) */ is inapplicable")) + tk.MustQuery("show warnings").Check(testkit.RowsWithSep("|", "Warning|1815|The INDEX MERGE JOIN hint is deprecated for usage, try other hints.")) // group 6 // index_merge_join range partition and regualr table queryHash = fmt.Sprintf("select /*+ inl_merge_join(trange, tregular4) */ * from trange, tregular4 where trange.a=tregular4.a and trange.a > %v;", x1) queryRegular = fmt.Sprintf("select /*+ inl_merge_join(tregular2, tregular4) */ * from tregular2, tregular4 where tregular2.a=tregular4.a and tregular2.a > %v;", x1) - tk.MustHavePlan(queryHash, "IndexMergeJoin") + tk.MustNotHavePlan(queryHash, "IndexMergeJoin") tk.MustQuery(queryHash).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) queryHash = fmt.Sprintf("select /*+ inl_merge_join(trange, tregular4) */ * from trange, tregular4 where trange.a=tregular4.a and trange.a > %v and tregular4.a > %v;", x1, x2) queryRegular = fmt.Sprintf("select /*+ inl_merge_join(tregular2, tregular4) */ * from tregular2, tregular4 where tregular2.a=tregular4.a and tregular2.a > %v and tregular4.a > %v;", x1, x2) - tk.MustHavePlan(queryHash, "IndexMergeJoin") + tk.MustNotHavePlan(queryHash, "IndexMergeJoin") tk.MustQuery(queryHash).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) queryHash = fmt.Sprintf("select /*+ inl_merge_join(trange, tregular4) */ * from trange, tregular4 where trange.a=tregular4.a and trange.a > %v and trange.b > %v;", x1, x2) queryRegular = fmt.Sprintf("select /*+ inl_merge_join(tregular2, tregular4) */ * from tregular2, tregular4 where tregular2.a=tregular4.a and tregular2.a > %v and tregular2.b > %v;", x1, x2) - tk.MustHavePlan(queryHash, "IndexMergeJoin") + tk.MustNotHavePlan(queryHash, "IndexMergeJoin") tk.MustQuery(queryHash).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) queryHash = fmt.Sprintf("select /*+ inl_merge_join(trange, tregular4) */ * from trange, tregular4 where trange.a=tregular4.a and trange.a > %v and tregular4.b > %v;", x1, x2) queryRegular = fmt.Sprintf("select /*+ inl_merge_join(tregular2, tregular4) */ * from tregular2, tregular4 where tregular2.a=tregular4.a and tregular2.a > %v and tregular4.b > %v;", x1, x2) - tk.MustHavePlan(queryHash, "IndexMergeJoin") + tk.MustNotHavePlan(queryHash, "IndexMergeJoin") tk.MustQuery(queryHash).Sort().Check(tk.MustQuery(queryRegular).Sort().Rows()) // group 7 diff --git a/pkg/executor/test/jointest/hashjoin/hash_join_test.go b/pkg/executor/test/jointest/hashjoin/hash_join_test.go index 6de6676196eb4..19ed1cc91a442 100644 --- a/pkg/executor/test/jointest/hashjoin/hash_join_test.go +++ b/pkg/executor/test/jointest/hashjoin/hash_join_test.go @@ -377,11 +377,6 @@ func TestExplainAnalyzeJoin(t *testing.T) { require.Equal(t, 7, len(rows)) require.Regexp(t, "HashJoin.*", rows[0][0]) require.Regexp(t, "time:.*, loops:.*, build_hash_table:{total:.*, fetch:.*, build:.*}, probe:{concurrency:5, total:.*, max:.*, probe:.*, fetch and wait:.*}", rows[0][5]) - // Test for index merge join. - rows = tk.MustQuery("explain analyze select /*+ INL_MERGE_JOIN(t1, t2) */ * from t1,t2 where t1.a=t2.a;").Rows() - require.Len(t, rows, 9) - require.Regexp(t, "IndexMergeJoin_.*", rows[0][0]) - require.Regexp(t, fmt.Sprintf(".*Concurrency:%v.*", tk.Session().GetSessionVars().IndexLookupJoinConcurrency()), rows[0][5]) // TestExplainAnalyzeIndexHashJoin // Issue 43597 diff --git a/pkg/executor/test/jointest/join_test.go b/pkg/executor/test/jointest/join_test.go index de519cc21f421..9b02847e35605 100644 --- a/pkg/executor/test/jointest/join_test.go +++ b/pkg/executor/test/jointest/join_test.go @@ -136,10 +136,10 @@ func TestJoin2(t *testing.T) { // The physical plans of the two sql are tested at physical_plan_test.go tk.MustQuery("select /*+ INL_JOIN(t, t1) */ * from t join t1 on t.a=t1.a").Check(testkit.Rows("1 1 1 2", "1 1 1 3", "1 1 1 4", "3 3 3 4")) tk.MustQuery("select /*+ INL_HASH_JOIN(t, t1) */ * from t join t1 on t.a=t1.a").Sort().Check(testkit.Rows("1 1 1 2", "1 1 1 3", "1 1 1 4", "3 3 3 4")) - tk.MustQuery("select /*+ INL_MERGE_JOIN(t, t1) */ * from t join t1 on t.a=t1.a").Check(testkit.Rows("1 1 1 2", "1 1 1 3", "1 1 1 4", "3 3 3 4")) + tk.MustQuery("select /*+ INL_MERGE_JOIN(t, t1) */ * from t join t1 on t.a=t1.a").Check(testkit.Rows("1 1 1 4", "1 1 1 3", "1 1 1 2", "3 3 3 4")) tk.MustQuery("select /*+ INL_JOIN(t) */ * from t1 join t on t.a=t1.a and t.a < t1.b").Check(testkit.Rows("1 2 1 1", "1 3 1 1", "1 4 1 1", "3 4 3 3")) tk.MustQuery("select /*+ INL_HASH_JOIN(t) */ * from t1 join t on t.a=t1.a and t.a < t1.b").Sort().Check(testkit.Rows("1 2 1 1", "1 3 1 1", "1 4 1 1", "3 4 3 3")) - tk.MustQuery("select /*+ INL_MERGE_JOIN(t) */ * from t1 join t on t.a=t1.a and t.a < t1.b").Check(testkit.Rows("1 2 1 1", "1 3 1 1", "1 4 1 1", "3 4 3 3")) + tk.MustQuery("select /*+ INL_MERGE_JOIN(t) */ * from t1 join t on t.a=t1.a and t.a < t1.b").Check(testkit.Rows("1 4 1 1", "1 3 1 1", "1 2 1 1", "3 4 3 3")) // Test single index reader. tk.MustQuery("select /*+ INL_JOIN(t, t1) */ t1.b from t1 join t on t.b=t1.b").Check(testkit.Rows("2", "3")) tk.MustQuery("select /*+ INL_HASH_JOIN(t, t1) */ t1.b from t1 join t on t.b=t1.b").Sort().Check(testkit.Rows("2", "3")) diff --git a/pkg/planner/core/casetest/physicalplantest/physical_plan_test.go b/pkg/planner/core/casetest/physicalplantest/physical_plan_test.go index eb2743978a3e0..9cb6e09781179 100644 --- a/pkg/planner/core/casetest/physicalplantest/physical_plan_test.go +++ b/pkg/planner/core/casetest/physicalplantest/physical_plan_test.go @@ -1114,8 +1114,9 @@ func TestIndexJoinHint(t *testing.T) { var input []string var output []struct { - SQL string - Plan string + SQL string + Plan string + Warns []string } is := domain.GetDomain(tk.Session()).InfoSchema() @@ -1124,6 +1125,16 @@ func TestIndexJoinHint(t *testing.T) { planSuiteData := GetPlanSuiteData() planSuiteData.LoadTestCases(t, &input, &output) + filterWarnings := func(originalWarnings []contextutil.SQLWarn) []contextutil.SQLWarn { + warnings := make([]contextutil.SQLWarn, 0, 4) + for _, warning := range originalWarnings { + // filter out warning about skyline pruning + if !strings.Contains(warning.Err.Error(), "remain after pruning paths for") { + warnings = append(warnings, warning) + } + } + return warnings + } for i, tt := range input { comment := fmt.Sprintf("case:%v sql: %s", i, tt) stmt, err := p.ParseOneStmt(tt, "", "") @@ -1133,7 +1144,9 @@ func TestIndexJoinHint(t *testing.T) { testdata.OnRecord(func() { output[i].SQL = tt output[i].Plan = core.ToString(p) + output[i].Warns = testdata.ConvertSQLWarnToStrings(filterWarnings(tk.Session().GetSessionVars().StmtCtx.GetWarnings())) }) + tk.Session().GetSessionVars().StmtCtx.TruncateWarnings(0) require.Equal(t, output[i].Plan, core.ToString(p), comment) } } diff --git a/pkg/planner/core/casetest/physicalplantest/testdata/plan_suite_out.json b/pkg/planner/core/casetest/physicalplantest/testdata/plan_suite_out.json index 77b158932f3ad..8ff990691ccac 100644 --- a/pkg/planner/core/casetest/physicalplantest/testdata/plan_suite_out.json +++ b/pkg/planner/core/casetest/physicalplantest/testdata/plan_suite_out.json @@ -2543,23 +2543,34 @@ "Cases": [ { "SQL": "select /*+ INL_JOIN(t1) */ * from t1 join t2 on t1.a = t2.a;", - "Plan": "IndexJoin{IndexLookUp(Index(t1.idx_a)[[NULL,NULL]]->Sel([not(isnull(test.t1.a))]), Table(t1))->TableReader(Table(t2)->Sel([not(isnull(test.t2.a))]))}(test.t2.a,test.t1.a)" + "Plan": "IndexJoin{IndexLookUp(Index(t1.idx_a)[[NULL,NULL]]->Sel([not(isnull(test.t1.a))]), Table(t1))->TableReader(Table(t2)->Sel([not(isnull(test.t2.a))]))}(test.t2.a,test.t1.a)", + "Warns": null }, { "SQL": "select /*+ INL_HASH_JOIN(t1) */ * from t1 join t2 on t1.a = t2.a;", - "Plan": "IndexHashJoin{IndexLookUp(Index(t1.idx_a)[[NULL,NULL]]->Sel([not(isnull(test.t1.a))]), Table(t1))->TableReader(Table(t2)->Sel([not(isnull(test.t2.a))]))}(test.t2.a,test.t1.a)" + "Plan": "IndexHashJoin{IndexLookUp(Index(t1.idx_a)[[NULL,NULL]]->Sel([not(isnull(test.t1.a))]), Table(t1))->TableReader(Table(t2)->Sel([not(isnull(test.t2.a))]))}(test.t2.a,test.t1.a)", + "Warns": null }, { "SQL": "select /*+ INL_MERGE_JOIN(t1) */ * from t1 join t2 on t1.a = t2.a;", - "Plan": "IndexMergeJoin{IndexLookUp(Index(t1.idx_a)[[NULL,NULL]]->Sel([not(isnull(test.t1.a))]), Table(t1))->Projection->TableReader(Table(t2)->Sel([not(isnull(test.t2.a))]))}(test.t2.a,test.t1.a)" + "Plan": "LeftHashJoin{TableReader(Table(t1)->Sel([not(isnull(test.t1.a))]))->TableReader(Table(t2)->Sel([not(isnull(test.t2.a))]))}(test.t1.a,test.t2.a)", + "Warns": [ + "[planner:1815]The INDEX MERGE JOIN hint is deprecated for usage, try other hints." + ] }, { "SQL": "select /*+ inl_merge_join(t2) */ t1.a, t2.a from t t1 left join t t2 use index(g_2) on t1.g=t2.g", - "Plan": "IndexMergeJoin{IndexReader(Index(t.g_2)[[NULL,+inf]])->IndexReader(Index(t.g_2)[[NULL,NULL]]->Sel([not(isnull(test.t.g))]))}(test.t.g,test.t.g)" + "Plan": "MergeLeftOuterJoin{IndexReader(Index(t.g_2)[[NULL,+inf]])->IndexReader(Index(t.g_2)[[-inf,+inf]])}(test.t.g,test.t.g)", + "Warns": [ + "[planner:1815]The INDEX MERGE JOIN hint is deprecated for usage, try other hints." + ] }, { "SQL": "select /*+inl_merge_join(t2)*/ t1.a, t2.a from t t1 left join t t2 use index(g_2) on t1.g=t2.g order by t1.a", - "Plan": "IndexMergeJoin{IndexReader(Index(t.g_2)[[NULL,+inf]])->IndexReader(Index(t.g_2)[[NULL,NULL]]->Sel([not(isnull(test.t.g))]))}(test.t.g,test.t.g)->Sort" + "Plan": "IndexHashJoin{TableReader(Table(t))->IndexReader(Index(t.g_2)[[NULL,NULL]]->Sel([not(isnull(test.t.g))]))}(test.t.g,test.t.g)", + "Warns": [ + "[planner:1815]The INDEX MERGE JOIN hint is deprecated for usage, try other hints." + ] } ] }, @@ -2686,8 +2697,8 @@ }, { "SQL": "select /*+ INL_MERGE_JOIN(t1) */ t1.b, t2.b from t1 inner join t2 on t1.a = t2.a;", - "Plan": "IndexMergeJoin{IndexLookUp(Index(t1.idx_a)[[NULL,NULL]]->Sel([not(isnull(test.t1.a))]), Table(t1))->Projection->TableReader(Table(t2)->Sel([not(isnull(test.t2.a))]))}(test.t2.a,test.t1.a)", - "Hints": "inl_merge_join(@`sel_1` `test`.`t1`), use_index(@`sel_1` `test`.`t1` `idx_a`), order_index(@`sel_1` `test`.`t1` `idx_a`), use_index(@`sel_1` `test`.`t2` )" + "Plan": "LeftHashJoin{TableReader(Table(t1)->Sel([not(isnull(test.t1.a))]))->TableReader(Table(t2)->Sel([not(isnull(test.t2.a))]))}(test.t1.a,test.t2.a)", + "Hints": "hash_join(@`sel_1` `test`.`t1`), use_index(@`sel_1` `test`.`t1` ), use_index(@`sel_1` `test`.`t2` )" }, { "SQL": "select /*+ MERGE_JOIN(t1) */ t1.b, t2.b from t1 inner join t2 on t1.a = t2.a;", diff --git a/pkg/util/hint/hint.go b/pkg/util/hint/hint.go index e940b6f12b5c5..d01bd1f4443c1 100644 --- a/pkg/util/hint/hint.go +++ b/pkg/util/hint/hint.go @@ -55,7 +55,7 @@ const ( HintINLJ = "inl_join" // HintINLHJ is hint enforce index nested loop hash join. HintINLHJ = "inl_hash_join" - // HintINLMJ is hint enforce index nested loop merge join. + // Deprecated: HintINLMJ is hint enforce index nested loop merge join. HintINLMJ = "inl_merge_join" // HintNoIndexJoin is the hint to enforce the query not to use index join. HintNoIndexJoin = "no_index_join" @@ -708,7 +708,10 @@ func ParsePlanHints(hints []*ast.TableOptimizerHint, case HintINLHJ: inlhjTables = append(inlhjTables, tableNames2HintTableInfo(currentDB, hint.HintName.L, hint.Tables, hintProcessor, currentLevel, warnHandler)...) case HintINLMJ: - inlmjTables = append(inlmjTables, tableNames2HintTableInfo(currentDB, hint.HintName.L, hint.Tables, hintProcessor, currentLevel, warnHandler)...) + if hint.Tables != nil { + warnHandler.SetHintWarning("The INDEX MERGE JOIN hint is deprecated for usage, try other hints.") + continue + } case TiDBHashJoin, HintHJ: hashJoinTables = append(hashJoinTables, tableNames2HintTableInfo(currentDB, hint.HintName.L, hint.Tables, hintProcessor, currentLevel, warnHandler)...) case HintNoHashJoin: diff --git a/tests/integrationtest/r/executor/index_lookup_join.result b/tests/integrationtest/r/executor/index_lookup_join.result index 108be16366349..03443accaa1e5 100644 --- a/tests/integrationtest/r/executor/index_lookup_join.result +++ b/tests/integrationtest/r/executor/index_lookup_join.result @@ -90,12 +90,12 @@ select /*+ INL_MERGE_JOIN(t1, t2) */ * from t1, t2; a b a b show warnings; Level Code Message -Warning 1815 Optimizer Hint /*+ INL_MERGE_JOIN(t1, t2) */ is inapplicable without column equal ON condition +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. select /*+ INL_MERGE_JOIN(t1, t2) */ * from t1 join t2 on t1.a=t2.a; a b a b show warnings; Level Code Message -Warning 1815 Optimizer Hint /*+ INL_MERGE_JOIN(t1, t2) */ is inapplicable +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. drop table if exists t1, t2; create table t1(a bigint, b bigint, index idx_a(a)); create table t2(a bigint, b bigint); @@ -123,12 +123,12 @@ select /*+ INL_MERGE_JOIN(t1) */ * from t1 left join t2 on t1.a=t2.a; a b a b show warnings; Level Code Message -Warning 1815 Optimizer Hint /*+ INL_MERGE_JOIN(t1) */ is inapplicable +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. select /*+ INL_MERGE_JOIN(t2) */ * from t1 right join t2 on t1.a=t2.a; a b a b show warnings; Level Code Message -Warning 1815 Optimizer Hint /*+ INL_MERGE_JOIN(t2) */ is inapplicable +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. drop table if exists t1, t2; create table t1 (a int, key(a)); create table t2 (a int, key(a)); diff --git a/tests/integrationtest/r/executor/index_lookup_merge_join.result b/tests/integrationtest/r/executor/index_lookup_merge_join.result index 9e472f04fe0be..6bde34f686f61 100644 --- a/tests/integrationtest/r/executor/index_lookup_merge_join.result +++ b/tests/integrationtest/r/executor/index_lookup_merge_join.result @@ -11,15 +11,14 @@ insert into t1 values(1,1,1,1),(2,2,2,2),(3,3,3,3); insert into t2 values(1,1,1,1),(2,2,2,2); explain format = 'brief' select /*+ inl_merge_join(t1,t2) */ * from t1 left join t2 on t1.a = t2.a and t1.c = t2.c and t1.b = t2.b order by t1.a desc; id estRows task access object operator info -IndexMergeJoin 100000000.00 root left outer join, inner:Projection, outer key:executor__index_lookup_merge_join.t1.a, executor__index_lookup_merge_join.t1.c, executor__index_lookup_merge_join.t1.b, inner key:executor__index_lookup_merge_join.t2.a, executor__index_lookup_merge_join.t2.c, executor__index_lookup_merge_join.t2.b +IndexJoin 100000000.00 root left outer join, inner:IndexLookUp, outer key:executor__index_lookup_merge_join.t1.a, executor__index_lookup_merge_join.t1.c, executor__index_lookup_merge_join.t1.b, inner key:executor__index_lookup_merge_join.t2.a, executor__index_lookup_merge_join.t2.c, executor__index_lookup_merge_join.t2.b, equal cond:eq(executor__index_lookup_merge_join.t1.a, executor__index_lookup_merge_join.t2.a), eq(executor__index_lookup_merge_join.t1.b, executor__index_lookup_merge_join.t2.b), eq(executor__index_lookup_merge_join.t1.c, executor__index_lookup_merge_join.t2.c) ├─Projection(Build) 10000.00 root executor__index_lookup_merge_join.t1.a, executor__index_lookup_merge_join.t1.b, executor__index_lookup_merge_join.t1.c, executor__index_lookup_merge_join.t1.d │ └─IndexLookUp 10000.00 root │ ├─IndexFullScan(Build) 10000.00 cop[tikv] table:t1, index:PRIMARY(a, b, c) keep order:true, desc, stats:pseudo │ └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo -└─Projection(Probe) 10000.00 root executor__index_lookup_merge_join.t2.a, executor__index_lookup_merge_join.t2.b, executor__index_lookup_merge_join.t2.c, executor__index_lookup_merge_join.t2.d - └─IndexLookUp 10000.00 root - ├─IndexRangeScan(Build) 10000.00 cop[tikv] table:t2, index:PRIMARY(a, b, c) range: decided by [eq(executor__index_lookup_merge_join.t2.a, executor__index_lookup_merge_join.t1.a) eq(executor__index_lookup_merge_join.t2.b, executor__index_lookup_merge_join.t1.b) eq(executor__index_lookup_merge_join.t2.c, executor__index_lookup_merge_join.t1.c)], keep order:true, desc, stats:pseudo - └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo +└─IndexLookUp(Probe) 10000.00 root + ├─IndexRangeScan(Build) 10000.00 cop[tikv] table:t2, index:PRIMARY(a, b, c) range: decided by [eq(executor__index_lookup_merge_join.t2.a, executor__index_lookup_merge_join.t1.a) eq(executor__index_lookup_merge_join.t2.b, executor__index_lookup_merge_join.t1.b) eq(executor__index_lookup_merge_join.t2.c, executor__index_lookup_merge_join.t1.c)], keep order:false, stats:pseudo + └─TableRowIDScan(Probe) 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo select /*+ inl_merge_join(t1,t2) */ * from t1 left join t2 on t1.a = t2.a and t1.c = t2.c and t1.b = t2.b order by t1.a desc; a b c d a b c d 3 3 3 3 NULL NULL NULL NULL @@ -75,20 +74,21 @@ c_int c_str c_int c_str 1 Alice 1 Bob explain format = 'brief' select /*+ INL_MERGE_JOIN(t1,t2) */ * from t1 join t2 partition(p0) on t1.c_int = t2.c_int and t1.c_str < t2.c_str; id estRows task access object operator info -HashJoin 1.25 root inner join, equal:[eq(executor__index_lookup_merge_join.t1.c_int, executor__index_lookup_merge_join.t2.c_int)], other cond:lt(executor__index_lookup_merge_join.t1.c_str, executor__index_lookup_merge_join.t2.c_str) -├─TableReader(Build) 1.00 root data:Selection -│ └─Selection 1.00 cop[tikv] not(isnull(executor__index_lookup_merge_join.t2.c_str)) -│ └─TableFullScan 1.00 cop[tikv] table:t2, partition:p0 keep order:false -└─PartitionUnion(Probe) 9991.00 root - ├─TableReader 1.00 root data:Selection - │ └─Selection 1.00 cop[tikv] not(isnull(executor__index_lookup_merge_join.t1.c_str)) - │ └─TableFullScan 1.00 cop[tikv] table:t1, partition:p0 keep order:false - └─TableReader 9990.00 root data:Selection - └─Selection 9990.00 cop[tikv] not(isnull(executor__index_lookup_merge_join.t1.c_str)) - └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo +Projection 1.25 root executor__index_lookup_merge_join.t1.c_int, executor__index_lookup_merge_join.t1.c_str, executor__index_lookup_merge_join.t2.c_int, executor__index_lookup_merge_join.t2.c_str +└─HashJoin 1.25 root inner join, equal:[eq(executor__index_lookup_merge_join.t2.c_int, executor__index_lookup_merge_join.t1.c_int)], other cond:lt(executor__index_lookup_merge_join.t1.c_str, executor__index_lookup_merge_join.t2.c_str) + ├─TableReader(Build) 1.00 root data:Selection + │ └─Selection 1.00 cop[tikv] not(isnull(executor__index_lookup_merge_join.t2.c_str)) + │ └─TableFullScan 1.00 cop[tikv] table:t2, partition:p0 keep order:false + └─PartitionUnion(Probe) 9991.00 root + ├─TableReader 1.00 root data:Selection + │ └─Selection 1.00 cop[tikv] not(isnull(executor__index_lookup_merge_join.t1.c_str)) + │ └─TableFullScan 1.00 cop[tikv] table:t1, partition:p0 keep order:false + └─TableReader 9990.00 root data:Selection + └─Selection 9990.00 cop[tikv] not(isnull(executor__index_lookup_merge_join.t1.c_str)) + └─TableFullScan 10000.00 cop[tikv] table:t1, partition:p1 keep order:false, stats:pseudo show warnings; Level Code Message -Warning 1815 Optimizer Hint /*+ INL_MERGE_JOIN(t1, t2) */ is inapplicable +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. select /*+ INL_HASH_JOIN(t1,t2) */ * from t1 join t2 partition(p0) on t1.c_int = t2.c_int and t1.c_str < t2.c_str; c_int c_str c_int c_str 1 Alice 1 Bob @@ -142,7 +142,7 @@ MergeJoin 1.00 root inner join, left key:executor__index_lookup_merge_join.t1.c └─TableFullScan 1.00 cop[tikv] table:t1 keep order:true show warnings; Level Code Message -Warning 1815 Optimizer Hint /*+ INL_MERGE_JOIN(t1, t2) */ is inapplicable +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. select /*+ INL_HASH_JOIN(t1,t2) */ * from t1 join t2 partition(p0) on t1.c_int = t2.c_int and t1.c_str < t2.c_str; c_int c_str c_int c_str 1 Alice 1 Bob diff --git a/tests/integrationtest/r/executor/jointest/hash_join.result b/tests/integrationtest/r/executor/jointest/hash_join.result index 5821b8aa19d0f..fdd018be22d32 100644 --- a/tests/integrationtest/r/executor/jointest/hash_join.result +++ b/tests/integrationtest/r/executor/jointest/hash_join.result @@ -253,13 +253,13 @@ count(*) desc format = 'brief' select /*+ INL_MERGE_JOIN(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b; id estRows task access object operator info HashAgg 1.00 root funcs:count(1)->Column#6 -└─IndexMergeJoin 64.00 root inner join, inner:IndexReader, outer key:executor__jointest__hash_join.t.a, inner key:executor__jointest__hash_join.s.a, other cond:lt(executor__jointest__hash_join.s.b, executor__jointest__hash_join.t.b) - ├─TableReader(Build) 64.00 root data:Selection - │ └─Selection 64.00 cop[tikv] not(isnull(executor__jointest__hash_join.t.b)) - │ └─TableFullScan 64.00 cop[tikv] table:t keep order:false - └─IndexReader(Probe) 64.00 root index:Selection - └─Selection 64.00 cop[tikv] not(isnull(executor__jointest__hash_join.s.a)), not(isnull(executor__jointest__hash_join.s.b)) - └─IndexRangeScan 64.00 cop[tikv] table:s, index:idx(a, b) range: decided by [eq(executor__jointest__hash_join.s.a, executor__jointest__hash_join.t.a) lt(executor__jointest__hash_join.s.b, executor__jointest__hash_join.t.b)], keep order:true +└─MergeJoin 64.00 root inner join, left key:executor__jointest__hash_join.t.a, right key:executor__jointest__hash_join.s.a, other cond:lt(executor__jointest__hash_join.s.b, executor__jointest__hash_join.t.b) + ├─IndexReader(Build) 64.00 root index:Selection + │ └─Selection 64.00 cop[tikv] not(isnull(executor__jointest__hash_join.s.b)) + │ └─IndexFullScan 64.00 cop[tikv] table:s, index:idx(a, b) keep order:true + └─TableReader(Probe) 64.00 root data:Selection + └─Selection 64.00 cop[tikv] not(isnull(executor__jointest__hash_join.t.b)) + └─TableFullScan 64.00 cop[tikv] table:t keep order:true select /*+ INL_MERGE_JOIN(s) */ count(*) from t join s use index(idx) on s.a = t.a and s.b < t.b; count(*) 64 diff --git a/tests/integrationtest/r/executor/write.result b/tests/integrationtest/r/executor/write.result index 2d8beea1b32d9..f31a68de39f05 100644 --- a/tests/integrationtest/r/executor/write.result +++ b/tests/integrationtest/r/executor/write.result @@ -1776,6 +1776,8 @@ a a b update /*+ INL_MERGE_JOIN(t) */ t, t1 set t.a='a' where t.a=t1.a; +Level Code Message +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. select * from t; a a diff --git a/tests/integrationtest/r/expression/charset_and_collation.result b/tests/integrationtest/r/expression/charset_and_collation.result index c7a7a28c282ed..ea37a98bb3e4b 100644 --- a/tests/integrationtest/r/expression/charset_and_collation.result +++ b/tests/integrationtest/r/expression/charset_and_collation.result @@ -821,7 +821,7 @@ select /*+ inl_merge_join(t2) */ t1.b, t2.b from t1 join t2 where t1.b=t2.b; b b a A Level Code Message -Warning 1815 Optimizer Hint /*+ INL_MERGE_JOIN(t2) */ is inapplicable +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. drop table if exists a, b; create table a(i int, k varbinary(40), v int, primary key(i, k) clustered); create table b(i int, k varchar(40), v int, primary key(i, k) clustered); diff --git a/tests/integrationtest/r/expression/issues.result b/tests/integrationtest/r/expression/issues.result index ca2c8e2dcd66d..403f22faa9305 100644 --- a/tests/integrationtest/r/expression/issues.result +++ b/tests/integrationtest/r/expression/issues.result @@ -531,15 +531,14 @@ insert into t2 value (1,2,date'2020-05-08'); explain format = 'brief' SELECT /*+ INL_MERGE_JOIN(t1,t2) */ COUNT(*) FROM t1 LEFT JOIN t2 ON t1.id = t2.order_id WHERE t1.ns = 'a' AND t1.org_id IN (1) AND t1.status IN (2,6,10) AND timestampdiff(month, t2.begin_time, date'2020-05-06') = 0; id estRows task access object operator info StreamAgg 1.00 root funcs:count(1)->Column#10 -└─IndexMergeJoin 0.03 root inner join, inner:Selection, outer key:expression__issues.t1.id, inner key:expression__issues.t2.order_id +└─IndexJoin 0.03 root inner join, inner:Selection, outer key:expression__issues.t1.id, inner key:expression__issues.t2.order_id, equal cond:eq(expression__issues.t1.id, expression__issues.t2.order_id) ├─TableReader(Build) 0.02 root data:Selection │ └─Selection 0.02 cop[tikv] eq(cast(expression__issues.t1.org_id, double BINARY), 1), eq(expression__issues.t1.ns, "a"), in(expression__issues.t1.status, 2, 6, 10) │ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo └─Selection(Probe) 0.03 root eq(timestampdiff("MONTH", expression__issues.t2.begin_time, 2020-05-06), 0) - └─Projection 0.04 root expression__issues.t2.order_id, expression__issues.t2.begin_time - └─IndexLookUp 0.04 root - ├─IndexRangeScan(Build) 0.04 cop[tikv] table:t2, index:idx_oid(order_id) range: decided by [eq(expression__issues.t2.order_id, expression__issues.t1.id)], keep order:true, stats:pseudo - └─TableRowIDScan(Probe) 0.04 cop[tikv] table:t2 keep order:false, stats:pseudo + └─IndexLookUp 0.04 root + ├─IndexRangeScan(Build) 0.04 cop[tikv] table:t2, index:idx_oid(order_id) range: decided by [eq(expression__issues.t2.order_id, expression__issues.t1.id)], keep order:false, stats:pseudo + └─TableRowIDScan(Probe) 0.04 cop[tikv] table:t2 keep order:false, stats:pseudo SELECT /*+ INL_MERGE_JOIN(t1,t2) */ COUNT(*) FROM t1 LEFT JOIN t2 ON t1.id = t2.order_id WHERE t1.ns = 'a' AND t1.org_id IN (1) AND t1.status IN (2,6,10) AND timestampdiff(month, t2.begin_time, date'2020-05-06') = 0; COUNT(*) 1 diff --git a/tests/integrationtest/r/planner/core/casetest/hint/hint.result b/tests/integrationtest/r/planner/core/casetest/hint/hint.result index 1fd67eb399eed..0e8d0c1d264ed 100644 --- a/tests/integrationtest/r/planner/core/casetest/hint/hint.result +++ b/tests/integrationtest/r/planner/core/casetest/hint/hint.result @@ -1670,14 +1670,16 @@ Sort 12487.50 root planner__core__casetest__hint__hint.t.a └─TableRowIDScan(Probe) 12487.50 cop[tikv] table:t2 keep order:false, stats:pseudo desc format = 'brief' select /*+ INL_MERGE_JOIN(t2)*/ t1.a, t2.a from t t1, t t2 ,t t3 where t1.a = t2.a and t3.a=t2.a; id estRows task access object operator info -HashJoin 15625.00 root inner join, equal:[eq(planner__core__casetest__hint__hint.t.a, planner__core__casetest__hint__hint.t.a)] -├─IndexReader(Build) 10000.00 root index:IndexFullScan -│ └─IndexFullScan 10000.00 cop[tikv] table:t3, index:b(b) keep order:false, stats:pseudo -└─IndexMergeJoin(Probe) 12500.00 root inner join, inner:TableReader, outer key:planner__core__casetest__hint__hint.t.a, inner key:planner__core__casetest__hint__hint.t.a - ├─IndexReader(Build) 10000.00 root index:IndexFullScan - │ └─IndexFullScan 10000.00 cop[tikv] table:t1, index:b(b) keep order:false, stats:pseudo - └─TableReader(Probe) 10000.00 root data:TableRangeScan - └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [planner__core__casetest__hint__hint.t.a], keep order:true, stats:pseudo +MergeJoin 15625.00 root inner join, left key:planner__core__casetest__hint__hint.t.a, right key:planner__core__casetest__hint__hint.t.a +├─TableReader(Build) 10000.00 root data:TableFullScan +│ └─TableFullScan 10000.00 cop[tikv] table:t3 keep order:true, stats:pseudo +└─MergeJoin(Probe) 12500.00 root inner join, left key:planner__core__casetest__hint__hint.t.a, right key:planner__core__casetest__hint__hint.t.a + ├─TableReader(Build) 10000.00 root data:TableFullScan + │ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:true, stats:pseudo + └─TableReader(Probe) 10000.00 root data:TableFullScan + └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:true, stats:pseudo +Level Code Message +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. desc format = 'brief' select * from t t1, (select /*+ HASH_AGG() */ b, max(a) from t t2 group by b) t2 where t1.b = t2.b order by t1.b; id estRows task access object operator info Sort 9990.00 root planner__core__casetest__hint__hint.t.b diff --git a/tests/integrationtest/r/planner/core/casetest/index/index.result b/tests/integrationtest/r/planner/core/casetest/index/index.result index 42fa7873de187..a36deffb9d06f 100644 --- a/tests/integrationtest/r/planner/core/casetest/index/index.result +++ b/tests/integrationtest/r/planner/core/casetest/index/index.result @@ -277,11 +277,11 @@ a b c d a b c d 3 333 3.3000000000 13 3 333 3.3000000000 13 explain format = 'brief'select /*+ inl_merge_join(t1, t2) */ * from t t1 join t t2 on t1.a = t2.a; id estRows task access object operator info -IndexMergeJoin 3.00 root inner join, inner:TableReader, outer key:planner__core__casetest__index__index.t.a, inner key:planner__core__casetest__index__index.t.a +MergeJoin 3.00 root inner join, left key:planner__core__casetest__index__index.t.a, right key:planner__core__casetest__index__index.t.a ├─TableReader(Build) 3.00 root data:TableFullScan -│ └─TableFullScan 3.00 cop[tikv] table:t1 keep order:false -└─TableReader(Probe) 3.00 root data:TableRangeScan - └─TableRangeScan 3.00 cop[tikv] table:t2 range: decided by [eq(planner__core__casetest__index__index.t.a, planner__core__casetest__index__index.t.a)], keep order:true +│ └─TableFullScan 3.00 cop[tikv] table:t2 keep order:true +└─TableReader(Probe) 3.00 root data:TableFullScan + └─TableFullScan 3.00 cop[tikv] table:t1 keep order:true select /*+ inl_merge_join(t1, t2) */ * from t t1 join t t2 on t1.a = t2.a; a b c d a b c d 1 111 1.1000000000 11 1 111 1.1000000000 11 @@ -328,14 +328,12 @@ a b c d a b c d 3 333 3.3000000000 13 3 333 3.3000000000 13 explain format = 'brief'select /*+ inl_merge_join(t1,t2) */ t2.a, t2.c, t2.d from t t1 left join t t2 on t1.a = t2.c; id estRows task access object operator info -IndexMergeJoin 3.00 root left outer join, inner:Projection, outer key:Column#9, inner key:planner__core__casetest__index__index.t.c +HashJoin 3.00 root left outer join, equal:[eq(Column#9, planner__core__casetest__index__index.t.c)] ├─Projection(Build) 3.00 root cast(planner__core__casetest__index__index.t.a, decimal(10,0) BINARY)->Column#9 │ └─IndexReader 3.00 root index:IndexFullScan │ └─IndexFullScan 3.00 cop[tikv] table:t1, index:c(c) keep order:false -└─Projection(Probe) 3.00 root planner__core__casetest__index__index.t.a, planner__core__casetest__index__index.t.c, planner__core__casetest__index__index.t.d - └─IndexLookUp 3.00 root - ├─IndexRangeScan(Build) 3.00 cop[tikv] table:t2, index:c(c) range: decided by [eq(planner__core__casetest__index__index.t.c, Column#9)], keep order:true - └─TableRowIDScan(Probe) 3.00 cop[tikv] table:t2 keep order:false +└─TableReader(Probe) 3.00 root data:TableFullScan + └─TableFullScan 3.00 cop[tikv] table:t2 keep order:false select /*+ inl_merge_join(t1,t2) */ t2.a, t2.c, t2.d from t t1 left join t t2 on t1.a = t2.c; a c d NULL NULL NULL diff --git a/tests/integrationtest/r/planner/core/casetest/physicalplantest/physical_plan.result b/tests/integrationtest/r/planner/core/casetest/physicalplantest/physical_plan.result index 52d57aab7c90e..37582ad59c060 100644 --- a/tests/integrationtest/r/planner/core/casetest/physicalplantest/physical_plan.result +++ b/tests/integrationtest/r/planner/core/casetest/physicalplantest/physical_plan.result @@ -5,11 +5,11 @@ insert into t1 values(1,1),(2,2); insert into t2 values(1,1),(2,1); explain format = 'brief' select /*+ inl_merge_join(t2) */ t1.a, t2.a from t1 left join t2 on t1.a=t2.a and t1.b=t2.b; id estRows task access object operator info -IndexMergeJoin 12500.00 root left outer join, inner:TableReader, outer key:planner__core__casetest__physicalplantest__physical_plan.t1.a, inner key:planner__core__casetest__physicalplantest__physical_plan.t2.a, other cond:eq(planner__core__casetest__physicalplantest__physical_plan.t1.b, planner__core__casetest__physicalplantest__physical_plan.t2.b) +HashJoin 12500.00 root left outer join, equal:[eq(planner__core__casetest__physicalplantest__physical_plan.t1.a, planner__core__casetest__physicalplantest__physical_plan.t2.a) eq(planner__core__casetest__physicalplantest__physical_plan.t1.b, planner__core__casetest__physicalplantest__physical_plan.t2.b)] ├─TableReader(Build) 10000.00 root data:TableFullScan -│ └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo -└─TableReader(Probe) 10000.00 root data:TableRangeScan - └─TableRangeScan 10000.00 cop[tikv] table:t2 range: decided by [planner__core__casetest__physicalplantest__physical_plan.t1.a], keep order:true, stats:pseudo +│ └─TableFullScan 10000.00 cop[tikv] table:t2 keep order:false, stats:pseudo +└─TableReader(Probe) 10000.00 root data:TableFullScan + └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo select /*+ inl_merge_join(t2) */ t1.a, t2.a from t1 left join t2 on t1.a=t2.a and t1.b=t2.b; a a 1 1 diff --git a/tests/integrationtest/r/planner/core/casetest/rule/rule_join_reorder.result b/tests/integrationtest/r/planner/core/casetest/rule/rule_join_reorder.result index a9135cc00da33..c330fffa33903 100644 --- a/tests/integrationtest/r/planner/core/casetest/rule/rule_join_reorder.result +++ b/tests/integrationtest/r/planner/core/casetest/rule/rule_join_reorder.result @@ -780,14 +780,13 @@ Level Code Message Warning 1815 Some INL_HASH_JOIN and NO_INDEX_HASH_JOIN hints conflict, NO_INDEX_HASH_JOIN may be ignored explain format = 'brief' select /*+ inl_merge_join(t1), no_index_merge_join(t1, t2) */ * from t1, t2 where t1.a=t2.a; id estRows task access object operator info -IndexMergeJoin 12487.50 root inner join, inner:IndexReader, outer key:planner__core__casetest__rule__rule_join_reorder.t2.a, inner key:planner__core__casetest__rule__rule_join_reorder.t1.a +MergeJoin 12487.50 root inner join, left key:planner__core__casetest__rule__rule_join_reorder.t1.a, right key:planner__core__casetest__rule__rule_join_reorder.t2.a ├─IndexReader(Build) 9990.00 root index:IndexFullScan -│ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:a(a) keep order:false, stats:pseudo -└─IndexReader(Probe) 12487.50 root index:Selection - └─Selection 12487.50 cop[tikv] not(isnull(planner__core__casetest__rule__rule_join_reorder.t1.a)) - └─IndexRangeScan 12500.00 cop[tikv] table:t1, index:a(a) range: decided by [eq(planner__core__casetest__rule__rule_join_reorder.t1.a, planner__core__casetest__rule__rule_join_reorder.t2.a)], keep order:true, stats:pseudo +│ └─IndexFullScan 9990.00 cop[tikv] table:t2, index:a(a) keep order:true, stats:pseudo +└─IndexReader(Probe) 9990.00 root index:IndexFullScan + └─IndexFullScan 9990.00 cop[tikv] table:t1, index:a(a) keep order:true, stats:pseudo Level Code Message -Warning 1815 Some INL_MERGE_JOIN and NO_INDEX_MERGE_JOIN hints conflict, NO_INDEX_MERGE_JOIN may be ignored +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. explain format = 'brief' select /*+ inl_join(t1), no_index_hash_join(t1) */ * from t1, t2 where t1.a=t2.a; id estRows task access object operator info IndexJoin 12487.50 root inner join, inner:IndexReader, outer key:planner__core__casetest__rule__rule_join_reorder.t2.a, inner key:planner__core__casetest__rule__rule_join_reorder.t1.a, equal cond:eq(planner__core__casetest__rule__rule_join_reorder.t2.a, planner__core__casetest__rule__rule_join_reorder.t1.a) diff --git a/tests/integrationtest/r/planner/core/integration.result b/tests/integrationtest/r/planner/core/integration.result index 56aa43bc98f91..79fc9a47fa367 100644 --- a/tests/integrationtest/r/planner/core/integration.result +++ b/tests/integrationtest/r/planner/core/integration.result @@ -2099,15 +2099,15 @@ insert into t values(1,1,1), (2,2,2), (3,3,3); insert into t2 values(1,2,3,4), (2,4,3,5), (1,3,1,1); select /*+ INL_MERGE_JOIN(t) */ * from t right outer join t2 on t.a=t2.c; a b c a b c d -1 1 1 1 3 1 1 3 3 3 1 2 3 4 +1 1 1 1 3 1 1 3 3 3 2 4 3 5 select /*+ INL_MERGE_JOIN(t2) */ * from t left outer join t2 on t.a=t2.c; a b c a b c d -1 1 1 1 3 1 1 -2 2 2 NULL NULL NULL NULL 3 3 3 1 2 3 4 +1 1 1 1 3 1 1 3 3 3 2 4 3 5 +2 2 2 NULL NULL NULL NULL set @@tidb_enable_clustered_index = DEFAULT; drop table if exists t; create table t (a int not null, b int not null, c int not null, primary key (a,c)) partition by range (c) (partition p0 values less than (5), partition p1 values less than (10)); diff --git a/tests/integrationtest/r/planner/core/physical_plan.result b/tests/integrationtest/r/planner/core/physical_plan.result index 5e7476f38c566..d5a60e8f4608c 100644 --- a/tests/integrationtest/r/planner/core/physical_plan.result +++ b/tests/integrationtest/r/planner/core/physical_plan.result @@ -2,7 +2,10 @@ drop table if exists t; create table t(a int, b int, c int, key(b), key(c)); explain format='hint' select /*+ inl_merge_join(t2) */ * from t t1 inner join t t2 on t1.b = t2.b and t1.c = 1; hint -inl_merge_join(@`sel_1` `planner__core__physical_plan`.`t2`), use_index(@`sel_1` `planner__core__physical_plan`.`t1` `c`), no_order_index(@`sel_1` `planner__core__physical_plan`.`t1` `c`), use_index(@`sel_1` `planner__core__physical_plan`.`t2` `b`), order_index(@`sel_1` `planner__core__physical_plan`.`t2` `b`), inl_merge_join(`t2`) +inl_hash_join(@`sel_1` `planner__core__physical_plan`.`t2`), use_index(@`sel_1` `planner__core__physical_plan`.`t1` `c`), no_order_index(@`sel_1` `planner__core__physical_plan`.`t1` `c`), use_index(@`sel_1` `planner__core__physical_plan`.`t2` `b`), no_order_index(@`sel_1` `planner__core__physical_plan`.`t2` `b`), inl_merge_join(`t2`) +show warnings; +Level Code Message +Warning 1815 The INDEX MERGE JOIN hint is deprecated for usage, try other hints. explain format='hint' select /*+ inl_hash_join(t2) */ * from t t1 inner join t t2 on t1.b = t2.b and t1.c = 1; hint inl_hash_join(@`sel_1` `planner__core__physical_plan`.`t2`), use_index(@`sel_1` `planner__core__physical_plan`.`t1` `c`), no_order_index(@`sel_1` `planner__core__physical_plan`.`t1` `c`), use_index(@`sel_1` `planner__core__physical_plan`.`t2` `b`), no_order_index(@`sel_1` `planner__core__physical_plan`.`t2` `b`), inl_hash_join(`t2`) diff --git a/tests/integrationtest/t/planner/core/physical_plan.test b/tests/integrationtest/t/planner/core/physical_plan.test index 5fc57fb9ce2a6..132940cfd8800 100644 --- a/tests/integrationtest/t/planner/core/physical_plan.test +++ b/tests/integrationtest/t/planner/core/physical_plan.test @@ -2,6 +2,7 @@ drop table if exists t; create table t(a int, b int, c int, key(b), key(c)); explain format='hint' select /*+ inl_merge_join(t2) */ * from t t1 inner join t t2 on t1.b = t2.b and t1.c = 1; +show warnings; explain format='hint' select /*+ inl_hash_join(t2) */ * from t t1 inner join t t2 on t1.b = t2.b and t1.c = 1;