From 221270adae583a09d5769599f6657c893ca35c69 Mon Sep 17 00:00:00 2001 From: Yiding Cui Date: Tue, 16 Apr 2024 20:49:25 +0800 Subject: [PATCH] add test --- planner/core/issuetest/BUILD.bazel | 2 +- planner/core/issuetest/planner_issue_test.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/planner/core/issuetest/BUILD.bazel b/planner/core/issuetest/BUILD.bazel index ac31cded370be..10c6fbcfec4b2 100644 --- a/planner/core/issuetest/BUILD.bazel +++ b/planner/core/issuetest/BUILD.bazel @@ -6,6 +6,6 @@ go_test( srcs = ["planner_issue_test.go"], flaky = True, race = "on", - shard_count = 9, + shard_count = 10, deps = ["//testkit"], ) diff --git a/planner/core/issuetest/planner_issue_test.go b/planner/core/issuetest/planner_issue_test.go index 50c03e2874136..60bf3a076a055 100644 --- a/planner/core/issuetest/planner_issue_test.go +++ b/planner/core/issuetest/planner_issue_test.go @@ -216,3 +216,17 @@ func TestIssue48969(t *testing.T) { tk.MustExec("update test2 set value=0 where test2.id in (select * from v1);") tk.MustQuery("select * from test2").Check(testkit.Rows("1 0", "2 0", "3 0", "4 4", "5 5")) } + +func TestIssue51670(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + tk.MustExec("use test") + tk.MustExec("create table A(a int primary key, b int);") + tk.MustExec("create table B(b int primary key);") + tk.MustExec("create table C(c int primary key, b int);") + tk.MustExec("insert into A values (2, 1), (3, 2);") + tk.MustExec("insert into B values (1), (2);") + // The two should return the same result set. + tk.MustQuery("select b.b from A a left join (B b left join C c on b.b = c.b) on b.b = a.b where a.a in (2, 3);").Sort().Check(testkit.Rows("1", "2")) + tk.MustQuery("select b.b from A a left join (B b left join C c on b.b = c.b) on b.b = a.b where a.a in (2, 3, null);").Sort().Check(testkit.Rows("1", "2")) +}