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

taosdata / TDengine / #4799

13 Oct 2025 06:50AM UTC coverage: 58.524% (+0.09%) from 58.433%
#4799

push

travis-ci

web-flow
Merge pull request #33213 from taosdata/fix/huoh/timemoe_model_directory

fix: fix tdgpt timemoe model directory

139292 of 303332 branches covered (45.92%)

Branch coverage included in aggregate %.

210815 of 294900 relevant lines covered (71.49%)

23992095.37 hits per line

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

74.11
/source/libs/executor/src/eventwindowoperator.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 "executorInt.h"
17
#include "filter.h"
18
#include "function.h"
19
#include "functionMgt.h"
20
#include "operator.h"
21
#include "querytask.h"
22
#include "tcommon.h"
23
#include "tcompare.h"
24
#include "tdatablock.h"
25
#include "ttime.h"
26

27
static int32_t eventWindowAggregateNext(SOperatorInfo* pOperator, SSDataBlock** pRes);
28
static void    destroyEWindowOperatorInfo(void* param);
29
static int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* pInfo, SSDataBlock* pBlock);
30
void cleanupResultInfoInEventWindow(SOperatorInfo* pOperator, SEventWindowOperatorInfo* pInfo);
31

32
static int32_t resetEventWindowOperState(SOperatorInfo* pOper) {
×
33
  SEventWindowOperatorInfo* pEvent = pOper->info;
×
34
  SExecTaskInfo*           pTaskInfo = pOper->pTaskInfo;
×
35
  SEventWinodwPhysiNode* pPhynode = (SEventWinodwPhysiNode*)pOper->pPhyNode;
×
36
  pOper->status = OP_NOT_OPENED;
×
37

38
  resetBasicOperatorState(&pEvent->binfo);
×
39
  taosMemoryFreeClear(pEvent->pRow);
×
40

41
  pEvent->groupId = 0;
×
42
  pEvent->pPreDataBlock = NULL;
×
43
  pEvent->inWindow = false;
×
44

45
  colDataDestroy(&pEvent->twAggSup.timeWindowData);
×
46
  int32_t code = initExecTimeWindowInfo(&pEvent->twAggSup.timeWindowData, &pTaskInfo->window);
×
47
  cleanupResultInfoInEventWindow(pOper, pEvent);
×
48

49
  if (code == 0) {
×
50
    code = resetAggSup(&pOper->exprSupp, &pEvent->aggSup, pTaskInfo, pPhynode->window.pFuncs, NULL,
×
51
                       sizeof(int64_t) * 2 + POINTER_BYTES, pTaskInfo->id.str, pTaskInfo->streamInfo.pState,
×
52
                       &pTaskInfo->storageAPI.functionStore);
53
  }
54
  if (code == 0) {
×
55
    code = resetExprSupp(&pEvent->scalarSup, pTaskInfo, pPhynode->window.pExprs, NULL,
×
56
                         &pTaskInfo->storageAPI.functionStore);
57
  }
58
  return code;
×
59
}
60

61
int32_t createEventwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode,
554,738✔
62
                                             SExecTaskInfo* pTaskInfo, SOperatorInfo** pOptrInfo) {
63
  QRY_PARAM_CHECK(pOptrInfo);
554,738!
64

65
  int32_t                   code = TSDB_CODE_SUCCESS;
554,738✔
66
  int32_t                   lino = 0;
554,738✔
67
  SEventWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SEventWindowOperatorInfo));
554,738!
68
  SOperatorInfo*            pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
554,734!
69
  if (pInfo == NULL || pOperator == NULL) {
554,732!
70
    code = terrno;
×
71
    goto _error;
×
72
  }
73

74
  pOperator->pPhyNode = physiNode;
554,732✔
75
  pOperator->exprSupp.hasWindowOrGroup = true;
554,732✔
76

77
  SEventWinodwPhysiNode* pEventWindowNode = (SEventWinodwPhysiNode*)physiNode;
554,732✔
78

79
  int32_t tsSlotId = ((SColumnNode*)pEventWindowNode->window.pTspk)->slotId;
