Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
9191700f
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看板
提交
9191700f
编写于
8月 06, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-805] opt perf.
上级
8b3ed9e5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
11 deletion
+17
-11
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+17
-11
未找到文件。
src/query/src/qExecutor.c
浏览文件 @
9191700f
...
@@ -125,6 +125,9 @@ static void finalizeQueryResult(SQueryRuntimeEnv *pRuntimeEnv);
...
@@ -125,6 +125,9 @@ static void finalizeQueryResult(SQueryRuntimeEnv *pRuntimeEnv);
(tw)->ekey = (tw)->skey + ((_q)->intervalTime - 1); \
(tw)->ekey = (tw)->skey + ((_q)->intervalTime - 1); \
} while (0)
} while (0)
#define SET_STABLE_QUERY_OVER(_q) ((_q)->tableIndex = (_q)->tableqinfoGroupInfo.numOfTables)
#define IS_STASBLE_QUERY_OVER(_q) ((_q)->tableIndex >= (_q)->tableqinfoGroupInfo.numOfTables)
// todo move to utility
// todo move to utility
static
int32_t
mergeIntoGroupResultImpl
(
SQInfo
*
pQInfo
,
SArray
*
group
);
static
int32_t
mergeIntoGroupResultImpl
(
SQInfo
*
pQInfo
,
SArray
*
group
);
...
@@ -2656,6 +2659,10 @@ int32_t mergeIntoGroupResult(SQInfo *pQInfo) {
...
@@ -2656,6 +2659,10 @@ int32_t mergeIntoGroupResult(SQInfo *pQInfo) {
qDebug
(
"QInfo:%p no result in group %d, continue"
,
pQInfo
,
pQInfo
->
groupIndex
-
1
);
qDebug
(
"QInfo:%p no result in group %d, continue"
,
pQInfo
,
pQInfo
->
groupIndex
-
1
);
}
}
if
(
pQInfo
->
groupIndex
==
numOfGroups
)
{
SET_STABLE_QUERY_OVER
(
pQInfo
);
}
qDebug
(
"QInfo:%p merge res data into group, index:%d, total group:%d, elapsed time:%"
PRId64
"ms"
,
pQInfo
,
qDebug
(
"QInfo:%p merge res data into group, index:%d, total group:%d, elapsed time:%"
PRId64
"ms"
,
pQInfo
,
pQInfo
->
groupIndex
-
1
,
numOfGroups
,
taosGetTimestampMs
()
-
st
);
pQInfo
->
groupIndex
-
1
,
numOfGroups
,
taosGetTimestampMs
()
-
st
);
...
@@ -2674,7 +2681,7 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) {
...
@@ -2674,7 +2681,7 @@ void copyResToQueryResultBuf(SQInfo *pQInfo, SQuery *pQuery) {
// check if all results has been sent to client
// check if all results has been sent to client
int32_t
numOfGroup
=
GET_NUM_OF_TABLEGROUP
(
pQInfo
);
int32_t
numOfGroup
=
GET_NUM_OF_TABLEGROUP
(
pQInfo
);
if
(
pQInfo
->
numOfGroupResultPages
==
0
&&
pQInfo
->
groupIndex
==
numOfGroup
)
{
if
(
pQInfo
->
numOfGroupResultPages
==
0
&&
pQInfo
->
groupIndex
==
numOfGroup
)
{
pQInfo
->
tableIndex
=
pQInfo
->
tableqinfoGroupInfo
.
numOfTables
;
// set query completed
SET_STABLE_QUERY_OVER
(
pQInfo
);
return
;
return
;
}
}
}
}
...
@@ -3821,7 +3828,7 @@ static void stableApplyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SDataBloc
...
@@ -3821,7 +3828,7 @@ static void stableApplyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SDataBloc
}
}
}
}
bool
queryHasRemainRes
ults
(
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
bool
queryHasRemainRes
ForTableQuery
(
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
SFillInfo
*
pFillInfo
=
pRuntimeEnv
->
pFillInfo
;
SFillInfo
*
pFillInfo
=
pRuntimeEnv
->
pFillInfo
;
...
@@ -3830,8 +3837,7 @@ bool queryHasRemainResults(SQueryRuntimeEnv* pRuntimeEnv) {
...
@@ -3830,8 +3837,7 @@ bool queryHasRemainResults(SQueryRuntimeEnv* pRuntimeEnv) {
}
}
if
(
pQuery
->
fillType
!=
TSDB_FILL_NONE
&&
!
isPointInterpoQuery
(
pQuery
))
{
if
(
pQuery
->
fillType
!=
TSDB_FILL_NONE
&&
!
isPointInterpoQuery
(
pQuery
))
{
// There are results not returned to client yet, so filling operation applied to the remain result is required
// There are results not returned to client yet, so filling applied to the remain result is required firstly.
// in the first place.
int32_t
remain
=
taosNumOfRemainRows
(
pFillInfo
);
int32_t
remain
=
taosNumOfRemainRows
(
pFillInfo
);
if
(
remain
>
0
)
{
if
(
remain
>
0
)
{
return
true
;
return
true
;
...
@@ -3885,14 +3891,14 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data
...
@@ -3885,14 +3891,14 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data
data
+=
sizeof
(
STableIdInfo
);
data
+=
sizeof
(
STableIdInfo
);
}
}
//
all data returned, set query over
//
Check if query is completed or not for stable query or normal table query respectively.
if
(
Q_STATUS_EQUAL
(
pQuery
->
status
,
QUERY_COMPLETED
))
{
if
(
Q_STATUS_EQUAL
(
pQuery
->
status
,
QUERY_COMPLETED
))
{
if
(
pQInfo
->
runtimeEnv
.
stableQuery
)
{
if
(
pQInfo
->
runtimeEnv
.
stableQuery
)
{
if
(
pQInfo
->
tableIndex
>=
pQInfo
->
tableqinfoGroupInfo
.
numOfTables
)
{
if
(
IS_STASBLE_QUERY_OVER
(
pQInfo
)
)
{
setQueryStatus
(
pQuery
,
QUERY_OVER
);
setQueryStatus
(
pQuery
,
QUERY_OVER
);
}
}
}
else
{
}
else
{
if
(
!
queryHasRemainRes
ults
(
&
pQInfo
->
runtimeEnv
))
{
if
(
!
queryHasRemainRes
ForTableQuery
(
&
pQInfo
->
runtimeEnv
))
{
setQueryStatus
(
pQuery
,
QUERY_OVER
);
setQueryStatus
(
pQuery
,
QUERY_OVER
);
}
}
}
}
...
@@ -3938,7 +3944,7 @@ int32_t doFillGapsInResults(SQueryRuntimeEnv* pRuntimeEnv, tFilePage **pDst, int
...
@@ -3938,7 +3944,7 @@ int32_t doFillGapsInResults(SQueryRuntimeEnv* pRuntimeEnv, tFilePage **pDst, int
ret
=
0
;
ret
=
0
;
}
}
if
(
!
queryHasRemainRes
ults
(
pRuntimeEnv
))
{
if
(
!
queryHasRemainRes
ForTableQuery
(
pRuntimeEnv
))
{
return
ret
;
return
ret
;
}
}
}
}
...
@@ -4702,7 +4708,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) {
...
@@ -4702,7 +4708,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) {
// the limitation of output result is reached, set the query completed
// the limitation of output result is reached, set the query completed
if
(
limitResults
(
pRuntimeEnv
))
{
if
(
limitResults
(
pRuntimeEnv
))
{
pQInfo
->
tableIndex
=
pQInfo
->
tableqinfoGroupInfo
.
numOfTables
;
SET_STABLE_QUERY_OVER
(
pQInfo
)
;
break
;
break
;
}
}
...
@@ -5097,7 +5103,7 @@ static void tableQueryImpl(SQInfo *pQInfo) {
...
@@ -5097,7 +5103,7 @@ static void tableQueryImpl(SQInfo *pQInfo) {
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
if
(
queryHasRemainRes
ults
(
pRuntimeEnv
))
{
if
(
queryHasRemainRes
ForTableQuery
(
pRuntimeEnv
))
{
if
(
pQuery
->
fillType
!=
TSDB_FILL_NONE
)
{
if
(
pQuery
->
fillType
!=
TSDB_FILL_NONE
)
{
/*
/*
...
@@ -6598,7 +6604,7 @@ static void buildTagQueryResult(SQInfo* pQInfo) {
...
@@ -6598,7 +6604,7 @@ static void buildTagQueryResult(SQInfo* pQInfo) {
*
(
int64_t
*
)
pQuery
->
sdata
[
0
]
->
data
=
num
;
*
(
int64_t
*
)
pQuery
->
sdata
[
0
]
->
data
=
num
;
count
=
1
;
count
=
1
;
pQInfo
->
tableIndex
=
num
;
//set query completed
SET_STABLE_QUERY_OVER
(
pQInfo
);
qDebug
(
"QInfo:%p create count(tbname) query, res:%d rows:1"
,
pQInfo
,
count
);
qDebug
(
"QInfo:%p create count(tbname) query, res:%d rows:1"
,
pQInfo
,
count
);
}
else
{
// return only the tags|table name etc.
}
else
{
// return only the tags|table name etc.
count
=
0
;
count
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录