Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5746730a
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5746730a
编写于
2月 26, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-2895] refactor.
上级
4ad9e11b
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
172 addition
and
197 deletion
+172
-197
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+4
-9
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+153
-178
src/query/src/queryMain.c
src/query/src/queryMain.c
+15
-10
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
5746730a
...
...
@@ -106,12 +106,11 @@ typedef struct SGroupResInfo {
* If the number of generated results is greater than this value,
* query query will be halt and return results to client immediate.
*/
typedef
struct
SR
esultRec
{
typedef
struct
SR
spResultInfo
{
int64_t
total
;
// total generated result size in rows
int64_t
rows
;
// current result set size in rows
int64_t
capacity
;
// capacity of current result output buffer
int32_t
threshold
;
// result size threshold in rows.
}
SR
esultRec
;
}
SR
spResultInfo
;
typedef
struct
SResultRowInfo
{
SResultRow
**
pResult
;
// result list
...
...
@@ -185,7 +184,6 @@ typedef struct SSDataBlock {
SDataBlockInfo
info
;
}
SSDataBlock
;
typedef
struct
SQuery
{
SLimitVal
limit
;
...
...
@@ -227,9 +225,6 @@ typedef struct SQuery {
SSingleColumnFilterInfo
*
pFilterInfo
;
uint32_t
status
;
// query status
SResultRec
rec
;
int32_t
pos
;
tFilePage
**
sdata
;
STableQueryInfo
*
current
;
int32_t
numOfCheckedBlocks
;
// number of check data blocks
...
...
@@ -266,15 +261,15 @@ typedef struct SQueryRuntimeEnv {
char
*
tagVal
;
// tag value of current data block
SArithmeticSupport
*
sasArray
;
struct
SOperatorInfo
*
pi
;
SSDataBlock
*
outputBuf
;
int32_t
groupIndex
;
int32_t
tableIndex
;
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
struct
SOperatorInfo
*
proot
;
SGroupResInfo
groupResInfo
;
int64_t
currentOffset
;
// dynamic offset value
SRspResultInfo
resultInfo
;
}
SQueryRuntimeEnv
;
enum
{
...
...
src/query/src/qExecutor.c
浏览文件 @
5746730a
此差异已折叠。
点击以展开。
src/query/src/queryMain.c
浏览文件 @
5746730a
...
...
@@ -244,14 +244,15 @@ bool qTableQuery(qinfo_t qinfo) {
tableQueryImpl
(
pQInfo
);
}
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
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
,
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
,
pQuery
->
rec
.
total
);
}
else
if
(
pRuntimeEnv
->
outputBuf
->
info
.
rows
==
0
)
{
qDebug
(
"QInfo:%p over, %"
PRIzu
" tables queried, %"
PRId64
" rows are returned"
,
pQInfo
,
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
,
pRuntimeEnv
->
resultInfo
.
total
);
}
else
{
qDebug
(
"QInfo:%p query paused, %"
PRId64
" rows returned, numOfTotal:%"
PRId64
" rows"
,
pQInfo
,
pQuery
->
rec
.
rows
,
pQuery
->
rec
.
total
+
pQuery
->
rec
.
rows
);
qDebug
(
"QInfo:%p query paused, %d rows returned, numOfTotal:%"
PRId64
" rows"
,
pQInfo
,
pRuntimeEnv
->
outputBuf
->
info
.
rows
,
pRuntimeEnv
->
resultInfo
.
total
+
pRuntimeEnv
->
outputBuf
->
info
.
rows
);
}
return
doBuildResCheck
(
pQInfo
);
...
...
@@ -279,6 +280,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
*
buildRes
=
true
;
code
=
pQInfo
->
code
;
}
else
{
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
pthread_mutex_lock
(
&
pQInfo
->
lock
);
...
...
@@ -286,8 +288,8 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
assert
(
pQInfo
->
rspContext
==
NULL
);
if
(
pQInfo
->
dataReady
==
QUERY_RESULT_READY
)
{
*
buildRes
=
true
;
qDebug
(
"QInfo:%p retrieve result info, rowsize:%d, rows:%
"
PRId64
"
, code:%s"
,
pQInfo
,
pQuery
->
resultRowSize
,
p
Query
->
rec
.
rows
,
tstrerror
(
pQInfo
->
code
));
qDebug
(
"QInfo:%p retrieve result info, rowsize:%d, rows:%
d
, code:%s"
,
pQInfo
,
pQuery
->
resultRowSize
,
p
RuntimeEnv
->
outputBuf
->
info
.
rows
,
tstrerror
(
pQInfo
->
code
));
}
else
{
*
buildRes
=
false
;
qDebug
(
"QInfo:%p retrieve req set query return result after paused"
,
pQInfo
);
...
...
@@ -310,7 +312,10 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
}
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
size_t
size
=
getResultSize
(
pQInfo
,
&
pQuery
->
rec
.
rows
);
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
int64_t
s
=
pRuntimeEnv
->
outputBuf
->
info
.
rows
;
size_t
size
=
getResultSize
(
pQInfo
,
&
s
);
size
+=
sizeof
(
int32_t
);
size
+=
sizeof
(
STableIdInfo
)
*
taosHashGetSize
(
pQInfo
->
arrTableIdInfo
);
...
...
@@ -323,7 +328,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
(
*
pRsp
)
->
numOfRows
=
htonl
((
int32_t
)
pQuery
->
rec
.
row
s
);
(
*
pRsp
)
->
numOfRows
=
htonl
((
int32_t
)
s
);
if
(
pQInfo
->
code
==
TSDB_CODE_SUCCESS
)
{
(
*
pRsp
)
->
offset
=
htobe64
(
pQInfo
->
runtimeEnv
.
currentOffset
);
...
...
@@ -334,7 +339,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
}
(
*
pRsp
)
->
precision
=
htons
(
pQuery
->
precision
);
if
(
pQ
uery
->
rec
.
rows
>
0
&&
pQInfo
->
code
==
TSDB_CODE_SUCCESS
)
{
if
(
pQ
Info
->
runtimeEnv
.
outputBuf
->
info
.
rows
>
0
&&
pQInfo
->
code
==
TSDB_CODE_SUCCESS
)
{
doDumpQueryResult
(
pQInfo
,
(
*
pRsp
)
->
data
);
}
else
{
setQueryStatus
(
pQuery
,
QUERY_OVER
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录