@@ -19,65 +19,12 @@ import (
19
19
"strconv"
20
20
"testing"
21
21
22
- "github.com/pingcap/failpoint"
23
22
"github.com/pingcap/tidb/pkg/domain"
24
23
"github.com/pingcap/tidb/pkg/parser/model"
25
24
"github.com/pingcap/tidb/pkg/testkit"
26
25
"github.com/stretchr/testify/require"
27
26
)
28
27
29
- func TestMppAggShouldAlignFinalMode (t * testing.T ) {
30
- store := testkit .CreateMockStore (t )
31
- tk := testkit .NewTestKit (t , store )
32
- tk .MustExec ("use test" )
33
- tk .MustExec ("create table t (" +
34
- " d date," +
35
- " v int," +
36
- " primary key(d, v)" +
37
- ") partition by range columns (d) (" +
38
- " partition p1 values less than ('2023-07-02')," +
39
- " partition p2 values less than ('2023-07-03')" +
40
- ");" )
41
- // Create virtual tiflash replica info.
42
- dom := domain .GetDomain (tk .Session ())
43
- is := dom .InfoSchema ()
44
- db , exists := is .SchemaByName (model .NewCIStr ("test" ))
45
- require .True (t , exists )
46
- for _ , tblInfo := range db .Tables {
47
- if tblInfo .Name .L == "t" {
48
- tblInfo .TiFlashReplica = & model.TiFlashReplicaInfo {
49
- Count : 1 ,
50
- Available : true ,
51
- }
52
- }
53
- }
54
- tk .MustExec (`set tidb_partition_prune_mode='static';` )
55
- err := failpoint .Enable ("github.com/pingcap/tidb/pkg/expression/aggregation/show-agg-mode" , "return(true)" )
56
- require .Nil (t , err )
57
-
58
- tk .MustExec ("set @@session.tidb_isolation_read_engines=\" tiflash\" " )
59
- tk .MustQuery ("explain format='brief' select 1 from (" +
60
- " select /*+ read_from_storage(tiflash[t]) */ sum(1)" +
61
- " from t where d BETWEEN '2023-07-01' and '2023-07-03' group by d" +
62
- ") total;" ).Check (testkit .Rows ("Projection 400.00 root 1->Column#4" ,
63
- "└─HashAgg 400.00 root group by:test.t.d, funcs:count(complete,1)->Column#8" ,
64
- " └─PartitionUnion 400.00 root " ,
65
- " ├─Projection 200.00 root test.t.d" ,
66
- " │ └─HashAgg 200.00 root group by:test.t.d, funcs:firstrow(partial2,test.t.d)->test.t.d, funcs:count(final,Column#12)->Column#9" ,
67
- " │ └─TableReader 200.00 root MppVersion: 2, data:ExchangeSender" ,
68
- " │ └─ExchangeSender 200.00 mpp[tiflash] ExchangeType: PassThrough" ,
69
- " │ └─HashAgg 200.00 mpp[tiflash] group by:test.t.d, funcs:count(partial1,1)->Column#12" ,
70
- " │ └─TableRangeScan 250.00 mpp[tiflash] table:t, partition:p1 range:[2023-07-01,2023-07-03], keep order:false, stats:pseudo" ,
71
- " └─Projection 200.00 root test.t.d" ,
72
- " └─HashAgg 200.00 root group by:test.t.d, funcs:firstrow(partial2,test.t.d)->test.t.d, funcs:count(final,Column#14)->Column#10" ,
73
- " └─TableReader 200.00 root MppVersion: 2, data:ExchangeSender" ,
74
- " └─ExchangeSender 200.00 mpp[tiflash] ExchangeType: PassThrough" ,
75
- " └─HashAgg 200.00 mpp[tiflash] group by:test.t.d, funcs:count(partial1,1)->Column#14" ,
76
- " └─TableRangeScan 250.00 mpp[tiflash] table:t, partition:p2 range:[2023-07-01,2023-07-03], keep order:false, stats:pseudo" ))
77
-
78
- err = failpoint .Disable ("github.com/pingcap/tidb/pkg/expression/aggregation/show-agg-mode" )
79
- require .Nil (t , err )
80
- }
81
28
func TestRowSizeInMPP (t * testing.T ) {
82
29
store := testkit .CreateMockStore (t )
83
30
tk := testkit .NewTestKit (t , store )
0 commit comments