add mock code

This commit is contained in:
dapan1121 2022-06-28 17:13:51 +08:00
parent 2dc928be5f
commit bd7a2adc5f
5 changed files with 38 additions and 2 deletions

View File

@ -36,6 +36,10 @@ typedef struct SReadHandle {
void* vnode; void* vnode;
void* mnd; void* mnd;
SMsgCb* pMsgCb; SMsgCb* pMsgCb;
/* XXXXXXXXXXXXXXXXXXXX */
int32_t deleteQuery;
/* XXXXXXXXXXXXXXXXXXXX */
// int8_t initTsdbReader; // int8_t initTsdbReader;
} SReadHandle; } SReadHandle;

View File

@ -151,6 +151,10 @@ typedef struct SExecTaskInfo {
jmp_buf env; // jump to this position when error happens. jmp_buf env; // jump to this position when error happens.
EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model]
struct SOperatorInfo* pRoot; struct SOperatorInfo* pRoot;
/* XXXXXXXXXXXXXXXXXXXX */
SReadHandle* pHandle;
/* XXXXXXXXXXXXXXXXXXXX */
} SExecTaskInfo; } SExecTaskInfo;
enum { enum {

View File

@ -139,7 +139,26 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
qDebug("%s execTask is launched", GET_TASKID(pTaskInfo)); qDebug("%s execTask is launched", GET_TASKID(pTaskInfo));
int64_t st = taosGetTimestampUs(); int64_t st = taosGetTimestampUs();
/* XXXXXXXXXXXXXXXXXXXX */
if (pTaskInfo->pHandle->deleteQuery) {
static int32_t first = 1;
if (first) {
*pRes = createDataBlock();
int64_t rows = 33;
SColumnInfoData infoData = createColumnInfoData(TSDB_DATA_TYPE_BIGINT, 8, 1);
blockDataAppendColInfo(*pRes, &infoData);
SColumnInfoData* pCol1 = taosArrayGet((*pRes)->pDataBlock, 0);
colDataAppend(pCol1, 0, (char*)&rows, false);
first = 0;
} else {
*pRes = NULL;
}
} else {
/* XXXXXXXXXXXXXXXXXXXX */
*pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot); *pRes = pTaskInfo->pRoot->fpSet.getNextFn(pTaskInfo->pRoot);
/* XXXXXXXXXXXXXXXXXXXX */
}
/* XXXXXXXXXXXXXXXXXXXX */
uint64_t el = (taosGetTimestampUs() - st); uint64_t el = (taosGetTimestampUs() - st);
pTaskInfo->cost.elapsedTime += el; pTaskInfo->cost.elapsedTime += el;

View File

@ -4638,6 +4638,10 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
(*pTaskInfo)->pRoot = (*pTaskInfo)->pRoot =
createOperatorTree(pPlan->pNode, *pTaskInfo, pHandle, queryId, taskId, &(*pTaskInfo)->tableqinfoList, pPlan->user); createOperatorTree(pPlan->pNode, *pTaskInfo, pHandle, queryId, taskId, &(*pTaskInfo)->tableqinfoList, pPlan->user);
/* XXXXXXXXXXXXXXXXXXXX */
(*pTaskInfo)->pHandle = pHandle;
/* XXXXXXXXXXXXXXXXXXXX */
if (NULL == (*pTaskInfo)->pRoot) { if (NULL == (*pTaskInfo)->pRoot) {
code = (*pTaskInfo)->code; code = (*pTaskInfo)->code;
goto _complete; goto _complete;

View File

@ -936,6 +936,11 @@ int32_t qwProcessDelete(QW_FPARAMS_DEF, SQWMsg *qwMsg, SDeleteRes *pRes) {
ctx.plan = plan; ctx.plan = plan;
/* XXXXXXXXXXXXXXXXXXXX */
SReadHandle *phandle = (SReadHandle*)qwMsg->node;
phandle->deleteQuery = 1;
/* XXXXXXXXXXXXXXXXXXXX */
code = qCreateExecTask(qwMsg->node, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, NULL, OPTR_EXEC_MODEL_BATCH); code = qCreateExecTask(qwMsg->node, mgmt->nodeId, tId, plan, &pTaskInfo, &sinkHandle, NULL, OPTR_EXEC_MODEL_BATCH);
if (code) { if (code) {
QW_TASK_ELOG("qCreateExecTask failed, code:%x - %s", code, tstrerror(code)); QW_TASK_ELOG("qCreateExecTask failed, code:%x - %s", code, tstrerror(code));