diff --git a/ast/misc.go b/ast/misc.go index 9ae1be7c1..33974c96e 100755 --- a/ast/misc.go +++ b/ast/misc.go @@ -2597,7 +2597,7 @@ func (n *TableOptimizerHint) Restore(ctx *format.RestoreCtx) error { ctx.WritePlainf("%d", n.HintData.(uint64)) case "nth_plan": ctx.WritePlainf("%d", n.HintData.(int64)) - case "tidb_hj", "tidb_smj", "tidb_inlj", "hash_join", "merge_join", "inl_join", "bc_join", "bcj_local", "tidb_bcj": + case "tidb_hj", "tidb_smj", "tidb_inlj", "hash_join", "merge_join", "inl_join", "broadcast_join", "broadcast_join_local": for i, table := range n.Tables { if i != 0 { ctx.WritePlain(", ") diff --git a/ast/misc_test.go b/ast/misc_test.go index 2234c82d7..7d5dde881 100644 --- a/ast/misc_test.go +++ b/ast/misc_test.go @@ -231,9 +231,8 @@ func (ts *testMiscSuite) TestTableOptimizerHintRestore(c *C) { {"TIDB_HJ(t1,t2)", "TIDB_HJ(`t1`, `t2`)"}, {"TIDB_HJ(@sel1 t1,t2)", "TIDB_HJ(@`sel1` `t1`, `t2`)"}, {"TIDB_HJ(t1@sel1,t2@sel2)", "TIDB_HJ(`t1`@`sel1`, `t2`@`sel2`)"}, - {"TIDB_BCJ(t1,t2)", "TIDB_BCJ(`t1`, `t2`)"}, {"MERGE_JOIN(t1,t2)", "MERGE_JOIN(`t1`, `t2`)"}, - {"BC_JOIN(t1,t2)", "BC_JOIN(`t1`, `t2`)"}, + {"BROADCAST_JOIN(t1,t2)", "BROADCAST_JOIN(`t1`, `t2`)"}, {"INL_JOIN(t1,t2)", "INL_JOIN(`t1`, `t2`)"}, {"HASH_JOIN(t1,t2)", "HASH_JOIN(`t1`, `t2`)"}, {"MAX_EXECUTION_TIME(3000)", "MAX_EXECUTION_TIME(3000)"}, diff --git a/hintparser.y b/hintparser.y index f207e7185..dcd3e4ae9 100644 --- a/hintparser.y +++ b/hintparser.y @@ -91,8 +91,8 @@ import ( hintReadConsistentReplica "READ_CONSISTENT_REPLICA" hintReadFromStorage "READ_FROM_STORAGE" hintSMJoin "MERGE_JOIN" - hintBCJoin "BC_JOIN" - hintBCJoinPreferLocal "BCJ_LOCAL" + hintBCJoin "BROADCAST_JOIN" + hintBCJoinPreferLocal "BROADCAST_JOIN_LOCAL" hintStreamAgg "STREAM_AGG" hintSwapJoinInputs "SWAP_JOIN_INPUTS" hintUseIndexMerge "USE_INDEX_MERGE" @@ -524,8 +524,8 @@ UnsupportedTableLevelOptimizerHintName: SupportedTableLevelOptimizerHintName: "MERGE_JOIN" -| "BC_JOIN" -| "BCJ_LOCAL" +| "BROADCAST_JOIN" +| "BROADCAST_JOIN_LOCAL" | "INL_JOIN" | "INL_HASH_JOIN" | "SWAP_JOIN_INPUTS" @@ -622,8 +622,8 @@ Identifier: | "READ_CONSISTENT_REPLICA" | "READ_FROM_STORAGE" | "MERGE_JOIN" -| "BC_JOIN" -| "BCJ_LOCAL" +| "BROADCAST_JOIN" +| "BROADCAST_JOIN_LOCAL" | "STREAM_AGG" | "SWAP_JOIN_INPUTS" | "USE_INDEX_MERGE" diff --git a/misc.go b/misc.go index 1b70ed570..e9829b390 100644 --- a/misc.go +++ b/misc.go @@ -847,8 +847,8 @@ var hintTokenMap = map[string]int{ "QUERY_TYPE": hintQueryType, "READ_CONSISTENT_REPLICA": hintReadConsistentReplica, "READ_FROM_STORAGE": hintReadFromStorage, - "BC_JOIN": hintBCJoin, - "BCJ_LOCAL": hintBCJoinPreferLocal, + "BROADCAST_JOIN": hintBCJoin, + "BROADCAST_JOIN_LOCAL": hintBCJoinPreferLocal, "MERGE_JOIN": hintSMJoin, "STREAM_AGG": hintStreamAgg, "SWAP_JOIN_INPUTS": hintSwapJoinInputs, @@ -864,7 +864,6 @@ var hintTokenMap = map[string]int{ "TIDB_HJ": hintHashJoin, "TIDB_INLJ": hintInlJoin, "TIDB_SMJ": hintSMJoin, - "TIDB_BCJ": hintBCJoin, // Other keywords "OLAP": hintOLAP, diff --git a/parser_test.go b/parser_test.go index e5b94353c..3a8278eab 100644 --- a/parser_test.go +++ b/parser_test.go @@ -3153,23 +3153,6 @@ func (s *testParserSuite) TestOptimizerHints(c *C) { c.Assert(hints[1].Tables[0].TableName.L, Equals, "t3") c.Assert(hints[1].Tables[1].TableName.L, Equals, "t4") - // Test TIDB_BCJ - stmt, _, err = parser.Parse("select /*+ TIDB_BCJ(T1,t2), tidb_bcj(T3,t4) */ c1, c2 from t1, t2 where t1.c1 = t2.c1", "", "") - c.Assert(err, IsNil) - selectStmt = stmt[0].(*ast.SelectStmt) - - hints = selectStmt.TableHints - c.Assert(hints, HasLen, 2) - c.Assert(hints[0].HintName.L, Equals, "tidb_bcj") - c.Assert(hints[0].Tables, HasLen, 2) - c.Assert(hints[0].Tables[0].TableName.L, Equals, "t1") - c.Assert(hints[0].Tables[1].TableName.L, Equals, "t2") - - c.Assert(hints[1].HintName.L, Equals, "tidb_bcj") - c.Assert(hints[1].Tables, HasLen, 2) - c.Assert(hints[1].Tables[0].TableName.L, Equals, "t3") - c.Assert(hints[1].Tables[1].TableName.L, Equals, "t4") - // Test MERGE_JOIN stmt, _, err = parser.Parse("select /*+ MERGE_JOIN(t1, T2), merge_join(t3, t4) */ c1, c2 from t1, t2 where t1.c1 = t2.c1", "", "") c.Assert(err, IsNil) @@ -3187,24 +3170,24 @@ func (s *testParserSuite) TestOptimizerHints(c *C) { c.Assert(hints[1].Tables[0].TableName.L, Equals, "t3") c.Assert(hints[1].Tables[1].TableName.L, Equals, "t4") - // TEST BC_JOIN - stmt, _, err = parser.Parse("select /*+ BC_JOIN(t1, T2), bc_join(t3, t4), BCJ_LOCAL(t2) */ c1, c2 from t1, t2 where t1.c1 = t2.c1", "", "") + // TEST BROADCAST_JOIN + stmt, _, err = parser.Parse("select /*+ BROADCAST_JOIN(t1, T2), broadcast_join(t3, t4), BROADCAST_JOIN_LOCAL(t2) */ c1, c2 from t1, t2 where t1.c1 = t2.c1", "", "") c.Assert(err, IsNil) selectStmt = stmt[0].(*ast.SelectStmt) hints = selectStmt.TableHints c.Assert(hints, HasLen, 3) - c.Assert(hints[0].HintName.L, Equals, "bc_join") + c.Assert(hints[0].HintName.L, Equals, "broadcast_join") c.Assert(hints[0].Tables, HasLen, 2) c.Assert(hints[0].Tables[0].TableName.L, Equals, "t1") c.Assert(hints[0].Tables[1].TableName.L, Equals, "t2") - c.Assert(hints[1].HintName.L, Equals, "bc_join") + c.Assert(hints[1].HintName.L, Equals, "broadcast_join") c.Assert(hints[1].Tables, HasLen, 2) c.Assert(hints[1].Tables[0].TableName.L, Equals, "t3") c.Assert(hints[1].Tables[1].TableName.L, Equals, "t4") - c.Assert(hints[2].HintName.L, Equals, "bcj_local") + c.Assert(hints[2].HintName.L, Equals, "broadcast_join_local") c.Assert(hints[2].Tables, HasLen, 1) c.Assert(hints[2].Tables[0].TableName.L, Equals, "t2")