• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #5063

17 May 2026 01:15AM UTC coverage: 73.388% (-0.02%) from 73.408%
#5063

push

travis-ci

web-flow
feat (TDgpt): Dynamic Model Synchronization Enhancements (#35344)

* refactor: do some internal refactor.

* fix: fix multiprocess sync issue.

* feat: add dynamic anomaly detection and forecasting services

* fix: log error message for undeploying model in exception handling

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix: handle undeploy when model exists only on disk

Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/286aafa0-c3ce-4c27-b803-2707571e9dc1

Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>

* fix: guard dynamic registry concurrent access

Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/5e4db858-6458-40f4-ac28-d1b1b7f97c18

Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>

* fix: tighten service list locking scope

Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/5e4db858-6458-40f4-ac28-d1b1b7f97c18

Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>

* fix: restore prophet support and update tests per review feedback

Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/92298ae1-7da6-4d07-b20e-101c7cd0b26b

Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>

* fix: improve test name and move copy inside lock scope

Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/92298ae1-7da6-4d07-b20e-101c7cd0b26b

Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>

* Potential fix for pull request finding

Co-au... (continued)

281660 of 383795 relevant lines covered (73.39%)

138762754.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.71
/source/libs/executor/src/querytask.c
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15

16
#include "filter.h"
17
#include "function.h"
18
#include "functionMgt.h"
19
#include "os.h"
20
#include "querynodes.h"
21
#include "tfill.h"
22
#include "tname.h"
23

24
#include "tdatablock.h"
25
#include "tmsg.h"
26
#include "streamMsg.h"
27

28
#include "executorInt.h"
29
#include "index.h"
30
#include "operator.h"
31
#include "query.h"
32
#include "querytask.h"
33
#include "storageapi.h"
34
#include "thash.h"
35
#include "ttypes.h"
36
#include "tref.h"
37

38
#define CLEAR_QUERY_STATUS(q, st) ((q)->status &= (~(st)))
39

40
int32_t doCreateTask(uint64_t queryId, uint64_t taskId, int32_t vgId, EOPTR_EXEC_MODEL model, SStorageAPI* pAPI,
425,729,281✔
41
                     SExecTaskInfo** pTaskInfo) {
42
  if (pTaskInfo == NULL) {
425,729,281✔
43
    return TSDB_CODE_SUCCESS;
×
44
  }
45

46
  SExecTaskInfo* p = taosMemoryCalloc(1, sizeof(SExecTaskInfo));
425,729,281✔
47
  if (p == NULL) {
425,716,894✔
48
    return terrno;
×
49
  }
50

51
  setTaskStatus(p, TASK_NOT_COMPLETED);
425,716,894✔
52
  p->cost.created = taosGetTimestampUs();
425,719,301✔
53

54
  p->execModel = model;
425,700,876✔
55
  p->stopInfo.pStopInfo = taosArrayInit(4, sizeof(SExchangeOpStopInfo));
425,700,220✔
56
  p->pResultBlockList = taosArrayInit(128, POINTER_BYTES);
425,632,418✔
57
  if (p->stopInfo.pStopInfo == NULL || p->pResultBlockList == NULL) {
425,592,246✔
58
    doDestroyTask(p);
×
59
    return terrno;
×
60
  }
61

62
  p->storageAPI = *pAPI;
425,640,486✔
63
  taosInitRWLatch(&p->lock);
425,662,108✔
64

65
  p->id.vgId = vgId;
425,602,171✔
66
  p->id.queryId = queryId;
425,610,520✔
67
  p->id.taskId = taskId;
425,646,786✔
68
  p->id.str = taosMemoryMalloc(64);
425,667,478✔
69
  if (p->id.str == NULL) {
425,474,646✔
70
    doDestroyTask(p);
×
71
    return terrno;
×
72
  }
73

74
  buildTaskId(taskId, queryId, p->id.str, 64);
425,592,626✔
75
  p->schemaInfos = taosArrayInit(1, sizeof(SSchemaInfo));
425,540,160✔
76
  if (p->id.str == NULL || p->schemaInfos == NULL) {
425,294,937✔
77
    doDestroyTask(p);
×
78
    return terrno;
×
79
  }
80

81
  *pTaskInfo = p;
425,430,186✔
82
  return TSDB_CODE_SUCCESS;
425,311,051✔
83
}
84

85
int32_t getTaskCode(void* pTaskInfo) { return ((SExecTaskInfo*)pTaskInfo)->code; }
8,498✔
86

87
bool isTaskKilled(void* pTaskInfo) { return (0 != ((SExecTaskInfo*)pTaskInfo)->code); }
2,147,483,647✔
88

89
void setTaskKilled(SExecTaskInfo* pTaskInfo, int32_t rspCode) {
64,229✔
90
  pTaskInfo->code = rspCode;
64,229✔
91
  (void)stopTableScanOperator(pTaskInfo->pRoot, pTaskInfo->id.str, &pTaskInfo->storageAPI);
64,229✔
92
}
64,229✔
93

94
void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status) {
1,448,854,487✔
95
  if (status == TASK_NOT_COMPLETED) {
1,448,854,487✔
96
    pTaskInfo->status = status;
425,932,222✔
97
  } else {
98
    // QUERY_NOT_COMPLETED is not compatible with any other status, so clear its position first
99
    CLEAR_QUERY_STATUS(pTaskInfo, TASK_NOT_COMPLETED);
1,022,922,265✔
100
    pTaskInfo->status |= status;
1,022,998,147✔
101
  }
102
}
1,448,933,804✔
103

