Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
18112c74
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
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
...
@@ -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_TABLEGROUP(q, _index) ((SArray*) taosArrayGetP((q)->tableqinfoGroupInfo.pGroupList, (_index)))
#define GET_NUM_OF_RESULTS(_r) (((_r)->outputBuf) == NULL? 0:((_r)->outputBuf)->info.rows)
enum
{
enum
{
// when query starts to execute, this status will set
// when query starts to execute, this status will set
QUERY_NOT_COMPLETED
=
0x1u
,
QUERY_NOT_COMPLETED
=
0x1u
,
...
@@ -281,8 +283,7 @@ enum {
...
@@ -281,8 +283,7 @@ enum {
typedef
struct
SOperatorInfo
{
typedef
struct
SOperatorInfo
{
uint8_t
operatorType
;
uint8_t
operatorType
;
bool
blockingOptr
;
// block operator or not
bool
blockingOptr
;
// block operator or not
uint8_t
completed
;
// denote if current operator is completed
uint8_t
status
;
// denote if current operator is completed
uint32_t
seed
;
// operator seed
int32_t
numOfOutput
;
// number of columns of the current operator results
int32_t
numOfOutput
;
// number of columns of the current operator results
char
*
name
;
// name, used to show the query execution plan
char
*
name
;
// name, used to show the query execution plan
void
*
info
;
// extension attribution
void
*
info
;
// extension attribution
...
@@ -306,7 +307,6 @@ typedef struct SQInfo {
...
@@ -306,7 +307,6 @@ typedef struct SQInfo {
SQueryRuntimeEnv
runtimeEnv
;
SQueryRuntimeEnv
runtimeEnv
;
SQuery
query
;
SQuery
query
;
SHashObj
*
arrTableIdInfo
;
SHashObj
*
arrTableIdInfo
;
/*
/*
...
@@ -363,13 +363,14 @@ typedef struct STableScanInfo {
...
@@ -363,13 +363,14 @@ typedef struct STableScanInfo {
SExprInfo
*
pExpr
;
SExprInfo
*
pExpr
;
int32_t
numOfOutput
;
int32_t
numOfOutput
;
int64_t
elapsedTime
;
int64_t
elapsedTime
;
}
STableScanInfo
;
}
STableScanInfo
;
typedef
struct
STagScanInfo
{
typedef
struct
STagScanInfo
{
SColumnInfo
*
pCols
;
SColumnInfo
*
pCols
;
SSDataBlock
*
pRes
;
SSDataBlock
*
pRes
;
int32_t
totalTables
;
int32_t
currentIndex
;
}
STagScanInfo
;
}
STagScanInfo
;
typedef
struct
SOptrBasicInfo
{
typedef
struct
SOptrBasicInfo
{
...
@@ -379,12 +380,17 @@ typedef struct SOptrBasicInfo {
...
@@ -379,12 +380,17 @@ typedef struct SOptrBasicInfo {
SSDataBlock
*
pRes
;
SSDataBlock
*
pRes
;
}
SOptrBasicInfo
;
}
SOptrBasicInfo
;
typedef
struct
SOptrBasicInfo
SAggOperatorInfo
;
typedef
struct
SOptrBasicInfo
STableIntervalOperatorInfo
;
typedef
struct
SOptrBasicInfo
SHashIntervalOperatorInfo
;
typedef
struct
SAggOperatorInfo
{
SOptrBasicInfo
binfo
;
uint32_t
seed
;
}
SAggOperatorInfo
;
typedef
struct
SArithOperatorInfo
{
typedef
struct
SArithOperatorInfo
{
SOptrBasicInfo
binfo
;
SOptrBasicInfo
binfo
;
int32_t
bufCapacity
;
int32_t
bufCapacity
;
uint32_t
seed
;
}
SArithOperatorInfo
;
}
SArithOperatorInfo
;
typedef
struct
SLimitOperatorInfo
{
typedef
struct
SLimitOperatorInfo
{
...
@@ -401,10 +407,10 @@ typedef struct SFillOperatorInfo {
...
@@ -401,10 +407,10 @@ typedef struct SFillOperatorInfo {
int64_t
totalInputRows
;
int64_t
totalInputRows
;
}
SFillOperatorInfo
;
}
SFillOperatorInfo
;
typedef
struct
S
Hash
GroupbyOperatorInfo
{
typedef
struct
SGroupbyOperatorInfo
{
SOptrBasicInfo
binfo
;
SOptrBasicInfo
binfo
;
int32_t
colIndex
;
int32_t
colIndex
;
}
S
Hash
GroupbyOperatorInfo
;
}
SGroupbyOperatorInfo
;
void
freeParam
(
SQueryParam
*
param
);
void
freeParam
(
SQueryParam
*
param
);
int32_t
convertQueryMsg
(
SQueryTableMsg
*
pQueryMsg
,
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) {
...
@@ -246,13 +246,12 @@ bool qTableQuery(qinfo_t qinfo) {
if
(
isQueryKilled
(
pQInfo
))
{
if
(
isQueryKilled
(
pQInfo
))
{
qDebug
(
"QInfo:%p query is killed"
,
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
,
qDebug
(
"QInfo:%p over, %"
PRIzu
" tables queried, %"
PRId64
" rows are returned"
,
pQInfo
,
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
,
pRuntimeEnv
->
resultInfo
.
total
);
pRuntimeEnv
->
resultInfo
.
total
);
}
else
{
}
else
{
qDebug
(
"QInfo:%p query paused, %d rows returned, numOfTotal:%"
PRId64
" rows"
,
qDebug
(
"QInfo:%p query paused, %d rows returned, numOfTotal:%"
PRId64
" rows"
,
pQInfo
,
pRuntimeEnv
->
outputBuf
->
info
.
rows
,
pQInfo
,
GET_NUM_OF_RESULTS
(
pRuntimeEnv
),
pRuntimeEnv
->
resultInfo
.
total
+
GET_NUM_OF_RESULTS
(
pRuntimeEnv
));
pRuntimeEnv
->
resultInfo
.
total
+
pRuntimeEnv
->
outputBuf
->
info
.
rows
);
}
}
return
doBuildResCheck
(
pQInfo
);
return
doBuildResCheck
(
pQInfo
);
...
@@ -289,7 +288,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
...
@@ -289,7 +288,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex
if
(
pQInfo
->
dataReady
==
QUERY_RESULT_READY
)
{
if
(
pQInfo
->
dataReady
==
QUERY_RESULT_READY
)
{
*
buildRes
=
true
;
*
buildRes
=
true
;
qDebug
(
"QInfo:%p retrieve result info, rowsize:%d, rows:%d, code:%s"
,
pQInfo
,
pQuery
->
resultRowSize
,
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
{
}
else
{
*
buildRes
=
false
;
*
buildRes
=
false
;
qDebug
(
"QInfo:%p retrieve req set query return result after paused"
,
pQInfo
);
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
...
@@ -313,7 +312,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
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
);
size_t
size
=
getResultSize
(
pQInfo
,
&
s
);
...
@@ -339,7 +338,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
...
@@ -339,7 +338,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
}
}
(
*
pRsp
)
->
precision
=
htons
(
pQuery
->
precision
);
(
*
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
);
doDumpQueryResult
(
pQInfo
,
(
*
pRsp
)
->
data
);
}
else
{
}
else
{
setQueryStatus
(
pQuery
,
QUERY_OVER
);
setQueryStatus
(
pQuery
,
QUERY_OVER
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录