Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e1d9fa73
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看板
提交
e1d9fa73
编写于
1月 21, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] Support create topic.
上级
93805a6e
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
79 addition
and
27 deletion
+79
-27
include/libs/executor/executor.h
include/libs/executor/executor.h
+20
-20
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+42
-4
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+17
-3
未找到文件。
include/libs/executor/executor.h
浏览文件 @
e1d9fa73
...
...
@@ -29,23 +29,23 @@ struct SSubplan;
/**
* Create the exec task for streaming mode
* @param pMsg
* @param
pStreamBlock
ReadHandle
* @param
stream
ReadHandle
* @return
*/
qTaskInfo_t
qCreateStreamExecTaskInfo
(
SSubQueryMsg
*
pMsg
,
void
*
pStreamBlock
ReadHandle
);
qTaskInfo_t
qCreateStreamExecTaskInfo
(
SSubQueryMsg
*
pMsg
,
void
*
stream
ReadHandle
);
void
qStreamExecTaskSetInput
(
qTaskInfo_t
qHandle
,
void
*
input
);
int32_t
qSetStreamInput
(
qTaskInfo_t
tinfo
,
void
*
input
);
/**
* Create the exec task object according to task json
* @param
tsdb
* @param
readHandle
* @param vgId
* @param pTaskInfoMsg
* @param pTaskInfo
* @param qId
* @return
*/
int32_t
qCreateExecTask
(
void
*
tsdb
,
int32_t
vgId
,
struct
SSubplan
*
pPlan
,
qTaskInfo_t
*
pTaskInfo
,
DataSinkHandle
*
handle
);
int32_t
qCreateExecTask
(
void
*
readHandle
,
int32_t
vgId
,
struct
SSubplan
*
pPlan
,
qTaskInfo_t
*
pTaskInfo
,
DataSinkHandle
*
handle
);
/**
* The main task execution function, including query on both table and multiple tables,
...
...
@@ -62,63 +62,63 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t *useconds);
* this function will be blocked to wait for the query execution completed or paused,
* in which case enough results have been produced already.
*
* @param
q
info
* @param
t
info
* @return
*/
int32_t
qRetrieveQueryResultInfo
(
qTaskInfo_t
q
info
,
bool
*
buildRes
,
void
*
pRspContext
);
int32_t
qRetrieveQueryResultInfo
(
qTaskInfo_t
t
info
,
bool
*
buildRes
,
void
*
pRspContext
);
/**
*
* Retrieve the actual results to fill the response message payload.
* Note that this function must be executed after qRetrieveQueryResultInfo is invoked.
*
* @param
qinfo q
info object
* @param
tinfo t
info object
* @param pRsp response message
* @param contLen payload length
* @return
*/
//int32_t qDumpRetrieveResult(qTaskInfo_t
q
info, SRetrieveTableRsp** pRsp, int32_t* contLen, bool* continueExec);
//int32_t qDumpRetrieveResult(qTaskInfo_t
t
info, SRetrieveTableRsp** pRsp, int32_t* contLen, bool* continueExec);
/**
* return the transporter context (RPC)
* @param
q
info
* @param
t
info
* @return
*/
void
*
qGetResultRetrieveMsg
(
qTaskInfo_t
q
info
);
void
*
qGetResultRetrieveMsg
(
qTaskInfo_t
t
info
);
/**
* kill the ongoing query and free the query handle and corresponding resources automatically
* @param
q
info qhandle
* @param
t
info qhandle
* @return
*/
int32_t
qKillTask
(
qTaskInfo_t
q
info
);
int32_t
qKillTask
(
qTaskInfo_t
t
info
);
/**
* kill the ongoing query asynchronously
* @param
q
info qhandle
* @param
t
info qhandle
* @return
*/
int32_t
qAsyncKillTask
(
qTaskInfo_t
q
info
);
int32_t
qAsyncKillTask
(
qTaskInfo_t
t
info
);
/**
* return whether query is completed or not
* @param
q
info
* @param
t
info
* @return
*/
int32_t
qIsTaskCompleted
(
qTaskInfo_t
q
info
);
int32_t
qIsTaskCompleted
(
qTaskInfo_t
t
info
);
/**
* destroy query info structure
* @param qHandle
*/
void
qDestroyTask
(
qTaskInfo_t
qHandle
);
void
qDestroyTask
(
qTaskInfo_t
tinfo
);
/**
* Get the queried table uid
* @param qHandle
* @return
*/
int64_t
qGetQueriedTableUid
(
qTaskInfo_t
qHandle
);
int64_t
qGetQueriedTableUid
(
qTaskInfo_t
tinfo
);
/**
* Extract the qualified table id list, and than pass them to the TSDB driver to load the required table data blocks.
...
...
@@ -145,7 +145,7 @@ int32_t qGetQualifiedTableIdList(void* pTableList, const char* tagCond, int32_t
* @param type operation type: ADD|DROP
* @return
*/
int32_t
qUpdateQueriedTableIdList
(
qTaskInfo_t
q
info
,
int64_t
uid
,
int32_t
type
);
int32_t
qUpdateQueriedTableIdList
(
qTaskInfo_t
t
info
,
int64_t
uid
,
int32_t
type
);
//================================================================================================
// query handle management
...
...
source/libs/executor/src/executor.c
浏览文件 @
e1d9fa73
...
...
@@ -14,12 +14,50 @@
*/
#include "executor.h"
#include "tq.h"
#include "executorimpl.h"
#include "planner.h"
void
qStreamExecTaskSetInput
(
qTaskInfo_t
qHandle
,
void
*
input
)
{}
static
int32_t
doSetStreamBlock
(
SOperatorInfo
*
pOperator
,
void
*
input
)
{
ASSERT
(
pOperator
!=
NULL
);
if
(
pOperator
->
operatorType
!=
OP_StreamScan
)
{
if
(
pOperator
->
numOfDownstream
>
0
)
{
qTaskInfo_t
qCreateStreamExecTaskInfo
(
SSubQueryMsg
*
pMsg
,
void
*
pStreamBlockReadHandle
)
{
if
(
pMsg
==
NULL
||
pStreamBlockReadHandle
==
NULL
)
{
if
(
pOperator
->
numOfDownstream
>
1
)
{
// not handle this in join query
return
TSDB_CODE_QRY_APP_ERROR
;
}
return
doSetStreamBlock
(
pOperator
->
pDownstream
[
0
],
input
);
}
}
else
{
SStreamBlockScanInfo
*
pInfo
=
pOperator
->
info
;
tqReadHandleSetMsg
(
pInfo
->
readerHandle
,
input
,
0
);
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
qSetStreamInput
(
qTaskInfo_t
tinfo
,
void
*
input
)
{
if
(
tinfo
==
NULL
)
{
return
TSDB_CODE_QRY_APP_ERROR
;
}
if
(
input
==
NULL
)
{
return
TSDB_CODE_SUCCESS
;
}
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
int32_t
code
=
doSetStreamBlock
(
pTaskInfo
->
pRoot
,
input
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to set the stream block data, reqId:0x%"
PRIx64
,
GET_TASKID
(
pTaskInfo
));
}
else
{
qDebug
(
"set the stream block successfully, reqId:0x%"
PRIx64
,
GET_TASKID
(
pTaskInfo
));
}
return
code
;
}
qTaskInfo_t
qCreateStreamExecTaskInfo
(
SSubQueryMsg
*
pMsg
,
void
*
streamReadHandle
)
{
if
(
pMsg
==
NULL
||
streamReadHandle
==
NULL
)
{
return
NULL
;
}
...
...
@@ -37,7 +75,7 @@ qTaskInfo_t qCreateStreamExecTaskInfo(SSubQueryMsg* pMsg, void* pStreamBlockRead
}
qTaskInfo_t
pTaskInfo
=
NULL
;
code
=
qCreateExecTask
(
pStreamBlock
ReadHandle
,
0
,
plan
,
&
pTaskInfo
,
NULL
);
code
=
qCreateExecTask
(
stream
ReadHandle
,
0
,
plan
,
&
pTaskInfo
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// TODO: destroy SSubplan & pTaskInfo
terrno
=
code
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
e1d9fa73
...
...
@@ -5407,7 +5407,7 @@ SOperatorInfo* createTableBlockInfoScanOperator(void* pTsdbReadHandle, STaskRunt
return
pOperator
;
}
SOperatorInfo
*
createStream
BlockScanOperatorInfo
(
void
*
pStreamBlockHandle
,
int32_t
numOfOutput
,
SExecTaskInfo
*
pTaskInfo
)
{
SOperatorInfo
*
createStream
ScanOperatorInfo
(
void
*
streamReadHandle
,
SArray
*
pExprInfo
,
SExecTaskInfo
*
pTaskInfo
)
{
SStreamBlockScanInfo
*
pInfo
=
calloc
(
1
,
sizeof
(
SStreamBlockScanInfo
));
SOperatorInfo
*
pOperator
=
calloc
(
1
,
sizeof
(
SOperatorInfo
));
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
...
...
@@ -5417,10 +5417,21 @@ SOperatorInfo* createStreamBlockScanOperatorInfo(void *pStreamBlockHandle, int32
return
NULL
;
}
pInfo
->
readerHandle
=
pStreamBlockHandle
;
int32_t
numOfOutput
=
(
int32_t
)
taosArrayGetSize
(
pExprInfo
);
SArray
*
pColList
=
taosArrayInit
(
numOfOutput
,
sizeof
(
int32_t
));
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SExprInfo
*
pExpr
=
taosArrayGetP
(
pExprInfo
,
i
);
taosArrayPush
(
pColList
,
&
pExpr
->
pExpr
->
pSchema
[
0
].
colId
);
}
// TODO set the extract column id to streamHandle
// pColList
pInfo
->
readerHandle
=
streamReadHandle
;
pOperator
->
name
=
"StreamBlockScanOperator"
;
pOperator
->
operatorType
=
OP_Stream
Block
Scan
;
pOperator
->
operatorType
=
OP_StreamScan
;
pOperator
->
blockingOptr
=
false
;
pOperator
->
status
=
OP_IN_EXECUTING
;
pOperator
->
info
=
pInfo
;
...
...
@@ -7704,6 +7715,9 @@ SOperatorInfo* doCreateOperatorTreeNode(SPhyNode* pPhyNode, SExecTaskInfo* pTask
}
else
if
(
pPhyNode
->
info
.
type
==
OP_Exchange
)
{
SExchangePhyNode
*
pEx
=
(
SExchangePhyNode
*
)
pPhyNode
;
return
createExchangeOperatorInfo
(
pEx
->
pSrcEndPoints
,
pEx
->
node
.
pTargets
,
pTaskInfo
);
}
else
if
(
pPhyNode
->
info
.
type
==
OP_StreamScan
)
{
size_t
numOfCols
=
taosArrayGetSize
(
pPhyNode
->
pTargets
);
return
createStreamScanOperatorInfo
(
readerHandle
,
pPhyNode
->
pTargets
,
pTaskInfo
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录