104

105
int32_t initTaskSubJobCtx(SExecTaskInfo* pTaskInfo, SArray** subEndPoints, SReadHandle* readHandle) {
46,983,486✔
106
  int32_t code = 0, lino = 0;
46,983,486✔
107
  int32_t subJobNum = taosArrayGetSize(*subEndPoints);
46,983,486✔
108
  
109
  pTaskInfo->pSubJobCtx = taosMemoryCalloc(1, sizeof(*pTaskInfo->pSubJobCtx));
46,987,537✔
110
  TSDB_CHECK_NULL(pTaskInfo->pSubJobCtx, code, lino, _exit, terrno);
46,963,184✔
111
  
112
  STaskSubJobCtx* ctx = pTaskInfo->pSubJobCtx;
46,959,216✔
113

114
  ctx->queryId = pTaskInfo->id.queryId;
46,975,176✔
115
  ctx->taskId = pTaskInfo->id.taskId;
46,985,287✔
116
  ctx->idStr = pTaskInfo->id.str;
46,978,201✔
117
  ctx->pTaskInfo = pTaskInfo;
46,982,272✔
118
  ctx->subEndPoints = *subEndPoints;
46,974,549✔
119
  ctx->rpcHandle = (readHandle && readHandle->pMsgCb) ? readHandle->pMsgCb->clientRpc : NULL;
46,970,769✔
120
  ctx->isStream = pTaskInfo && IS_STREAM_MODE(pTaskInfo);
46,991,337✔
121

122
  *subEndPoints = NULL;
46,986,649✔
123
  
124
  ctx->subResNodes = taosArrayInit_s(POINTER_BYTES, subJobNum);
46,986,032✔
125
  if (NULL == ctx->subResNodes) {
46,972,698✔
126
    qError("%s taosArrayInit_s %d subResNodes failed, error:%s", GET_TASKID(pTaskInfo), subJobNum, tstrerror(terrno));
×
127
    TSDB_CHECK_NULL(ctx->subResNodes, code, lino, _exit, terrno);
×
128
  }
129
  
130
  TAOS_CHECK_EXIT(tsem_init(&ctx->ready, 0, 0));
46,971,045✔
131

132
  int64_t refId = taosAddRef(fetchObjRefPool, ctx);
46,973,202✔
133
  if (refId < 0) {
46,989,664✔
134
    qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(terrno));
×
135
    TAOS_CHECK_EXIT(terrno);
×
136
  }
137
  
138
  ctx->subJobRefId = refId;
46,989,664✔
139

140
  qDebug("%s subJobCtx %" PRIu64 " with %d endPoints inited", pTaskInfo->id.str, (uint64_t)refId, (int32_t)taosArrayGetSize(ctx->subEndPoints));
46,973,676✔
141

