Skip to content

Commit

Permalink
executor: fix IsPointGet judgment condition (#10278) (#10304)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao authored and jackysp committed Apr 30, 2019
1 parent 6641576 commit 81cf6ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 0 additions & 3 deletions executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,6 @@ func IsPointGetWithPKOrUniqueKeyByAutoCommit(ctx sessionctx.Context, p plan.Plan
case *plan.PhysicalIndexReader:
indexScan := v.IndexPlans[0].(*plan.PhysicalIndexScan)
return indexScan.IsPointGetByUniqueKey(ctx.GetSessionVars().StmtCtx), nil
case *plan.PhysicalIndexLookUpReader:
indexScan := v.IndexPlans[0].(*plan.PhysicalIndexScan)
return indexScan.IsPointGetByUniqueKey(ctx.GetSessionVars().StmtCtx), nil
case *plan.PhysicalTableReader:
tableScan := v.TablePlans[0].(*plan.PhysicalTableScan)
return len(tableScan.Ranges) == 1 && tableScan.Ranges[0].IsPoint(ctx.GetSessionVars().StmtCtx), nil
Expand Down
7 changes: 4 additions & 3 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,8 @@ func (s *testSuite) TestPointGet(c *C) {
tk.MustExec("use mysql")
ctx := tk.Se.(sessionctx.Context)
tests := map[string]bool{
"select * from help_topic where name='aaa'": true,
"select 1 from help_topic where name='aaa'": true,
"select * from help_topic where name='aaa'": false,
"select * from help_topic where help_topic_id=1": true,
"select * from help_topic where help_category_id=1": false,
}
Expand Down Expand Up @@ -2440,7 +2441,7 @@ func (s *testContextOptionSuite) TestCoprocessorPriority(c *C) {

cli.priority = pb.CommandPri_High
tk.MustQuery("select id from t where id = 1")
tk.MustQuery("select * from t1 where id = 1")
tk.MustQuery("select 1 from t1 where id = 1")

cli.priority = pb.CommandPri_Normal
tk.MustQuery("select count(*) from t")
Expand All @@ -2458,7 +2459,7 @@ func (s *testContextOptionSuite) TestCoprocessorPriority(c *C) {

cli.priority = pb.CommandPri_High
tk.MustQuery("select id from t where id = 1")
tk.MustQuery("select * from t1 where id = 1")
tk.MustQuery("select 1 from t1 where id = 1")

cli.priority = pb.CommandPri_Low
tk.MustQuery("select count(*) from t")
Expand Down

0 comments on commit 81cf6ca

Please sign in to comment.