Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
db12677c
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
db12677c
编写于
2月 08, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225]refactor
上级
428bd3b7
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
132 addition
and
113 deletion
+132
-113
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+118
-100
src/query/src/qUtil.c
src/query/src/qUtil.c
+7
-5
src/query/src/queryMain.c
src/query/src/queryMain.c
+6
-7
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
db12677c
...
...
@@ -269,6 +269,7 @@ typedef struct SQueryRuntimeEnv {
SSDataBlock
*
ouptputBuf
;
int32_t
groupIndex
;
int32_t
tableIndex
;
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
}
SQueryRuntimeEnv
;
...
...
@@ -295,7 +296,6 @@ typedef struct SQInfo {
* the query is executed position on which meter of the whole list.
* when the index reaches the last one of the list, it means the query is completed.
*/
int32_t
tableIndex
;
SGroupResInfo
groupResInfo
;
void
*
pBuf
;
// allocated buffer for STableQueryInfo, sizeof(STableQueryInfo)*numOfTables;
...
...
src/query/src/qExecutor.c
浏览文件 @
db12677c
此差异已折叠。
点击以展开。
src/query/src/qUtil.c
浏览文件 @
db12677c
...
...
@@ -164,7 +164,8 @@ SResultRowCellInfo* getResultCell(SQueryRuntimeEnv* pRuntimeEnv, const SResultRo
}
size_t
getResultRowSize
(
SQueryRuntimeEnv
*
pRuntimeEnv
)
{
return
(
pRuntimeEnv
->
pQuery
->
numOfOutput
*
sizeof
(
SResultRowCellInfo
))
+
pRuntimeEnv
->
interBufSize
+
sizeof
(
SResultRow
);
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
return
(
pQuery
->
numOfOutput
*
sizeof
(
SResultRowCellInfo
))
+
pQuery
->
interBufSize
+
sizeof
(
SResultRow
);
}
SResultRowPool
*
initResultRowPool
(
size_t
size
)
{
...
...
@@ -540,11 +541,12 @@ static int32_t mergeIntoGroupResultImpl(SQueryRuntimeEnv *pRuntimeEnv, SGroupRes
int32_t
mergeIntoGroupResult
(
SGroupResInfo
*
pGroupResInfo
,
SQInfo
*
pQInfo
)
{
int64_t
st
=
taosGetTimestampUs
();
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
while
(
pGroupResInfo
->
currentGroup
<
pGroupResInfo
->
totalGroup
)
{
SArray
*
group
=
GET_TABLEGROUP
(
p
QInfo
,
pGroupResInfo
->
currentGroup
);
SArray
*
group
=
GET_TABLEGROUP
(
p
RuntimeEnv
,
pGroupResInfo
->
currentGroup
);
int32_t
ret
=
mergeIntoGroupResultImpl
(
&
pQInfo
->
r
untimeEnv
,
pGroupResInfo
,
group
,
pQInfo
);
int32_t
ret
=
mergeIntoGroupResultImpl
(
pR
untimeEnv
,
pGroupResInfo
,
group
,
pQInfo
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
...
...
@@ -560,13 +562,13 @@ int32_t mergeIntoGroupResult(SGroupResInfo* pGroupResInfo, SQInfo *pQInfo) {
}
if
(
pGroupResInfo
->
currentGroup
>=
pGroupResInfo
->
totalGroup
&&
!
hasRemainData
(
pGroupResInfo
))
{
SET_STABLE_QUERY_OVER
(
p
QInfo
);
SET_STABLE_QUERY_OVER
(
p
RuntimeEnv
);
}
int64_t
elapsedTime
=
taosGetTimestampUs
()
-
st
;
qDebug
(
"QInfo:%p merge res data into group, index:%d, total group:%d, elapsed time:%"
PRId64
"us"
,
pQInfo
,
pGroupResInfo
->
currentGroup
,
pGroupResInfo
->
totalGroup
,
elapsedTime
);
pQInfo
->
runtimeEnv
.
summary
.
firstStageMergeTime
+=
elapsedTime
;
pQInfo
->
summary
.
firstStageMergeTime
+=
elapsedTime
;
return
TSDB_CODE_SUCCESS
;
}
src/query/src/queryMain.c
浏览文件 @
db12677c
...
...
@@ -216,7 +216,7 @@ bool qTableQuery(qinfo_t qinfo) {
return
doBuildResCheck
(
pQInfo
);
}
if
(
pQInfo
->
tableqinfoGroupInfo
.
numOfTables
==
0
)
{
if
(
pQInfo
->
runtimeEnv
.
tableqinfoGroupInfo
.
numOfTables
==
0
)
{
qDebug
(
"QInfo:%p no table exists for query, abort"
,
pQInfo
);
setQueryStatus
(
pQInfo
->
runtimeEnv
.
pQuery
,
QUERY_COMPLETED
);
return
doBuildResCheck
(
pQInfo
);
...
...
@@ -236,9 +236,9 @@ bool qTableQuery(qinfo_t qinfo) {
if
(
onlyQueryTags
(
pQInfo
->
runtimeEnv
.
pQuery
))
{
assert
(
pQInfo
->
runtimeEnv
.
pQueryHandle
==
NULL
);
buildTagQueryResult
(
pQInfo
);
}
else
if
(
pQInfo
->
runtimeEnv
.
stableQuery
)
{
}
else
if
(
pQInfo
->
query
.
stableQuery
)
{
stableQueryImpl
(
pQInfo
);
}
else
if
(
pQInfo
->
runtimeEnv
.
queryBlockDist
){
}
else
if
(
pQInfo
->
query
.
queryBlockDist
){
buildTableBlockDistResult
(
pQInfo
);
}
else
{
tableQueryImpl
(
pQInfo
);
...
...
@@ -248,7 +248,7 @@ bool qTableQuery(qinfo_t qinfo) {
if
(
isQueryKilled
(
pQInfo
))
{
qDebug
(
"QInfo:%p query is killed"
,
pQInfo
);
}
else
if
(
pQuery
->
rec
.
rows
==
0
)
{
qDebug
(
"QInfo:%p over, %"
PRIzu
" tables queried, %"
PRId64
" rows are returned"
,
pQInfo
,
p
QInfo
->
tableqinfoGroupInfo
.
numOfTables
,
pQuery
->
rec
.
total
);
qDebug
(
"QInfo:%p over, %"
PRIzu
" tables queried, %"
PRId64
" rows are returned"
,
pQInfo
,
p
RuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
,
pQuery
->
rec
.
total
);
}
else
{
qDebug
(
"QInfo:%p query paused, %"
PRId64
" rows returned, numOfTotal:%"
PRId64
" rows"
,
pQInfo
,
pQuery
->
rec
.
rows
,
pQuery
->
rec
.
total
+
pQuery
->
rec
.
rows
);
...
...
@@ -309,7 +309,6 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
}
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
size_t
size
=
getResultSize
(
pQInfo
,
&
pQuery
->
rec
.
rows
);
...
...
@@ -328,10 +327,10 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
if
(
pQInfo
->
code
==
TSDB_CODE_SUCCESS
)
{
(
*
pRsp
)
->
offset
=
htobe64
(
pQuery
->
limit
.
offset
);
(
*
pRsp
)
->
useconds
=
htobe64
(
p
RuntimeEnv
->
summary
.
elapsedTime
);
(
*
pRsp
)
->
useconds
=
htobe64
(
p
QInfo
->
summary
.
elapsedTime
);
}
else
{
(
*
pRsp
)
->
offset
=
0
;
(
*
pRsp
)
->
useconds
=
htobe64
(
p
RuntimeEnv
->
summary
.
elapsedTime
);
(
*
pRsp
)
->
useconds
=
htobe64
(
p
QInfo
->
summary
.
elapsedTime
);
}
(
*
pRsp
)
->
precision
=
htons
(
pQuery
->
precision
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录