142
_exit:
45,761,253✔
143

144
  if (code) {
46,966,352✔
145
    destroySubJobCtx(pTaskInfo->pSubJobCtx);
×
146
    pTaskInfo->pSubJobCtx = NULL;
×
147
    
148
    qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
×
149
  }
150

151
  return code;
46,962,113✔
152
}
153

154

155

156
int32_t createExecTaskInfo(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId,
425,580,703✔
157
                           int32_t vgId, char* sql, EOPTR_EXEC_MODEL model, SArray** subEndPoints, bool enableExplain) {
158
  int32_t code = doCreateTask(pPlan->id.queryId, taskId, vgId, model, &pHandle->api, pTaskInfo);
425,580,703✔
159
  if (*pTaskInfo == NULL || code != 0) {
425,208,036✔
160
    nodesDestroyNode((SNode*)pPlan);
60✔
161
    return code;
×
162
  }
163

164
  (*pTaskInfo)->pSubplan = pPlan;
425,275,967✔
165

166
  if (NULL != sql) {
425,222,228✔
167
    (*pTaskInfo)->sql = taosStrdup(sql);
396,710,293✔
168
    if (NULL == (*pTaskInfo)->sql) {
396,709,613✔
169
      code = terrno;
×
170
      doDestroyTask(*pTaskInfo);
×
171
      (*pTaskInfo) = NULL;
×
172
      return code;
×
173
    }
174
  }
175

176
  (*pTaskInfo)->pWorkerCb = pHandle->pWorkerCb;
425,238,885✔
177
  (*pTaskInfo)->pStreamRuntimeInfo = pHandle->streamRtInfo;
425,343,400✔
178
  (*pTaskInfo)->enableExplain = enableExplain;
425,238,893✔
179

180
  if (subEndPoints && taosArrayGetSize(*subEndPoints) > 0) {
425,203,116✔
181
    code = initTaskSubJobCtx(*pTaskInfo, subEndPoints, pHandle);
46,994,224✔
182
    if (code != TSDB_CODE_SUCCESS) {
46,965,755✔
183
      doDestroyTask(*pTaskInfo);
×
184
      (*pTaskInfo) = NULL;
×
185
      return code;
×
186
    }
187
  }
188
  
189
  setTaskScalarExtraInfo(*pTaskInfo);
425,284,275✔
190
  
191
  code = createOperator(pPlan->pNode, *pTaskInfo, pHandle, pPlan->pTagCond, pPlan->pTagIndexCond, pPlan->user,
424,747,313✔
192
                        pPlan->dbFName, &((*pTaskInfo)->pRoot), model);
424,446,206✔
193

194
  if (NULL == (*pTaskInfo)->pRoot || code != 0) {
424,296,705✔
195
    doDestroyTask(*pTaskInfo);
1,670,376✔
196
    (*pTaskInfo) = NULL;
520,273✔
197
  }
198
  return code;
423,353,930✔
199
}
200

201
void cleanupQueriedTableScanInfo(void* p) {
304,891,148✔
202
  SSchemaInfo* pSchemaInfo = p;
304,891,148✔
203

204
  taosMemoryFreeClear(pSchemaInfo->dbname);
304,891,148✔
205
  taosMemoryFreeClear(pSchemaInfo->tablename);
304,808,040✔
206
  tDeleteSchemaWrapper(pSchemaInfo->sw);
304,729,451✔
207
  tDeleteSchemaWrapper(pSchemaInfo->qsw);
304,836,787✔
208
}
304,776,616✔
209