554,732✔
80
  code = filterInitFromNode((SNode*)pEventWindowNode->pStartCond, &pInfo->pStartCondInfo, 0,
554,732✔
81
                            pTaskInfo->pStreamRuntimeInfo);
554,732✔
82
  QUERY_CHECK_CODE(code, lino, _error);
554,735!
83

84
  code = filterInitFromNode((SNode*)pEventWindowNode->pEndCond, &pInfo->pEndCondInfo, 0,
554,735✔
85
                            pTaskInfo->pStreamRuntimeInfo);
554,735✔
86
  QUERY_CHECK_CODE(code, lino, _error);
554,740!
87

88
  if (pEventWindowNode->window.pExprs != NULL) {
554,740✔
89
    int32_t    numOfScalarExpr = 0;
2✔
90
    SExprInfo* pScalarExprInfo = NULL;
2✔
91

92
    code = createExprInfo(pEventWindowNode->window.pExprs, NULL, &pScalarExprInfo, &numOfScalarExpr);
2✔
93
    QUERY_CHECK_CODE(code, lino, _error);
2!
94
    code = initExprSupp(&pInfo->scalarSup, pScalarExprInfo, numOfScalarExpr, &pTaskInfo->storageAPI.functionStore);
2✔
95
    QUERY_CHECK_CODE(code, lino, _error);
2!
96
  }
97

98
  code = filterInitFromNode((SNode*)pEventWindowNode->window.node.pConditions, &pOperator->exprSupp.pFilterInfo, 0,
554,740✔
99
                            pTaskInfo->pStreamRuntimeInfo);
554,740✔
100
  QUERY_CHECK_CODE(code, lino, _error);
554,740!
101

102
  size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
554,740✔
103

104
  int32_t    num = 0;
554,740✔
105
  SExprInfo* pExprInfo = NULL;
554,740✔
106
  code = createExprInfo(pEventWindowNode->window.pFuncs, NULL, &pExprInfo, &num);
554,740✔
107
  QUERY_CHECK_CODE(code, lino, _error);
554,741!
108

109
  initResultSizeInfo(&pOperator->resultInfo, 4096);
554,741✔
110

111
  code = initAggSup(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, num, keyBufSize, pTaskInfo->id.str,
554,741✔
112
                    pTaskInfo->streamInfo.pState, &pTaskInfo->storageAPI.functionStore);
554,741✔
113
  QUERY_CHECK_CODE(code, lino, _error);
554,741!
114

115
  SSDataBlock* pResBlock = createDataBlockFromDescNode(pEventWindowNode->window.node.pOutputDataBlockDesc);
554,741✔
116
  QUERY_CHECK_NULL(pResBlock, code, lino, _error, terrno);
554,741!
117
  initBasicInfo(&pInfo->binfo, pResBlock);
554,741✔
118

119
  code = blockDataEnsureCapacity(pResBlock, pOperator->resultInfo.capacity);
554,738✔
120
  QUERY_CHECK_CODE(code, lino, _error);
554,740!
121

122
  initResultRowInfo(&pInfo->binfo.resultRowInfo);
554,740✔
123
  pInfo->binfo.inputTsOrder = physiNode->inputTsOrder;
554,740✔
124
  pInfo->binfo.outputTsOrder = physiNode->outputTsOrder;
554,740✔
125

126
  pInfo->twAggSup = (STimeWindowAggSupp){.waterMark = pEventWindowNode->window.watermark,
554,740✔
127
                                         .calTrigger = pEventWindowNode->window.triggerType};
554,740✔
128

129
  code = initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window);
554,740✔
130
  QUERY_CHECK_CODE(code, lino, _error);
554,742!
131

132
  pInfo->tsSlotId = tsSlotId;
554,742✔
133
  pInfo->pPreDataBlock = NULL;
554,742✔
134
  pInfo->pOperator = pOperator;
554,742✔
135
  pInfo->trueForLimit = pEventWindowNode->trueForLimit;
554,742✔
136

137
  setOperatorInfo(pOperator, "EventWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT, true, OP_NOT_OPENED, pInfo,
554,742✔
138
                  pTaskInfo);
139
  pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, eventWindowAggregateNext, NULL, destroyEWindowOperatorInfo,
