Skip to content

Commit

Permalink
This is an automated cherry-pick of #59884
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
yibin87 authored and ti-chi-bot committed Mar 5, 2025
1 parent 2ec3e3e commit 442aeab
Show file tree
Hide file tree
Showing 3 changed files with 1,394 additions and 0 deletions.
4 changes: 4 additions & 0 deletions executor/tiflashtest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ go_test(
],
flaky = True,
race = "on",
<<<<<<< HEAD:executor/tiflashtest/BUILD.bazel
shard_count = 28,
=======
shard_count = 48,
>>>>>>> b2a9059b5e1 (planner: Limit fine grained shuffle usage for mpp join operators to ensure shuffle keys are the same with actual join keys (#59884)):pkg/executor/test/tiflashtest/BUILD.bazel
deps = [
"//config",
"//domain",
Expand Down
56 changes: 56 additions & 0 deletions executor/tiflashtest/tiflash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1409,3 +1409,59 @@ func TestIndexMergeCarePreferTiflash(t *testing.T) {
" └─Selection 0.00 mpp[tiflash] eq(test.t.s, 0), ge(test.t.m, 1726910326), le(test.t.m, 1726910391), not(in(test.t.a, -1, 0)), or(eq(test.t.w, \"1123\"), eq(test.t.l, \"1123\"))",
" └─TableFullScan 10000.00 mpp[tiflash] table:a keep order:false, stats:pseudo"))
}

func TestIssue59877(t *testing.T) {
store := testkit.CreateMockStore(t, withMockTiFlash(1))
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t1, t2, t3")
tk.MustExec("create table t1(id bigint, v1 int)")
tk.MustExec("alter table t1 set tiflash replica 1")
tb := external.GetTableByName(t, tk, "test", "t1")
err := domain.GetDomain(tk.Session()).DDLExecutor().UpdateTableReplicaInfo(tk.Session(), tb.Meta().ID, true)
require.NoError(t, err)
tk.MustExec("create table t2(id bigint unsigned, v1 int)")
tk.MustExec("alter table t2 set tiflash replica 1")
tb = external.GetTableByName(t, tk, "test", "t2")
err = domain.GetDomain(tk.Session()).DDLExecutor().UpdateTableReplicaInfo(tk.Session(), tb.Meta().ID, true)
require.NoError(t, err)
tk.MustExec("create table t3(id bigint, v1 int)")
tk.MustExec("alter table t3 set tiflash replica 1")
tb = external.GetTableByName(t, tk, "test", "t3")
err = domain.GetDomain(tk.Session()).DDLExecutor().UpdateTableReplicaInfo(tk.Session(), tb.Meta().ID, true)
require.NoError(t, err)

tk.MustExec("set @@session.tidb_isolation_read_engines=\"tiflash\"")
// unistore does not support later materialization
tk.MustExec("set tidb_opt_enable_late_materialization=0")
tk.MustExec("set @@session.tidb_allow_mpp=ON")
tk.MustExec("set @@session.tidb_enforce_mpp=ON")
tk.MustExec("set tidb_broadcast_join_threshold_size=0")
tk.MustExec("set tidb_broadcast_join_threshold_count=0")
tk.MustExec("set tiflash_fine_grained_shuffle_stream_count=8")
tk.MustExec("set tidb_enforce_mpp=1")
tk.MustQuery("explain format=\"brief\" select /*+ hash_join_build(t3) */ count(*) from t1 straight_join t2 on t1.id = t2.id straight_join t3 on t1.id = t3.id").Check(
testkit.Rows("HashAgg 1.00 root funcs:count(Column#18)->Column#10",
"└─TableReader 1.00 root MppVersion: 3, data:ExchangeSender",
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#18",
" └─Projection 15609.38 mpp[tiflash] test.t1.id, Column#14",
" └─HashJoin 15609.38 mpp[tiflash] inner join, equal:[eq(test.t1.id, test.t3.id)]",
" ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ",
" │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#17, collate: binary]",
" │ └─Projection 9990.00 mpp[tiflash] test.t3.id, cast(test.t3.id, decimal(20,0))->Column#17",
" │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t3.id))",
" │ └─TableFullScan 10000.00 mpp[tiflash] table:t3 keep order:false, stats:pseudo",
" └─Projection(Probe) 12487.50 mpp[tiflash] test.t1.id, Column#14",
" └─HashJoin 12487.50 mpp[tiflash] inner join, equal:[eq(test.t1.id, test.t2.id)]",
" ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] ",
" │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#13, collate: binary]",
" │ └─Projection 9990.00 mpp[tiflash] test.t1.id, cast(test.t1.id, decimal(20,0))->Column#13",
" │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t1.id))",
" │ └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo",
" └─ExchangeReceiver(Probe) 9990.00 mpp[tiflash] ",
" └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#14, collate: binary]",
" └─Projection 9990.00 mpp[tiflash] test.t2.id, cast(test.t2.id, decimal(20,0) UNSIGNED)->Column#14",
" └─Selection 9990.00 mpp[tiflash] not(isnull(test.t2.id))",
" └─TableFullScan 10000.00 mpp[tiflash] table:t2 keep order:false, stats:pseudo"))
}
Loading

0 comments on commit 442aeab

Please sign in to comment.