Skip to content

Commit 3e9907b

Browse files
AilinKidti-chi-bot
authored andcommitted
This is an automated cherry-pick of pingcap#46310
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
1 parent 5212c4f commit 3e9907b

File tree

6 files changed

+3292
-0
lines changed

6 files changed

+3292
-0
lines changed

executor/test/tiflashtest/BUILD.bazel

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_test")
2+
3+
go_test(
4+
name = "tiflashtest_test",
5+
timeout = "moderate",
6+
srcs = [
7+
"main_test.go",
8+
"tiflash_test.go",
9+
],
10+
flaky = True,
11+
race = "on",
12+
shard_count = 39,
13+
deps = [
14+
"//config",
15+
"//domain",
16+
"//kv",
17+
"//meta/autoid",
18+
"//parser/terror",
19+
"//planner/core",
20+
"//store/mockstore",
21+
"//store/mockstore/unistore",
22+
"//testkit",
23+
"//testkit/external",
24+
"//util/dbterror/exeerrors",
25+
"//util/memory",
26+
"//util/tiflashcompute",
27+
"@com_github_pingcap_errors//:errors",
28+
"@com_github_pingcap_failpoint//:failpoint",
29+
"@com_github_pingcap_kvproto//pkg/metapb",
30+
"@com_github_stretchr_testify//require",
31+
"@com_github_tikv_client_go_v2//testutils",
32+
"@com_github_tikv_client_go_v2//tikv",
33+
"@io_opencensus_go//stats/view",
34+
"@org_uber_go_goleak//:goleak",
35+
],
36+
)

executor/tiflash_test.go

+31
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,37 @@ func TestAggPushDownCountStar(t *testing.T) {
12481248
tk.MustQuery("select count(*) from c, o where c.c_id=o.c_id").Check(testkit.Rows("5"))
12491249
}
12501250

1251+
func TestAggPushDownUnionAndMPP(t *testing.T) {
1252+
store := testkit.CreateMockStore(t, withMockTiFlash(2))
1253+
tk := testkit.NewTestKit(t, store)
1254+
1255+
tk.MustExec("use test")
1256+
tk.MustExec("create table t (a int, b int)")
1257+
tk.MustExec("alter table t set tiflash replica 1")
1258+
tk.MustExec("insert into t values (1, 1);")
1259+
tk.MustExec("insert into t values (1, 1);")
1260+
tk.MustExec("insert into t values (1, 1);")
1261+
tk.MustExec("insert into t values (1, 1);")
1262+
tk.MustExec("insert into t values (1, 1);")
1263+
tk.MustExec("set @@tidb_allow_mpp=1;")
1264+
tk.MustExec("set @@tidb_enforce_mpp=1;")
1265+
tk.MustExec("set @@tidb_opt_agg_push_down=1")
1266+
1267+
tk.MustExec("create table c(c_id int)")
1268+
tk.MustExec("create table o(o_id int, c_id int)")
1269+
tk.MustExec("insert into c values(1),(1),(1),(1)")
1270+
tk.MustExec("insert into o values(1,1),(1,1),(1,2)")
1271+
tk.MustExec("alter table c set tiflash replica 1")
1272+
tk.MustExec("alter table o set tiflash replica 1")
1273+
1274+
tk.MustQuery("select a, count(*) from (select a, b from t " +
1275+
"union all " +
1276+
"select a, b from t" +
1277+
") t group by a order by a limit 10;").Check(testkit.Rows("1 10"))
1278+
1279+
tk.MustQuery("select o.o_id, count(*) from c, o where c.c_id=o.o_id group by o.o_id").Check(testkit.Rows("1 12"))
1280+
}
1281+
12511282
func TestGroupStreamAggOnTiFlash(t *testing.T) {
12521283
store, clean := testkit.CreateMockStore(t, withMockTiFlash(2))
12531284
defer clean()

0 commit comments

Comments
 (0)