@@ -379,15 +379,23 @@ func TestBatchPointGetIssue46779(t *testing.T) {
379
379
tk .MustExec ("drop table if exists t1" )
380
380
tk .MustExec ("CREATE TABLE t1 (id int, c varchar(128), primary key (id)) PARTITION BY HASH (id) PARTITIONS 3;" )
381
381
tk .MustExec (`insert into t1 values (1, "a"), (11, "b"), (21, "c")` )
382
- tk .MustQuery ("select * from t1 where id in (1, 1, 11)" ).Sort ().Check (testkit .Rows ("1 a" , "11 b" ))
383
- tk .MustQuery ("select * from t1 where id in (1, 11, 11, 21)" ).Sort ().Check (testkit .Rows ("1 a" , "11 b" , "21 c" ))
382
+ query := "select * from t1 where id in (1, 1, 11)"
383
+ require .True (t , tk .HasPlan (query , "Batch_Point_Get" )) // check if BatchPointGet is used
384
+ tk .MustQuery (query ).Sort ().Check (testkit .Rows ("1 a" , "11 b" ))
385
+ query = "select * from t1 where id in (1, 11, 11, 21)"
386
+ require .True (t , tk .HasPlan (query , "Batch_Point_Get" )) // check if BatchPointGet is used
387
+ tk .MustQuery (query ).Sort ().Check (testkit .Rows ("1 a" , "11 b" , "21 c" ))
384
388
385
389
tk .MustExec ("drop table if exists t2" )
386
390
tk .MustExec (`CREATE TABLE t2 (id int, c varchar(128), primary key (id)) partition by range (id)(
387
391
partition p0 values less than (10),
388
392
partition p1 values less than (20),
389
393
partition p2 values less than (30));` )
390
394
tk .MustExec (`insert into t2 values (1, "a"), (11, "b"), (21, "c")` )
391
- tk .MustQuery ("select * from t2 where id in (1, 1, 11)" ).Sort ().Check (testkit .Rows ("1 a" , "11 b" ))
392
- tk .MustQuery ("select * from t2 where id in (1, 11, 11, 21)" ).Sort ().Check (testkit .Rows ("1 a" , "11 b" , "21 c" ))
395
+ query = "select * from t2 where id in (1, 1, 11)"
396
+ require .True (t , tk .HasPlan (query , "Batch_Point_Get" )) // check if BatchPointGet is used
397
+ tk .MustQuery (query ).Sort ().Check (testkit .Rows ("1 a" , "11 b" ))
398
+ require .True (t , tk .HasPlan (query , "Batch_Point_Get" )) // check if BatchPointGet is used
399
+ query = "select * from t2 where id in (1, 11, 11, 21)"
400
+ tk .MustQuery (query ).Sort ().Check (testkit .Rows ("1 a" , "11 b" , "21 c" ))
393
401
}
0 commit comments