210
int32_t initQueriedTableSchemaInfo(SReadHandle* pHandle, SScanPhysiNode* pScanNode, const char* dbName,
305,055,709✔
211
                                   SExecTaskInfo* pTaskInfo) {
212
  SMetaReader mr = {0};
305,055,709✔
213
  if (pHandle == NULL) {
305,089,702✔
214
    return TSDB_CODE_INVALID_PARA;
×
215
  }
216

217
  SStorageAPI* pAPI = &pTaskInfo->storageAPI;
305,089,702✔
218

219
  pAPI->metaReaderFn.initReader(&mr, pHandle->vnode, META_READER_LOCK, &pAPI->metaFn);
305,083,836✔
220
  int32_t code = pAPI->metaReaderFn.getEntryGetUidCache(&mr, pScanNode->uid);
305,125,169✔
221
  if (code != TSDB_CODE_SUCCESS) {
304,172,020✔
222
    qError("failed to get the table meta, uid:0x%" PRIx64 ", suid:0x%" PRIx64 ", %s", pScanNode->uid, pScanNode->suid,
×
223
           GET_TASKID(pTaskInfo));
224

225
    pAPI->metaReaderFn.clearReader(&mr);
×
226
    return code;
×
227
  }
228

229
  SSchemaInfo schemaInfo = {0};
304,172,020✔
230

231
  schemaInfo.tablename = taosStrdup(mr.me.name);
303,874,320✔
232
  schemaInfo.dbname = taosStrdup(dbName);
304,192,997✔
233
  if (schemaInfo.tablename == NULL || schemaInfo.dbname == NULL) {
304,467,697✔
234
    pAPI->metaReaderFn.clearReader(&mr);
912,561✔
235
    cleanupQueriedTableScanInfo(&schemaInfo);
×
236
    return terrno;
×
237
  }
238

239
  if (mr.me.type == TSDB_VIRTUAL_NORMAL_TABLE || mr.me.type == TSDB_VIRTUAL_CHILD_TABLE) {
303,555,136✔
240
    schemaInfo.rversion = mr.me.colRef.version;
328,720✔
241
  }
242

243
  if (mr.me.type == TSDB_SUPER_TABLE) {
303,555,136✔
244
    schemaInfo.sw = tCloneSSchemaWrapper(&mr.me.stbEntry.schemaRow);
134,685,555✔
245
    schemaInfo.tversion = mr.me.stbEntry.schemaTag.version;
134,685,555✔
246
  } else if (mr.me.type == TSDB_CHILD_TABLE || mr.me.type == TSDB_VIRTUAL_CHILD_TABLE) {
169,441,975✔
247
    tDecoderClear(&mr.coder);
120,169,160✔
248

249
    tb_uid_t suid = mr.me.ctbEntry.suid;
120,294,039✔
250
    code = pAPI->metaReaderFn.getEntryGetUidCache(&mr, suid);
120,294,039✔
251
    if (code != TSDB_CODE_SUCCESS) {
120,288,985✔
252
      pAPI->metaReaderFn.clearReader(&mr);
×
253
      cleanupQueriedTableScanInfo(&schemaInfo);
×
254
      return code;
×
255
    }
256

257
    schemaInfo.sw = tCloneSSchemaWrapper(&mr.me.stbEntry.schemaRow);
120,275,870✔
258
    schemaInfo.tversion = mr.me.stbEntry.schemaTag.version;
120,275,870✔
259
  } else {
260
    schemaInfo.sw = tCloneSSchemaWrapper(&mr.me.ntbEntry.schemaRow);
49,341,940✔
261
  }
262

263
  pAPI->metaReaderFn.clearReader(&mr);
304,303,365✔
264

265
  if (schemaInfo.sw == NULL) {
303,846,909✔
266
    cleanupQueriedTableScanInfo(&schemaInfo);
×
267
    return terrno;
×
268
  }
269

270
  schemaInfo.qsw = extractQueriedColumnSchema(pScanNode);
303,846,909✔
271
  if (schemaInfo.qsw == NULL) {
304,135,640✔
272
    cleanupQueriedTableScanInfo(&schemaInfo);
×
273
    return terrno;
×
274
  }
275

276
  void* p = taosArrayPush(pTaskInfo->schemaInfos, &schemaInfo);
304,135,640✔
277
  if (p == NULL) {
304,706,517✔
278
    cleanupQueriedTableScanInfo(&schemaInfo);
×
279
    return terrno;
×
280
  }
281

282
  return code;
304,706,517✔
283
}
284

