@@ -21,6 +21,7 @@ import (
21
21
"time"
22
22
23
23
. "github.com/pingcap/check"
24
+ "github.com/pingcap/tidb/domain"
24
25
"github.com/pingcap/tidb/infoschema"
25
26
"github.com/pingcap/tidb/parser/model"
26
27
"github.com/pingcap/tidb/sessionctx/variable"
@@ -1726,6 +1727,36 @@ func (s *partitionTableSuite) TestAddDropPartitions(c *C) {
1726
1727
tk .MustPartition (`select * from t where a < 20` , "p1,p2,p3" ).Sort ().Check (testkit .Rows ("12" , "15" , "7" ))
1727
1728
}
1728
1729
1730
+ func (s * partitionTableSuite ) TestMPPQueryExplainInfo (c * C ) {
1731
+ if israce .RaceEnabled {
1732
+ c .Skip ("exhaustive types test, skip race test" )
1733
+ }
1734
+
1735
+ tk := testkit .NewTestKitWithInit (c , s .store )
1736
+ tk .MustExec ("create database tiflash_partition_test" )
1737
+ tk .MustExec ("use tiflash_partition_test" )
1738
+ tk .MustExec ("set @@tidb_partition_prune_mode = 'dynamic'" )
1739
+
1740
+ tk .MustExec (`create table t(a int) partition by range(a) (
1741
+ partition p0 values less than (5),
1742
+ partition p1 values less than (10),
1743
+ partition p2 values less than (15))` )
1744
+ tb := testGetTableByName (c , tk .Se , "tiflash_partition_test" , "t" )
1745
+ for _ , partition := range tb .Meta ().GetPartitionInfo ().Definitions {
1746
+ err := domain .GetDomain (tk .Se ).DDL ().UpdateTableReplicaInfo (tk .Se , partition .ID , true )
1747
+ c .Assert (err , IsNil )
1748
+ }
1749
+ err := domain .GetDomain (tk .Se ).DDL ().UpdateTableReplicaInfo (tk .Se , tb .Meta ().ID , true )
1750
+ c .Assert (err , IsNil )
1751
+ tk .MustExec (`insert into t values (2), (7), (12)` )
1752
+ tk .MustExec ("set tidb_enforce_mpp=1" )
1753
+ tk .MustPartition (`select * from t where a < 3` , "p0" ).Sort ().Check (testkit .Rows ("2" ))
1754
+ tk .MustPartition (`select * from t where a < 8` , "p0,p1" ).Sort ().Check (testkit .Rows ("2" , "7" ))
1755
+ tk .MustPartition (`select * from t where a < 20` , "all" ).Sort ().Check (testkit .Rows ("12" , "2" , "7" ))
1756
+ tk .MustPartition (`select * from t where a < 5 union all select * from t where a > 10` , "p0" ).Sort ().Check (testkit .Rows ("12" , "2" ))
1757
+ tk .MustPartition (`select * from t where a < 5 union all select * from t where a > 10` , "p2" ).Sort ().Check (testkit .Rows ("12" , "2" ))
1758
+ }
1759
+
1729
1760
func (s * partitionTableSuite ) PartitionPruningInTransaction (c * C ) {
1730
1761
if israce .RaceEnabled {
1731
1762
c .Skip ("exhaustive types test, skip race test" )
0 commit comments