You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bindSQL:="UPDATE /*+ hash_join(@`upd_1` `test`.`t1`), use_index(@`upd_1` `test`.`t1` `idx_b`), use_index(@`sel_1` `test`.`t2` ), use_index(@`sel_2` `test`.`t2` )*/ `test`.`t1` SET `b`=1 WHERE `b` = 2 AND (`a` IN (SELECT `a` FROM `test`.`t2` WHERE `b` = 1) OR `c` IN (SELECT `a` FROM `test`.`t2` WHERE `b` = 1))"
437
+
originSQL:="UPDATE `test`.`t1` SET `b`=1 WHERE `b` = 2 AND (`a` IN (SELECT `a` FROM `test`.`t2` WHERE `b` = 1) OR `c` IN (SELECT `a` FROM `test`.`t2` WHERE `b` = 1))"
tk.MustExec("explain format = 'brief' SELECT count(*) FROM crm_rd_150m dataset_48 WHERE (CASE WHEN (month(dataset_48.customer_first_date)) <= 30 THEN '新客' ELSE NULL END) IS NOT NULL;")
1281
1281
}
1282
1282
1283
+
funcTestIssue40910(t*testing.T) {
1284
+
store:=testkit.CreateMockStore(t)
1285
+
tk:=testkit.NewTestKit(t, store)
1286
+
tk.MustExec("use test")
1287
+
tk.MustExec("drop table if exists t")
1288
+
tk.MustExec(`create table t(a int, b int, index idx_a(a), index idx_b(b));`)
1289
+
1290
+
tk.MustExec("select * from t where a > 1 and a < 10 order by b;")
tk.MustExec("create session binding for select * from t where a > 1 and a < 10 order by b using select /*+ use_index(t, idx_a) */ * from t where a > 1 and a < 10 order by b;")
1293
+
tk.MustExec("select * from t where a > 1 and a < 10 order by b;")
tk.MustExec("select /*+ use_index(t, idx_b) */ * from t where a > 1 and a < 10 order by b;")
1300
+
tk.MustQuery("show warnings").Check(testkit.Rows(
1301
+
"Warning 1105 The system ignores the hints in the current query and uses the hints specified in the bindSQL: SELECT /*+ use_index(`t` `idx_a`)*/ * FROM `test`.`t` WHERE `a` > 1 AND `a` < 10 ORDER BY `b`"))
Copy file name to clipboardexpand all lines: planner/optimize.go
+3
Original file line number
Diff line number
Diff line change
@@ -251,6 +251,9 @@ func Optimize(ctx context.Context, sctx sessionctx.Context, node ast.Node, is in
251
251
} else {
252
252
sessVars.StmtCtx.AppendExtraNote(errors.Errorf("Using the bindSQL: %v", chosenBinding.BindSQL))
253
253
}
254
+
iflen(tableHints) >0 {
255
+
sessVars.StmtCtx.AppendWarning(errors.Errorf("The system ignores the hints in the current query and uses the hints specified in the bindSQL: %v", chosenBinding.BindSQL))
256
+
}
254
257
}
255
258
// Restore the hint to avoid changing the stmt node.
0 commit comments