Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Apr 30, 2024
1 parent acba046 commit 190e9d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 4 additions & 6 deletions pkg/planner/core/common_unity.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,11 @@ func getPossibleHints(ctx context.PlanContext, o *UnityOutput) {
possibleHints[fmt.Sprintf("hash_join(%v)", strings.Join(hintTableNames, ", "))] = true

// leading hint
for _, t1 := range hintTableNames {
for _, t2 := range hintTableNames {
if t1 == t2 {
continue
}
possibleHints[fmt.Sprintf("leading(%v, %v)", t1, t2)] = true
for t1, t2 := range o.joins {
if t1 == t2 {
continue
}
possibleHints[fmt.Sprintf("leading(%v, %v)", t1, t2)] = true
}
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/planner/core/common_unity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ func TestUnity(t *testing.T) {
tk.MustExec("use test")
tk.MustExec(`create table t1 (a int, b int, c int, key(a))`)
tk.MustExec(`create table t2 (a int, b int, c int, key(a))`)
formatPrint(tk, `explain format='unity' select * from t1, t2 where t1.a=t2.a`)
tk.MustExec(`create table t3 (a int, b int, c int, key(a))`)
//formatPrint(tk, `explain format='unity' select * from t1, t2 where t1.a=t2.a`)
formatPrint(tk, `explain format='unity' select 1 from t1, t2, t3 where t1.a=t2.a and t2.a=t3.a`)
}

func formatPrint(tk *testkit.TestKit, sql string) {
Expand Down

0 comments on commit 190e9d3

Please sign in to comment.