554,740✔
140
                                         optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
141

142
  setOperatorResetStateFn(pOperator, resetEventWindowOperState);
554,738✔
143
  code = appendDownstream(pOperator, &downstream, 1);
554,739✔
144
  if (code != TSDB_CODE_SUCCESS) {
554,741!
145
    goto _error;
×
146
  }
147

148
  *pOptrInfo = pOperator;
554,741✔
149
  return TSDB_CODE_SUCCESS;
554,741✔
150

151
_error:
×
152
  if (pInfo != NULL) {
×
153
    destroyEWindowOperatorInfo(pInfo);
×
154
  }
155

156
  destroyOperatorAndDownstreams(pOperator, &downstream, 1);
×
157
  pTaskInfo->code = code;
×
158
  return code;
×
159
}
160

161
void cleanupResultInfoInEventWindow(SOperatorInfo* pOperator, SEventWindowOperatorInfo* pInfo) {
554,741✔
162
  if (pInfo == NULL || pInfo->pRow == NULL || pOperator == NULL) {
554,741!
163
    return;
157,356✔
164
  }
165
  SExprSupp*       pSup = &pOperator->exprSupp;
397,385✔
166
  for (int32_t j = 0; j < pSup->numOfExprs; ++j) {
979,414✔
167
    pSup->pCtx[j].resultInfo = getResultEntryInfo(pInfo->pRow, j, pSup->rowEntryInfoOffset);
582,031✔
168
    if (pSup->pCtx[j].fpSet.cleanup) {
582,029!
169
      pSup->pCtx[j].fpSet.cleanup(&pSup->pCtx[j]);
×
170
    }
171
  }
172
}
173

174
void destroyEWindowOperatorInfo(void* param) {
554,741✔
175
  SEventWindowOperatorInfo* pInfo = (SEventWindowOperatorInfo*)param;
554,741✔
176
  if (pInfo == NULL) {
554,741!
177
    return;
×
178
  }
179

180
  if (pInfo->pRow != NULL) {
554,741✔
181
    taosMemoryFree(pInfo->pRow);
397,386!
182
  }
183

184
  if (pInfo->pStartCondInfo != NULL) {
554,739!
185
    filterFreeInfo(pInfo->pStartCondInfo);
554,740✔
186
    pInfo->pStartCondInfo = NULL;
554,741✔
187
  }
188

189
  if (pInfo->pEndCondInfo != NULL) {
554,740!
190
    filterFreeInfo(pInfo->pEndCondInfo);
554,741✔
191
    pInfo->pEndCondInfo = NULL;
554,740✔
192
  }
193

194
  cleanupBasicInfo(&pInfo->binfo);
554,739✔
195
  colDataDestroy(&pInfo->twAggSup.timeWindowData);
554,740✔
196

197
  cleanupResultInfoInEventWindow(pInfo->pOperator, pInfo);
554,741✔
198
  pInfo->pOperator = NULL;
554,739✔
199
  cleanupAggSup(&pInfo->aggSup);
554,739✔
200
  cleanupExprSupp(&pInfo->scalarSup);
554,740✔
201
  taosMemoryFreeClear(param);
554,737!
202
}
203

204
static int32_t eventWindowAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
955,663✔
205
  int32_t                   code = TSDB_CODE_SUCCESS;
955,663✔
206
  int32_t                   lino = 0;
955,663✔
207
  SEventWindowOperatorInfo* pInfo = pOperator->info;
955,663✔
208
  SExecTaskInfo*            pTaskInfo = pOperator->pTaskInfo;
955,663✔
209

210
  SExprSupp* pSup = &pOperator->exprSupp;
955,663✔
211
  int32_t    order = pInfo->binfo.inputTsOrder;
955,663✔
212

213
  SSDataBlock* pRes = pInfo->binfo.pRes;
955,663✔
214

215
  blockDataCleanup(pRes);
955,663✔
216

217
  SOperatorInfo* downstream = pOperator->pDownstream[0];
