Skip to content

Commit

Permalink
Merge branch 'main' into inthashmap
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Sep 12, 2024
2 parents dda6ba6 + 2c2d52b commit 623cb0e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
3 changes: 0 additions & 3 deletions pkg/sql/plan/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ func (builder *QueryBuilder) handleMessgaeFromTopToScan(nodeID int32) {
if orderByCol.Col.RelPos != scanNode.BindingTags[0] {
return
}
if GetSortOrder(scanNode.TableDef, orderByCol.Col.ColPos) != 0 {
return
}

msgTag := builder.genNewMsgTag()
msgHeader := &plan.MsgHeader{MsgTag: msgTag, MsgType: int32(message.MsgTopValue)}
Expand Down
22 changes: 22 additions & 0 deletions test/distributed/cases/optimizer/top.result
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,28 @@ c1 c2 c3 c1 c2 c3
899983 899983 899983 899983 899983 899983
899982 899982 899982 899982 899982 899982
899981 899981 899981 899981 899981 899981
explain select * from t1 order by c2 limit 10 offset 20;
AP QUERY PLAN ON MULTICN(4 core)
Project
-> Sort
Sort Key: t1.c2 INTERNAL
Limit: 10, Offset: 20
Send Message: [tag 1 , type MsgTopValue]
-> Table Scan on d1.t1
Sort Key: c2 INTERNAL
Recv Message: [tag 1 , type MsgTopValue]
select * from t1 order by c2 limit 10 offset 20;
c1 c2 c3
21 21 21
22 22 22
23 23 23
24 24 24
25 25 25
26 26 26
27 27 27
28 28 28
29 29 29
30 30 30
drop table if exists t1;
create table t1 (a int primary key, b int);
insert into t1 select result, result from generate_series (1, 800000)g;
Expand Down
3 changes: 3 additions & 0 deletions test/distributed/cases/optimizer/top.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ select * from t1,t2 where t1.c1=t2.c1 and t2.c2 between 33333 and 555555 order b
-- @separator:table
explain select * from t1,t2 where t1.c1=t2.c1 order by t1.c1 desc limit 10 offset 10;
select * from t1,t2 where t1.c1=t2.c1 and t2.c2 order by t1.c1 desc limit 10 offset 10;
-- @separator:table
explain select * from t1 order by c2 limit 10 offset 20;
select * from t1 order by c2 limit 10 offset 20;
drop table if exists t1;
create table t1 (a int primary key, b int);
insert into t1 select result, result from generate_series (1, 800000)g;
Expand Down

0 comments on commit 623cb0e

Please sign in to comment.