Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0330ab12
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看板
提交
0330ab12
编写于
1月 19, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] Refactor.
上级
1145d1a0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
21 deletion
+44
-21
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+44
-21
未找到文件。
source/libs/executor/src/executorimpl.c
浏览文件 @
0330ab12
...
...
@@ -4558,6 +4558,7 @@ void appendDownstream(SOperatorInfo* p, SOperatorInfo* pUpstream) {
static
void
doDestroyTableQueryInfo
(
STableGroupInfo
*
pTableqinfoGroupInfo
);
void
createResultBlock
(
const
SArray
*
pExprInfo
,
SExchangeInfo
*
pInfo
,
const
SOperatorInfo
*
pOperator
,
size_t
size
);
static
int32_t
setupQueryHandle
(
void
*
tsdb
,
STaskRuntimeEnv
*
pRuntimeEnv
,
int64_t
qId
,
bool
isSTableQuery
)
{
STaskAttr
*
pQueryAttr
=
pRuntimeEnv
->
pQueryAttr
;
#if 0
...
...
@@ -4930,7 +4931,7 @@ static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) {
tfree
(
pMsgBody
);
}
void
process
MsgFromServer
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
void
process
RspMsg
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SMsgSendInfo
*
pSendInfo
=
(
SMsgSendInfo
*
)
pMsg
->
ahandle
;
assert
(
pMsg
->
ahandle
!=
NULL
);
...
...
@@ -4958,13 +4959,14 @@ static SSDataBlock* doLoadRemoteData(void* param, bool* newgroup) {
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
*
newgroup
=
false
;
if
(
pExchangeInfo
->
pRsp
!=
NULL
&&
pExchangeInfo
->
pRsp
->
completed
==
1
)
{
return
NULL
;
}
SResFetchReq
*
pMsg
=
calloc
(
1
,
sizeof
(
SResFetchReq
));
if
(
NULL
==
pMsg
)
{
// todo handle malloc error
pTaskInfo
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_error
;
}
SDownstreamSource
*
pSource
=
taosArrayGet
(
pExchangeInfo
->
pSources
,
0
);
...
...
@@ -4983,6 +4985,8 @@ static SSDataBlock* doLoadRemoteData(void* param, bool* newgroup) {
SMsgSendInfo
*
pMsgSendInfo
=
calloc
(
1
,
sizeof
(
SMsgSendInfo
));
if
(
NULL
==
pMsgSendInfo
)
{
qError
(
"QID:%"
PRIx64
" calloc %d failed"
,
GET_TASKID
(
pTaskInfo
),
(
int32_t
)
sizeof
(
SMsgSendInfo
));
pTaskInfo
->
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_error
;
}
pMsgSendInfo
->
param
=
pExchangeInfo
;
...
...
@@ -4993,7 +4997,6 @@ static SSDataBlock* doLoadRemoteData(void* param, bool* newgroup) {
int64_t
transporterId
=
0
;
int32_t
code
=
asyncSendMsgToServer
(
pExchangeInfo
->
pTransporter
,
&
epSet
,
&
transporterId
,
pMsgSendInfo
);
tsem_wait
(
&
pExchangeInfo
->
ready
);
if
(
pExchangeInfo
->
pRsp
->
numOfRows
==
0
)
{
...
...
@@ -5007,7 +5010,7 @@ static SSDataBlock* doLoadRemoteData(void* param, bool* newgroup) {
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pRes
->
pDataBlock
,
i
);
char
*
tmp
=
realloc
(
pColInfoData
->
pData
,
pColInfoData
->
info
.
bytes
*
pExchangeInfo
->
pRsp
->
numOfRows
);
if
(
tmp
==
NULL
)
{
// todo
goto
_error
;
}
size_t
len
=
pExchangeInfo
->
pRsp
->
numOfRows
*
pColInfoData
->
info
.
bytes
;
...
...
@@ -5021,8 +5024,17 @@ static SSDataBlock* doLoadRemoteData(void* param, bool* newgroup) {
pRes
->
info
.
rows
=
pExchangeInfo
->
pRsp
->
numOfRows
;
return
pExchangeInfo
->
pResult
;
_error:
tfree
(
pMsg
);
tfree
(
pMsgSendInfo
);
terrno
=
pTaskInfo
->
code
;
return
NULL
;
}
static
SSDataBlock
*
createResultDataBlock
(
const
SArray
*
pExprInfo
);
SOperatorInfo
*
createExchangeOperatorInfo
(
const
SArray
*
pSources
,
const
SArray
*
pExprInfo
,
SExecTaskInfo
*
pTaskInfo
)
{
SExchangeInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SExchangeInfo
));
SOperatorInfo
*
pOperator
=
calloc
(
1
,
sizeof
(
SOperatorInfo
));
...
...
@@ -5038,21 +5050,7 @@ SOperatorInfo* createExchangeOperatorInfo(const SArray* pSources, const SArray*
assert
(
taosArrayGetSize
(
pInfo
->
pSources
)
>
0
);
size_t
size
=
taosArrayGetSize
(
pExprInfo
);
pInfo
->
pResult
=
calloc
(
1
,
sizeof
(
SSDataBlock
));
pInfo
->
pResult
->
pDataBlock
=
taosArrayInit
(
pOperator
->
numOfOutput
,
sizeof
(
SColumnInfoData
));
SArray
*
pResult
=
pInfo
->
pResult
->
pDataBlock
;
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SColumnInfoData
colInfoData
=
{
0
};
SExprInfo
*
p
=
taosArrayGetP
(
pExprInfo
,
i
);
SSchema
*
pSchema
=
&
p
->
base
.
resSchema
;
colInfoData
.
info
.
type
=
pSchema
->
type
;
colInfoData
.
info
.
colId
=
pSchema
->
colId
;
colInfoData
.
info
.
bytes
=
pSchema
->
bytes
;
taosArrayPush
(
pResult
,
&
colInfoData
);
}
pInfo
->
pResult
=
createResultDataBlock
(
pExprInfo
);
pOperator
->
name
=
"ExchangeOperator"
;
pOperator
->
operatorType
=
OP_Exchange
;
...
...
@@ -5064,13 +5062,13 @@ SOperatorInfo* createExchangeOperatorInfo(const SArray* pSources, const SArray*
pOperator
->
exec
=
doLoadRemoteData
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
{
{
// todo refactor
SRpcInit
rpcInit
;
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
rpcInit
.
localPort
=
0
;
rpcInit
.
label
=
"TSC"
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
cfp
=
process
MsgFromServer
;
rpcInit
.
cfp
=
process
RspMsg
;
rpcInit
.
sessions
=
tsMaxConnections
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
user
=
(
char
*
)
"root"
;
...
...
@@ -5088,6 +5086,31 @@ SOperatorInfo* createExchangeOperatorInfo(const SArray* pSources, const SArray*
return
pOperator
;
}
SSDataBlock
*
createResultDataBlock
(
const
SArray
*
pExprInfo
)
{
SSDataBlock
*
pResBlock
=
calloc
(
1
,
sizeof
(
SSDataBlock
));
if
(
pResBlock
==
NULL
)
{
return
NULL
;
}
size_t
numOfCols
=
taosArrayGetSize
(
pExprInfo
);
pResBlock
->
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
SArray
*
pResult
=
pResBlock
->
pDataBlock
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
colInfoData
=
{
0
};
SExprInfo
*
p
=
taosArrayGetP
(
pExprInfo
,
i
);
SSchema
*
pSchema
=
&
p
->
base
.
resSchema
;
colInfoData
.
info
.
type
=
pSchema
->
type
;
colInfoData
.
info
.
colId
=
pSchema
->
colId
;
colInfoData
.
info
.
bytes
=
pSchema
->
bytes
;
taosArrayPush
(
pResult
,
&
colInfoData
);
}
return
pResBlock
;
}
SOperatorInfo
*
createTableScanOperatorInfo
(
void
*
pTsdbReadHandle
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
repeatTime
,
SExecTaskInfo
*
pTaskInfo
)
{
assert
(
repeatTime
>
0
&&
numOfOutput
>
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录