955,663✔
218
  while (1) {
543,282✔
219
    SSDataBlock* pBlock = NULL;
1,498,945✔
220
    if (pInfo->pPreDataBlock == NULL) {
1,498,945✔
221
      pBlock = getNextBlockFromDownstream(pOperator, 0);
1,494,448✔
222
    } else {
223
      pBlock = pInfo->pPreDataBlock;
4,497✔
224
      pInfo->pPreDataBlock = NULL;
4,497✔
225
    }
226

227
    if (pBlock == NULL) {
1,498,946✔
228
      break;
945,575✔
229
    }
230

231
    pRes->info.scanFlag = pBlock->info.scanFlag;
553,371✔
232
    code = setInputDataBlock(pSup, pBlock, order, MAIN_SCAN, true);
553,371✔
233
    QUERY_CHECK_CODE(code, lino, _end);
553,371!
234

235
    code = blockDataUpdateTsWindow(pBlock, pInfo->tsSlotId);
553,371✔
236
    QUERY_CHECK_CODE(code, lino, _end);
553,371!
237

238
    // there is an scalar expression that needs to be calculated right before apply the group aggregation.
239
    if (pInfo->scalarSup.pExprInfo != NULL) {
553,371✔
240
      code = projectApplyFunctions(pInfo->scalarSup.pExprInfo, pBlock, pBlock, pInfo->scalarSup.pCtx,
4✔
241
                                   pInfo->scalarSup.numOfExprs, NULL, GET_STM_RTINFO(pOperator->pTaskInfo));
4!
242
      QUERY_CHECK_CODE(code, lino, _end);
4!
243
    }
244

245
    code = eventWindowAggImpl(pOperator, pInfo, pBlock);
553,371✔
246
    QUERY_CHECK_CODE(code, lino, _end);
553,375!
247

248
    code = doFilter(pRes, pSup->pFilterInfo, NULL, NULL);
553,375✔
249
    QUERY_CHECK_CODE(code, lino, _end);
553,375!
250

251
    if (pRes->info.rows >= pOperator->resultInfo.threshold ||
553,375✔
252
        (pRes->info.id.groupId != pInfo->groupId && pRes->info.rows > 0)) {
547,043✔
253
      (*ppRes) = pRes;
10,093✔
254
      return code;
10,093✔
255
    }
256
  }
257

258
_end:
945,575✔
259
  if (code != TSDB_CODE_SUCCESS) {
945,575!
260
    qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
×
261
    pTaskInfo->code = code;
×
262
    T_LONG_JMP(pTaskInfo->env, code);
×
263
  }
264
  (*ppRes) =  pRes->info.rows == 0 ? NULL : pRes;
945,575✔
265
  return code;
945,575✔
266
}
267

268
static int32_t setSingleOutputTupleBufv1(SResultRowInfo* pResultRowInfo, STimeWindow* win, SResultRow** pResult,
172,304,167✔
269
                                         SExprSupp* pExprSup, SAggSupporter* pAggSup) {
270
  if (*pResult == NULL) {
172,304,167✔
271
    SResultRow* p = taosMemoryCalloc(1, pAggSup->resultRowSize);
397,379!
272
    if (!p) {
397,384!
273
      return terrno;
×
274
    }
275
    pResultRowInfo->cur = (SResultRowPosition){.pageId = p->pageId, .offset = p->offset};
397,384✔
276
    *pResult = p;
397,384✔
277
  }
278

279
  (*pResult)->win = *win;
172,304,172✔
280

281
  return setResultRowInitCtx(*pResult, pExprSup->pCtx, pExprSup->numOfExprs, pExprSup->rowEntryInfoOffset);
172,304,172✔
282
}
283

