Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
4a7fc101
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4a7fc101
编写于
11月 19, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2159]
上级
ec8c6d0c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
11 deletion
+29
-11
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+3
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+21
-10
tests/script/general/parser/groupby.sim
tests/script/general/parser/groupby.sim
+5
-0
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
4a7fc101
...
...
@@ -5509,7 +5509,9 @@ void doAddGroupColumnForSubquery(SQueryInfo* pQueryInfo, int32_t tagIndex) {
tscAddSpecialColumnForSelect
(
pQueryInfo
,
(
int32_t
)
size
,
TSDB_FUNC_PRJ
,
&
colIndex
,
pSchema
,
TSDB_COL_NORMAL
);
SInternalField
*
pInfo
=
tscFieldInfoGetInternalField
(
&
pQueryInfo
->
fieldsInfo
,
(
int32_t
)
size
);
int32_t
numOfFields
=
tscNumOfFields
(
pQueryInfo
);
SInternalField
*
pInfo
=
tscFieldInfoGetInternalField
(
&
pQueryInfo
->
fieldsInfo
,
numOfFields
-
1
);
doLimitOutputNormalColOfGroupby
(
pInfo
->
pSqlExpr
);
pInfo
->
visible
=
false
;
}
...
...
src/query/src/qExecutor.c
浏览文件 @
4a7fc101
...
...
@@ -5533,10 +5533,12 @@ static void tableIntervalProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) {
TSKEY
newStartKey
=
TSKEY_INITIAL_VAL
;
// skip blocks without load the actual data block from file if no filter condition present
skipTimeInterval
(
pRuntimeEnv
,
&
newStartKey
);
if
(
pQuery
->
limit
.
offset
>
0
&&
pQuery
->
numOfFilterCols
==
0
&&
pRuntimeEnv
->
pFillInfo
==
NULL
)
{
setQueryStatus
(
pQuery
,
QUERY_COMPLETED
);
return
;
if
(
!
pRuntimeEnv
->
groupbyNormalCol
)
{
skipTimeInterval
(
pRuntimeEnv
,
&
newStartKey
);
if
(
pQuery
->
limit
.
offset
>
0
&&
pQuery
->
numOfFilterCols
==
0
&&
pRuntimeEnv
->
pFillInfo
==
NULL
)
{
setQueryStatus
(
pQuery
,
QUERY_COMPLETED
);
return
;
}
}
while
(
1
)
{
...
...
@@ -5551,7 +5553,7 @@ static void tableIntervalProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) {
}
// no result generated, abort
if
(
pQuery
->
rec
.
rows
==
0
)
{
if
(
pQuery
->
rec
.
rows
==
0
||
pRuntimeEnv
->
groupbyNormalCol
)
{
break
;
}
...
...
@@ -5579,12 +5581,21 @@ static void tableIntervalProcess(SQInfo *pQInfo, STableQueryInfo* pTableInfo) {
// all data scanned, the group by normal column can return
if
(
pRuntimeEnv
->
groupbyNormalCol
)
{
// todo refactor with merge interval time result
pQInfo
->
groupIndex
=
0
;
pQuery
->
rec
.
rows
=
0
;
copyFromWindowResToSData
(
pQInfo
,
&
pRuntimeEnv
->
windowResInfo
);
clearFirstNTimeWindow
(
pRuntimeEnv
,
pQInfo
->
groupIndex
);
// maxOutput <= 0, means current query does not generate any results
int32_t
numOfClosed
=
numOfClosedTimeWindow
(
&
pRuntimeEnv
->
windowResInfo
);
limitResults
(
pRuntimeEnv
);
if
((
pQuery
->
limit
.
offset
>
0
&&
pQuery
->
limit
.
offset
<
numOfClosed
)
||
pQuery
->
limit
.
offset
==
0
)
{
// skip offset result rows
clearFirstNTimeWindow
(
pRuntimeEnv
,
pQuery
->
limit
.
offset
);
pQuery
->
rec
.
rows
=
0
;
pQInfo
->
groupIndex
=
0
;
copyFromWindowResToSData
(
pQInfo
,
&
pRuntimeEnv
->
windowResInfo
);
clearFirstNTimeWindow
(
pRuntimeEnv
,
pQInfo
->
groupIndex
);
doSecondaryArithmeticProcess
(
pQuery
);
limitResults
(
pRuntimeEnv
);
}
}
}
...
...
tests/script/general/parser/groupby.sim
浏览文件 @
4a7fc101
...
...
@@ -456,6 +456,11 @@ if $rows != 1 then
return -1
endi
sql select count(*),first(ts),last(ts),min(c3) from group_tb1 group by c4 limit 20 offset 9990;
if $rows != 10 then
return -1
endi
sql select count(*),first(ts),last(ts),min(c3),max(c3),sum(c3),avg(c3),sum(c4)/count(c4) from group_tb1 group by c8;
if $rows != 10000 then
return -1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录