285
SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode) {
304,066,983✔
286
  int32_t numOfCols = LIST_LENGTH(pScanNode->pScanCols);
304,066,983✔
287
  int32_t numOfTags = LIST_LENGTH(pScanNode->pScanPseudoCols);
304,572,367✔
288

289
  SSchemaWrapper* pqSw = taosMemoryCalloc(1, sizeof(SSchemaWrapper));
303,984,617✔
290
  if (pqSw == NULL) {
303,591,938✔
291
    return NULL;
×
292
  }
293

294
  pqSw->pSchema = taosMemoryCalloc(numOfCols + numOfTags, sizeof(SSchema));
303,591,938✔
295
  if (pqSw->pSchema == NULL) {
302,776,695✔
296
    taosMemoryFree(pqSw);
×
297
    return NULL;
×
298
  }
299

300
  for (int32_t i = 0; i < numOfCols; ++i) {
1,351,098,574✔
301
    STargetNode* pNode = (STargetNode*)nodesListGetNode(pScanNode->pScanCols, i);
1,046,240,343✔
302
    SColumnNode* pColNode = (SColumnNode*)pNode->pExpr;
1,045,495,021✔
303

304
    SSchema* pSchema = &pqSw->pSchema[pqSw->nCols++];
1,045,783,451✔
305
    pSchema->colId = pColNode->colId;
1,046,212,539✔
306
    pSchema->type = pColNode->node.resType.type;
1,046,789,017✔
307
    pSchema->bytes = pColNode->node.resType.bytes;
1,046,717,512✔
308
    tstrncpy(pSchema->name, pColNode->colName, tListLen(pSchema->name));
1,046,709,249✔
309
  }
310

311
  // this the tags and pseudo function columns, we only keep the tag columns
312
  for (int32_t i = 0; i < numOfTags; ++i) {
488,014,151✔
313
    STargetNode* pNode = (STargetNode*)nodesListGetNode(pScanNode->pScanPseudoCols, i);
183,024,585✔
314

315
    int32_t type = nodeType(pNode->pExpr);
182,972,452✔
316
    if (type == QUERY_NODE_COLUMN) {
183,007,856✔
317
      SColumnNode* pColNode = (SColumnNode*)pNode->pExpr;
136,288,441✔
318

319
      SSchema* pSchema = &pqSw->pSchema[pqSw->nCols++];
136,304,764✔
320
      pSchema->colId = pColNode->colId;
136,231,292✔
321
      pSchema->type = pColNode->node.resType.type;
136,110,919✔
322
      pSchema->bytes = pColNode->node.resType.bytes;
135,918,796✔
323
      tstrncpy(pSchema->name, pColNode->colName, tListLen(pSchema->name));
136,089,167✔
324
    }
325
  }
326

327
  return pqSw;
304,989,566✔
328
}
329

330
static void cleanupTmqInfo(STmqTaskInfo* pTmqInfo) {
425,294,564✔
331
  tDeleteSchemaWrapper(pTmqInfo->schema);
425,294,564✔
332
  tOffsetDestroy(&pTmqInfo->currentOffset);
425,443,424✔
333
}
424,905,577✔
334

335
static void freeBlock(void* pParam) {
768,727,415✔
336
  SSDataBlock* pBlock = *(SSDataBlock**)pParam;
768,727,415✔
337
  blockDataDestroy(pBlock);
768,774,608✔
338
}
768,850,297✔
339

340

341
void destroySubJobCtx(STaskSubJobCtx* pCtx) {
46,985,726✔
342
  if (pCtx->transporterId > 0) {
46,985,726✔
343
    int32_t ret = asyncFreeConnById(pCtx->rpcHandle, pCtx->transporterId);
3,035✔
344
    if (ret != 0) {
3,035✔
345
      qDebug("%s failed to free subQ rpc handle, code:%s", pCtx->idStr, tstrerror(ret));
×
346
    }
347
    pCtx->transporterId = -1;
3,035✔
348
  }
349

350
  if (pCtx->subEndPoints != NULL) {
46,993,617✔
351
    size_t size = taosArrayGetSize(pCtx->subEndPoints);
46,991,944✔
352
    if (size > 0) {
46,982,582✔
353
      int32_t code = tsem_destroy(&pCtx->ready);
46,991,529✔
354
      if (code != TSDB_CODE_SUCCESS) {
46,985,010✔
355
        qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
×
356
      }
357
      taosArrayDestroy(pCtx->subResNodes);
46,985,010✔
358
    }
359
    if (pCtx->isStream) {
46,971,923✔
360
      taosArrayDestroyP(pCtx->subEndPoints, (FDelete)nodesDestroyNode);
263,750✔
361
    } else {
362
      taosArrayDestroyP(pCtx->subEndPoints, NULL);
46,717,727✔
363
    }
364
    pCtx->subEndPoints = NULL;
46,981,487✔
365
  }
366
  
367
  taosMemoryFreeClear(pCtx);  
46,985,568✔
368
}
46,971,785✔
369