284
static int32_t doEventWindowAggImpl(SEventWindowOperatorInfo* pInfo, SExprSupp* pSup, int32_t startIndex,
172,286,256✔
285
                                    int32_t endIndex, const SSDataBlock* pBlock, int64_t* tsList,
286
                                    SExecTaskInfo* pTaskInfo) {
287
  int32_t code = TSDB_CODE_SUCCESS;
172,286,256✔
288
  SWindowRowsSup* pRowSup = &pInfo->winSup;
172,286,256✔
289

290
  int32_t numOfOutput = pSup->numOfExprs;
172,286,256✔
291
  int32_t numOfRows = endIndex - startIndex + 1;
172,286,256✔
292

293
  doKeepTuple(pRowSup, tsList[endIndex], endIndex, pBlock->info.id.groupId);
172,286,256✔
294

295
  code = setSingleOutputTupleBufv1(&pInfo->binfo.resultRowInfo, &pRowSup->win, &pInfo->pRow, pSup, &pInfo->aggSup);
172,313,252✔
296
  if (code != TSDB_CODE_SUCCESS) {  // null data, too many state code
172,376,433!
297
    qError("failed to set single output tuple buffer, code:%d", code);
×
298
    return code;
×
299
  }
300

301
  updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pRowSup->win, 0);
172,376,433✔
302
  code = applyAggFunctionOnPartialTuples(pTaskInfo, pSup->pCtx, &pInfo->twAggSup.timeWindowData, startIndex, numOfRows,
172,364,777✔
303
                                         pBlock->info.rows, numOfOutput);
172,364,777✔
304
  return code;
172,452,760✔
305
}
306

307
int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* pInfo, SSDataBlock* pBlock) {
553,369✔
308
  int32_t          code = TSDB_CODE_SUCCESS;
553,369✔
309
  int32_t          lino = 0;
553,369✔
310
  SExecTaskInfo*   pTaskInfo = pOperator->pTaskInfo;
553,369✔
311
  SExprSupp*       pSup = &pOperator->exprSupp;
553,369✔
312
  SSDataBlock*     pRes = pInfo->binfo.pRes;
553,369✔
313
  int64_t          gid = pBlock->info.id.groupId;
553,369✔
314
  SColumnInfoData *ps = NULL, *pe = NULL;
553,369✔
315
  SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, pInfo->tsSlotId);
553,369✔
316
  QUERY_CHECK_NULL(pColInfoData, code, lino, _return, terrno);
553,364!
317
  TSKEY*           tsList = (TSKEY*)pColInfoData->pData;
553,364✔
318
  SWindowRowsSup*  pRowSup = &pInfo->winSup;
553,364✔
319
  int32_t          rowIndex = 0;
553,364✔
320
  int64_t          minWindowSize = getMinWindowSize(pOperator);
553,364✔
321

322
  pRowSup->numOfRows = 0;
553,365✔
323
  if (pInfo->groupId == 0) {
553,365✔
324
    pInfo->groupId = gid;
542,294✔
325
  } else if (pInfo->groupId != gid) {
11,071✔
326
    // this is a new group, reset the info
327
    pInfo->inWindow = false;
4,529✔
328
    pInfo->groupId = gid;
4,529✔
329
    pInfo->pPreDataBlock = pBlock;
4,529✔
330
    goto _return;
4,529✔
331
  }
332
  pRes->info.id.groupId = pInfo->groupId;
548,836✔
333

334
  SFilterColumnParam param1 = {.numOfCols = taosArrayGetSize(pBlock->pDataBlock), .pDataBlock = pBlock->pDataBlock};
548,836✔
335

336
  code = filterSetDataFromSlotId(pInfo->pStartCondInfo, &param1);
548,836✔
337
  QUERY_CHECK_CODE(code, lino, _return);
548,841!
338

339
  int32_t status1 = 0;
548,841✔
340
  code = filterExecute(pInfo->pStartCondInfo, pBlock, &ps, NULL, param1.numOfCols, &status1);
548,841✔
341
  QUERY_CHECK_CODE(code, lino, _return);
548,847!
342

343
  SFilterColumnParam param2 = {.numOfCols = taosArrayGetSize(pBlock->pDataBlock), .pDataBlock = pBlock->pDataBlock};
548,847✔
344
  code = filterSetDataFromSlotId(pInfo->pEndCondInfo, &param2);
548,847✔
345
  QUERY_CHECK_CODE(code, lino, _return);
548,832!
346

347
  int32_t status2 = 0;
548,832✔
348
  code = filterExecute(pInfo->pEndCondInfo, pBlock, &pe, NULL, param2.numOfCols, &status2);
548,832✔
349
  QUERY_CHECK_CODE(code, lino, _return);
548,844!
350

351
  int32_t startIndex = pInfo->inWindow ? 0 : -1;
