Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzh_me
TDengine
提交
18112c74
TDengine
项目概览
lzh_me
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
18112c74
编写于
2月 27, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-2895] refactor.
上级
5746730a
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
155 addition
and
183 deletion
+155
-183
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+16
-10
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+134
-167
src/query/src/queryMain.c
src/query/src/queryMain.c
+5
-6
未找到文件。
src/query/inc/qExecutor.h
浏览文件 @
18112c74
...
...
@@ -42,6 +42,8 @@ typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int
#define GET_TABLEGROUP(q, _index) ((SArray*) taosArrayGetP((q)->tableqinfoGroupInfo.pGroupList, (_index)))
#define GET_NUM_OF_RESULTS(_r) (((_r)->outputBuf) == NULL? 0:((_r)->outputBuf)->info.rows)
enum
{
// when query starts to execute, this status will set
QUERY_NOT_COMPLETED
=
0x1u
,
...
...
@@ -281,8 +283,7 @@ enum {
typedef
struct
SOperatorInfo
{
uint8_t
operatorType
;
bool
blockingOptr
;
// block operator or not
uint8_t
completed
;
// denote if current operator is completed
uint32_t
seed
;
// operator seed
uint8_t
status
;
// denote if current operator is completed
int32_t
numOfOutput
;
// number of columns of the current operator results
char
*
name
;
// name, used to show the query execution plan
void
*
info
;
// extension attribution
...
...
@@ -306,7 +307,6 @@ typedef struct SQInfo {
SQueryRuntimeEnv
runtimeEnv
;
SQuery
query
;
SHashObj
*
arrTableIdInfo
;
/*
...
...
@@ -363,13 +363,14 @@ typedef struct STableScanInfo {
SExprInfo
*
pExpr
;
int32_t
numOfOutput
;
int64_t
elapsedTime
;
}
STableScanInfo
;
typedef
struct
STagScanInfo
{
SColumnInfo
*
pCols
;
SSDataBlock
*
pRes
;
int32_t
totalTables
;
int32_t
currentIndex
;
}
STagScanInfo
;
typedef
struct
SOptrBasicInfo
{
...
...
@@ -379,12 +380,17 @@ typedef struct SOptrBasicInfo {
SSDataBlock
*
pRes
;
}
SOptrBasicInfo
;
typedef
struct
SOptrBasicInfo
SAggOperatorInfo
;
typedef
struct
SOptrBasicInfo
SHashIntervalOperatorInfo
;
typedef
struct
SOptrBasicInfo
STableIntervalOperatorInfo
;
typedef
struct
SAggOperatorInfo
{
SOptrBasicInfo
binfo
;
uint32_t
seed
;
}
SAggOperatorInfo
;
typedef
struct
SArithOperatorInfo
{
SOptrBasicInfo
binfo
;
int32_t
bufCapacity
;
uint32_t
seed
;
}
SArithOperatorInfo
;
typedef
struct
SLimitOperatorInfo
{
...
...
@@ -401,10 +407,10 @@ typedef struct SFillOperatorInfo {
int64_t
totalInputRows
;
}
SFillOperatorInfo
;
typedef
struct
S
Hash
GroupbyOperatorInfo
{
SOptrBasicInfo
binfo
;
int32_t
colIndex
;
}
S
Hash
GroupbyOperatorInfo
;
typedef
struct
SGroupbyOperatorInfo
{
SOptrBasicInfo
binfo
;
int32_t
colIndex
;
}
SGroupbyOperatorInfo
;
void
freeParam
(
SQueryParam
*
param
);
int32_t
convertQueryMsg
(
SQueryTableMsg
*
pQueryMsg
,
SQueryParam
*
param
);
...
...
src/query/src/qExecutor.c
浏览文件 @
18112c74
此差异已折叠。
点击以展开。
src/query/src/queryMain.c
浏览文件 @
18112c74
...
...
@@ -246,13 +246,12 @@ bool qTableQuery(qinfo_t qinfo) {
if
(
isQueryKilled
(
pQInfo
))
{
qDebug
(
"QInfo:%p query is killed"
,
pQInfo
);
}
else
if
(
pRuntimeEnv
->
outputBuf
->
info
.
rows
==
0
)
{
}
else
if
(
GET_NUM_OF_RESULTS
(
pRuntimeEnv
)
==
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, %d rows returned, numOfTotal:%"
PRId64
" rows"
,
pQInfo
,
pRuntimeEnv
->
outputBuf
->
info
.
rows
,
pRuntimeEnv
->
resultInfo
.
total
+
pRuntimeEnv
->
outputBuf
->
info
.
rows
);
pQInfo
,
GET_NUM_OF_RESULTS
(
pRuntimeEnv
),
pRuntimeEnv
->
resultInfo
.
total
+
GET_NUM_OF_RESULTS
(
pRuntimeEnv
));
}
return
doBuildResCheck
(
pQInfo
);
...
...
@@ -289,7 +288,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
if
(
pQInfo
->
dataReady
==
QUERY_RESULT_READY
)
{
*
buildRes
=
true
;
qDebug
(
"QInfo:%p retrieve result info, rowsize:%d, rows:%d, code:%s"
,
pQInfo
,
pQuery
->
resultRowSize
,
pRuntimeEnv
->
outputBuf
->
info
.
rows
,
tstrerror
(
pQInfo
->
code
));
GET_NUM_OF_RESULTS
(
pRuntimeEnv
)
,
tstrerror
(
pQInfo
->
code
));
}
else
{
*
buildRes
=
false
;
qDebug
(
"QInfo:%p retrieve req set query return result after paused"
,
pQInfo
);
...
...
@@ -313,7 +312,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
int64_t
s
=
pRuntimeEnv
->
outputBuf
->
info
.
rows
;
int64_t
s
=
GET_NUM_OF_RESULTS
(
pRuntimeEnv
)
;
size_t
size
=
getResultSize
(
pQInfo
,
&
s
);
...
...
@@ -339,7 +338,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
}
(
*
pRsp
)
->
precision
=
htons
(
pQuery
->
precision
);
if
(
pQInfo
->
runtimeEnv
.
outputBuf
->
info
.
rows
>
0
&&
pQInfo
->
code
==
TSDB_CODE_SUCCESS
)
{
if
(
GET_NUM_OF_RESULTS
(
&
(
pQInfo
->
runtimeEnv
))
>
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录