Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dbca1c0e
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
dbca1c0e
编写于
3月 23, 2023
作者:
D
dapan1121
提交者:
GitHub
3月 23, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20595 from taosdata/fix/TD-23283
fix: slimit not work issue
上级
a14631dc
65068057
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
24 addition
and
14 deletion
+24
-14
source/libs/executor/src/projectoperator.c
source/libs/executor/src/projectoperator.c
+22
-13
tests/script/tsim/parser/limit1_stb.sim
tests/script/tsim/parser/limit1_stb.sim
+1
-0
tests/script/tsim/parser/slimit1_query.sim
tests/script/tsim/parser/slimit1_query.sim
+1
-1
未找到文件。
source/libs/executor/src/projectoperator.c
浏览文件 @
dbca1c0e
...
@@ -161,10 +161,9 @@ static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo
...
@@ -161,10 +161,9 @@ static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo
if
(
pLimitInfo
->
remainGroupOffset
>
0
)
{
if
(
pLimitInfo
->
remainGroupOffset
>
0
)
{
return
PROJECT_RETRIEVE_CONTINUE
;
return
PROJECT_RETRIEVE_CONTINUE
;
}
}
}
// set current group id of the project operator
pLimitInfo
->
currentGroupId
=
0
;
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
id
.
groupId
;
}
}
}
return
PROJECT_RETRIEVE_DONE
;
return
PROJECT_RETRIEVE_DONE
;
...
@@ -175,19 +174,29 @@ static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, S
...
@@ -175,19 +174,29 @@ static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, S
// here check for a new group data, we need to handle the data of the previous group.
// here check for a new group data, we need to handle the data of the previous group.
ASSERT
(
pLimitInfo
->
remainGroupOffset
==
0
||
pLimitInfo
->
remainGroupOffset
==
-
1
);
ASSERT
(
pLimitInfo
->
remainGroupOffset
==
0
||
pLimitInfo
->
remainGroupOffset
==
-
1
);
if
(
pLimitInfo
->
currentGroupId
!=
0
&&
pLimitInfo
->
currentGroupId
!=
pBlock
->
info
.
id
.
groupId
)
{
bool
newGroup
=
false
;
if
(
0
==
pBlock
->
info
.
id
.
groupId
)
{
pLimitInfo
->
numOfOutputGroups
=
1
;
}
else
if
(
pLimitInfo
->
currentGroupId
!=
pBlock
->
info
.
id
.
groupId
)
{
pLimitInfo
->
currentGroupId
=
pBlock
->
info
.
id
.
groupId
;
pLimitInfo
->
numOfOutputGroups
+=
1
;
pLimitInfo
->
numOfOutputGroups
+=
1
;
if
((
pLimitInfo
->
slimit
.
limit
>
0
)
&&
(
pLimitInfo
->
slimit
.
limit
<=
pLimitInfo
->
numOfOutputGroups
))
{
newGroup
=
true
;
}
else
{
return
PROJECT_RETRIEVE_CONTINUE
;
}
if
((
pLimitInfo
->
slimit
.
limit
>=
0
)
&&
(
pLimitInfo
->
slimit
.
limit
<
pLimitInfo
->
numOfOutputGroups
))
{
setOperatorCompleted
(
pOperator
);
setOperatorCompleted
(
pOperator
);
return
PROJECT_RETRIEVE_DONE
;
return
PROJECT_RETRIEVE_DONE
;
}
}
// reset the value for a new group data
// reset the value for a new group data
// existing rows that belongs to previous group.
// existing rows that belongs to previous group.
if
(
newGroup
)
{
resetLimitInfoForNextGroup
(
pLimitInfo
);
resetLimitInfoForNextGroup
(
pLimitInfo
);
}
}
return
PROJECT_RETRIEVE_
DON
E
;
return
PROJECT_RETRIEVE_
CONTINU
E
;
}
}
// todo refactor
// todo refactor
...
@@ -199,7 +208,7 @@ static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SS
...
@@ -199,7 +208,7 @@ static int32_t doIngroupLimitOffset(SLimitInfo* pLimitInfo, uint64_t groupId, SS
if
(
pBlock
->
info
.
rows
==
0
)
{
if
(
pBlock
->
info
.
rows
==
0
)
{
return
PROJECT_RETRIEVE_CONTINUE
;
return
PROJECT_RETRIEVE_CONTINUE
;
}
else
{
}
else
{
if
(
limitReached
&&
(
pLimitInfo
->
slimit
.
limit
>
0
&&
pLimitInfo
->
slimit
.
limit
<=
pLimitInfo
->
numOfOutputGroups
))
{
if
(
limitReached
&&
(
pLimitInfo
->
slimit
.
limit
>
=
0
&&
pLimitInfo
->
slimit
.
limit
<=
pLimitInfo
->
numOfOutputGroups
))
{
setOperatorCompleted
(
pOperator
);
setOperatorCompleted
(
pOperator
);
}
}
}
}
...
...
tests/script/tsim/parser/limit1_stb.sim
浏览文件 @
dbca1c0e
...
@@ -484,6 +484,7 @@ if $rows != 2 then
...
@@ -484,6 +484,7 @@ if $rows != 2 then
return -1
return -1
endi
endi
print === select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) limit 1 offset 0
sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) limit 1 offset 0
sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) limit 1 offset 0
if $rows != 3 then
if $rows != 3 then
return -1
return -1
...
...
tests/script/tsim/parser/slimit1_query.sim
浏览文件 @
dbca1c0e
...
@@ -70,7 +70,7 @@ endi
...
@@ -70,7 +70,7 @@ endi
### empty result set
### empty result set
sql select count(*) from stb partition by t2,t1 order by t2 asc slimit 0 soffset 0
sql select count(*) from stb partition by t2,t1 order by t2 asc slimit 0 soffset 0
if $rows !=
9
then
if $rows !=
0
then
return -1
return -1
endi
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录