548,844✔
352
  while (rowIndex < pBlock->info.rows) {
344,324,105✔
353
    if (pInfo->inWindow) {  // let's find the first end value
343,878,491✔
354
      for (rowIndex = startIndex; rowIndex < pBlock->info.rows; ++rowIndex) {
220,319,072✔
355
        if (((bool*)pe->pData)[rowIndex]) {
220,215,251✔
356
          break;
172,139,949✔
357
        }
358
      }
359

360
      if (rowIndex < pBlock->info.rows) {
172,243,770✔
361
        code = doEventWindowAggImpl(pInfo, pSup, startIndex, rowIndex, pBlock, tsList, pTaskInfo);
172,143,717✔
362
        QUERY_CHECK_CODE(code, lino, _return);
172,346,467!
363
        doUpdateNumOfRows(pSup->pCtx, pInfo->pRow, pSup->numOfExprs, pSup->rowEntryInfoOffset);
172,346,467✔
364

365
        if (pRowSup->win.ekey - pRowSup->win.skey < minWindowSize) {
172,298,302✔
366
          qDebug("skip small window, groupId: %" PRId64 ", windowSize: %" PRId64 ", minWindowSize: %" PRId64,
1,736!
367
                 pInfo->groupId, pRowSup->win.ekey - pRowSup->win.skey, minWindowSize);
368
        } else {
369
          // check buffer size
370
          if (pRes->info.rows + pInfo->pRow->numOfRows >= pRes->info.capacity) {
172,296,566✔
371
            int32_t newSize = pRes->info.rows + pInfo->pRow->numOfRows;
425,237✔
372
            code = blockDataEnsureCapacity(pRes, newSize);
425,237✔
373
            QUERY_CHECK_CODE(code, lino, _return);
425,237!
374
          }
375

376
          code = copyResultrowToDataBlock(pSup->pExprInfo, pSup->numOfExprs, pInfo->pRow, pSup->pCtx, pRes,
172,296,566✔
377
                                          pSup->rowEntryInfoOffset, pTaskInfo);
172,296,566✔
378
          QUERY_CHECK_CODE(code, lino, _return);
171,377,437!
379

380
          pRes->info.rows += pInfo->pRow->numOfRows;
171,377,437✔
381
        }
382
        pInfo->pRow->numOfRows = 0;
171,460,319✔
383

384
        pInfo->inWindow = false;
171,460,319✔
385
        rowIndex += 1;
171,460,319✔
386
      } else {
387
        code = doEventWindowAggImpl(pInfo, pSup, startIndex, pBlock->info.rows - 1, pBlock, tsList, pTaskInfo);
100,053✔
388
        QUERY_CHECK_CODE(code, lino, _return);
101,058!
389
      }
390
    } else {  // find the first start value that is fulfill for the start condition
391
      for (; rowIndex < pBlock->info.rows; ++rowIndex) {
219,720,361✔
392
        if (((bool*)ps->pData)[rowIndex]) {
219,650,607✔
393
          doKeepNewWindowStartInfo(pRowSup, tsList, rowIndex, gid);
171,564,967✔
394
          pInfo->inWindow = true;
171,785,026✔
395
          startIndex = rowIndex;
171,785,026✔
396
          if (pInfo->pRow != NULL) {
171,785,026✔
397
            clearResultRowInitFlag(pSup->pCtx, pSup->numOfExprs);
171,483,103✔
398
          }
399
          break;
172,207,935✔
400
        }
401
      }
402

403
      if (pInfo->inWindow) {
172,277,689✔
404
        continue;  // try to find the end position
172,213,884✔
405
      } else {
406
        break;  // no valid start position, quit
63,805✔
407
      }
408
    }
409
  }
410

411
_return:
445,614✔
412

413
  if (code != TSDB_CODE_SUCCESS) {
513,948!
414
    qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
×
415
  }
416
  colDataDestroy(ps);
513,948✔
417
  taosMemoryFree(ps);
553,375!
418
  colDataDestroy(pe);
553,375✔
419
  taosMemoryFree(pe);
553,374!
420

421
  return code;
553,375✔
422
}
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