Skip to content

Commit

Permalink
planner, expression: set correct for ctx in isNullRejected (#1… (ping…
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot authored Apr 24, 2020
1 parent cded849 commit 03c46d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6184,6 +6184,17 @@ func (s *testIntegrationSuite) TestIssue15992(c *C) {
tk.MustExec("drop table t0;")
}

func (s *testIntegrationSuite) TestIssue16419(c *C) {
tk := testkit.NewTestKitWithInit(c, s.store)
tk.MustExec("use test;")
tk.MustExec("drop table if exists t0")
tk.MustExec("drop table if exists t1")
tk.MustExec("CREATE TABLE t0(c0 INT);")
tk.MustExec("CREATE TABLE t1(c0 INT);")
tk.MustQuery("SELECT * FROM t1 NATURAL LEFT JOIN t0 WHERE NOT t1.c0;").Check(testkit.Rows())
tk.MustExec("drop table t0, t1;")
}

func (s *testIntegrationSuite) TestIssue16029(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test;")
Expand Down
2 changes: 1 addition & 1 deletion planner/core/rule_predicate_push_down.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func simplifyOuterJoin(p *LogicalJoin, predicates []expression.Expression) {
// If it is a conjunction containing a null-rejected condition as a conjunct.
// If it is a disjunction of null-rejected conditions.
func isNullRejected(ctx sessionctx.Context, schema *expression.Schema, expr expression.Expression) bool {
expr = expression.PushDownNot(nil, expr)
expr = expression.PushDownNot(ctx, expr)
sc := ctx.GetSessionVars().StmtCtx
sc.InNullRejectCheck = true
result := expression.EvaluateExprWithNull(ctx, schema, expr)
Expand Down

0 comments on commit 03c46d2

Please sign in to comment.