370
void doDestroyTask(SExecTaskInfo* pTaskInfo) {
425,754,623✔
371
  qDebug("%s execTask is freed", GET_TASKID(pTaskInfo));
425,754,623✔
372
  destroyOperator(pTaskInfo->pRoot);
425,754,178✔
373
  pTaskInfo->pRoot = NULL;
425,364,868✔
374

375
  if (pTaskInfo->pSubJobCtx) {
425,466,560✔
376
    int32_t  code = taosRemoveRef(fetchObjRefPool, pTaskInfo->pSubJobCtx->subJobRefId);
46,983,782✔
377
    if (code != TSDB_CODE_SUCCESS) {
46,994,362✔
378
      qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
×
379
    }
380
  }
381

382
  taosArrayDestroyEx(pTaskInfo->schemaInfos, cleanupQueriedTableScanInfo);
425,590,064✔
383
  cleanupTmqInfo(&pTaskInfo->tmqInfo);
425,295,940✔
384

385
  if (!pTaskInfo->localFetch.localExec) {
424,860,212✔
386
    nodesDestroyNode((SNode*)pTaskInfo->pSubplan);
424,988,860✔
387
    pTaskInfo->pSubplan = NULL;
425,481,827✔
388
  }
389

390
  taosArrayDestroyEx(pTaskInfo->pResultBlockList, freeBlock);
425,490,630✔
391
  taosArrayDestroy(pTaskInfo->stopInfo.pStopInfo);
425,490,039✔
392
  if (!pTaskInfo->paramSet) {
425,476,361✔
393
    freeOperatorParam(pTaskInfo->pOpParam, OP_GET_PARAM);
412,689,952✔
394
    pTaskInfo->pOpParam = NULL;
412,305,582✔
395
  }
396
  if (pTaskInfo->ownStreamRtInfo && pTaskInfo->pStreamRuntimeInfo != NULL) {
425,079,319✔
397
    SStreamRuntimeFuncInfo* pRt = &pTaskInfo->pStreamRuntimeInfo->funcInfo;
567,906✔
398

399
    // When isMultiGroupCalc, pStreamPesudoFuncVals is aliased to curGrpCalc->pParams
400
    // inside pGroupCalcInfos.  NULL it out so tDestroyStRtFuncInfo won't free it twice.
401
    if (pRt->isMultiGroupCalc && pRt->pGroupCalcInfos != NULL) {
567,457✔
402
      pRt->pStreamPesudoFuncVals = NULL;
78,126✔
403
      pRt->pStreamPartColVals = NULL;
78,126✔
404
    }
405
    tDestroyStRtFuncInfo(pRt);
567,457✔
406
    taosMemoryFreeClear(pTaskInfo->pStreamRuntimeInfo);
567,906✔
407
  }
408
  taosMemoryFreeClear(pTaskInfo->sql);
425,253,397✔
409
  taosMemoryFreeClear(pTaskInfo->id.str);
425,494,936✔
410
  taosMemoryFreeClear(pTaskInfo);
425,110,701✔
411
}
425,065,118✔
412

413
void buildTaskId(uint64_t taskId, uint64_t queryId, char* dst, int32_t len) {
607,478,159✔
414
  int32_t ret = snprintf(dst, len, "TID:0x%" PRIx64 " QID:0x%" PRIx64, taskId, queryId);
607,478,159✔
415
  if (ret < 0) {
607,478,159✔
416
    qError("TID:0x%"PRIx64" QID:0x%"PRIx64" create task id failed,  ignore and continue", taskId, queryId);
×
417
  }
418
}
607,478,159✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc