@@ -2032,3 +2032,57 @@ func TestMppAggShouldAlignFinalMode(t *testing.T) {
2032
2032
err = failpoint .Disable ("github.com/pingcap/tidb/pkg/expression/aggregation/show-agg-mode" )
2033
2033
require .Nil (t , err )
2034
2034
}
2035
+
2036
+ func TestIssue59877 (t * testing.T ) {
2037
+ store := testkit .CreateMockStore (t , withMockTiFlash (1 ))
2038
+ tk := testkit .NewTestKit (t , store )
2039
+ tk .MustExec ("use test" )
2040
+ tk .MustExec ("drop table if exists t1, t2, t3" )
2041
+ tk .MustExec ("create table t1(id bigint, v1 int)" )
2042
+ tk .MustExec ("alter table t1 set tiflash replica 1" )
2043
+ tb := external .GetTableByName (t , tk , "test" , "t1" )
2044
+ err := domain .GetDomain (tk .Session ()).DDL ().UpdateTableReplicaInfo (tk .Session (), tb .Meta ().ID , true )
2045
+ require .NoError (t , err )
2046
+ tk .MustExec ("create table t2(id bigint unsigned, v1 int)" )
2047
+ tk .MustExec ("alter table t2 set tiflash replica 1" )
2048
+ tb = external .GetTableByName (t , tk , "test" , "t2" )
2049
+ err = domain .GetDomain (tk .Session ()).DDL ().UpdateTableReplicaInfo (tk .Session (), tb .Meta ().ID , true )
2050
+ require .NoError (t , err )
2051
+ tk .MustExec ("create table t3(id bigint, v1 int)" )
2052
+ tk .MustExec ("alter table t3 set tiflash replica 1" )
2053
+ tb = external .GetTableByName (t , tk , "test" , "t3" )
2054
+ err = domain .GetDomain (tk .Session ()).DDL ().UpdateTableReplicaInfo (tk .Session (), tb .Meta ().ID , true )
2055
+ require .NoError (t , err )
2056
+
2057
+ tk .MustExec ("set @@session.tidb_isolation_read_engines=\" tiflash\" " )
2058
+ // unistore does not support later materialization
2059
+ tk .MustExec ("set tidb_opt_enable_late_materialization=0" )
2060
+ tk .MustExec ("set @@session.tidb_allow_mpp=ON" )
2061
+ tk .MustExec ("set @@session.tidb_enforce_mpp=ON" )
2062
+ tk .MustExec ("set tidb_broadcast_join_threshold_size=0" )
2063
+ tk .MustExec ("set tidb_broadcast_join_threshold_count=0" )
2064
+ tk .MustExec ("set tiflash_fine_grained_shuffle_stream_count=8" )
2065
+ tk .MustExec ("set tidb_enforce_mpp=1" )
2066
+ 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 (
2067
+ testkit .Rows ("HashAgg 1.00 root funcs:count(Column#18)->Column#10" ,
2068
+ "└─TableReader 1.00 root MppVersion: 2, data:ExchangeSender" ,
2069
+ " └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough" ,
2070
+ " └─HashAgg 1.00 mpp[tiflash] funcs:count(1)->Column#18" ,
2071
+ " └─HashJoin 15609.38 mpp[tiflash] inner join, equal:[eq(test.t1.id, test.t3.id)]" ,
2072
+ " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] " ,
2073
+ " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#17, collate: binary]" ,
2074
+ " │ └─Projection 9990.00 mpp[tiflash] test.t3.id, cast(test.t3.id, decimal(20,0))->Column#17" ,
2075
+ " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t3.id))" ,
2076
+ " │ └─TableFullScan 10000.00 mpp[tiflash] table:t3 keep order:false, stats:pseudo" ,
2077
+ " └─HashJoin(Probe) 12487.50 mpp[tiflash] inner join, equal:[eq(test.t1.id, test.t2.id)]" ,
2078
+ " ├─ExchangeReceiver(Build) 9990.00 mpp[tiflash] " ,
2079
+ " │ └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#13, collate: binary]" ,
2080
+ " │ └─Projection 9990.00 mpp[tiflash] test.t1.id, cast(test.t1.id, decimal(20,0))->Column#13" ,
2081
+ " │ └─Selection 9990.00 mpp[tiflash] not(isnull(test.t1.id))" ,
2082
+ " │ └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo" ,
2083
+ " └─ExchangeReceiver(Probe) 9990.00 mpp[tiflash] " ,
2084
+ " └─ExchangeSender 9990.00 mpp[tiflash] ExchangeType: HashPartition, Compression: FAST, Hash Cols: [name: Column#14, collate: binary]" ,
2085
+ " └─Projection 9990.00 mpp[tiflash] test.t2.id, cast(test.t2.id, decimal(20,0) UNSIGNED)->Column#14" ,
2086
+ " └─Selection 9990.00 mpp[tiflash] not(isnull(test.t2.id))" ,
2087
+ " └─TableFullScan 10000.00 mpp[tiflash] table:t2 keep order:false, stats:pseudo" ))
2088
+ }
0 commit comments