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

taosdata / TDengine / #4548

22 Jul 2025 02:37AM UTC coverage: 54.273% (-3.0%) from 57.287%
#4548

push

travis-ci

GitHub
Merge pull request #32061 from taosdata/new_testcases

132738 of 315239 branches covered (42.11%)

Branch coverage included in aggregate %.

201371 of 300373 relevant lines covered (67.04%)

3475977.14 hits per line

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

58.57
/source/libs/executor/src/aggregateoperator.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 "nodes.h"
19
#include "os.h"
20
#include "querynodes.h"
21
#include "tfill.h"
22
#include "tname.h"
23

24
#include "executorInt.h"
25
#include "index.h"
26
#include "operator.h"
27
#include "query.h"
28
#include "querytask.h"
29
#include "tcompare.h"
30
#include "tdatablock.h"
31
#include "tglobal.h"
32
#include "thash.h"
33
#include "ttypes.h"
34

35
typedef struct {
36
  bool    hasAgg;
37
  int32_t numOfRows;
38
  int32_t startOffset;
39
} SFunctionCtxStatus;
40

41
typedef struct SAggOperatorInfo {
42
  SOptrBasicInfo   binfo;
43
  SAggSupporter    aggSup;
44
  STableQueryInfo* current;
45
  uint64_t         groupId;
46
  SGroupResInfo    groupResInfo;
47
  SExprSupp        scalarExprSup;
48
  bool             groupKeyOptimized;
49
  bool             hasValidBlock;
50
  SSDataBlock*     pNewGroupBlock;
51
  bool             hasCountFunc;
52
  SOperatorInfo*   pOperator;
53
  bool             cleanGroupResInfo;
54
} SAggOperatorInfo;
55

56
static void destroyAggOperatorInfo(void* param);
57
static int32_t setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId);
58

59
static int32_t createDataBlockForEmptyInput(SOperatorInfo* pOperator, SSDataBlock** ppBlock);
60
static void    destroyDataBlockForEmptyInput(bool blockAllocated, SSDataBlock** ppBlock);
61

62
static int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx);
63
static int32_t getAggregateResultNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
64
static int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize,
65
                                const char* pKey);
66

67
static int32_t addNewResultRowBuf(SResultRow* pWindowRes, SDiskbasedBuf* pResultBuf, uint32_t size);
68

69
static int32_t doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId);
70

71
static void functionCtxSave(SqlFunctionCtx* pCtx, SFunctionCtxStatus* pStatus);
72
static void functionCtxRestore(SqlFunctionCtx* pCtx, SFunctionCtxStatus* pStatus);
73

74
static int32_t resetAggregateOperatorState(SOperatorInfo* pOper);
75

76
int32_t createAggregateOperatorInfo(SOperatorInfo* downstream, SAggPhysiNode* pAggNode, SExecTaskInfo* pTaskInfo,
407,377✔
77
                                    SOperatorInfo** pOptrInfo) {
78
  QRY_PARAM_CHECK(pOptrInfo);
407,377!
79

80
  int32_t    lino = 0;
407,377✔
81
  int32_t    code = 0;
407,377✔
82
  int32_t    num = 0;
407,377✔
83
  SExprInfo* pExprInfo = NULL;
407,377✔
84
  int32_t    numOfScalarExpr = 0;
407,377✔
85
  SExprInfo* pScalarExprInfo = NULL;
407,377✔
86

87
  SAggOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SAggOperatorInfo));
407,377!
88
  SOperatorInfo*    pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
407,524!
89
  if (pInfo == NULL || pOperator == NULL) {
407,579!
90
    code = terrno;
×
91
    goto _error;
×
92
  }
93

94
  pOperator->exprSupp.hasWindowOrGroup = false;
407,585✔
95

96
  SSDataBlock* pResBlock = createDataBlockFromDescNode(pAggNode->node.pOutputDataBlockDesc);
407,585✔
97
  QUERY_CHECK_NULL(pResBlock, code, lino, _error, terrno);
407,635!
98
  initBasicInfo(&pInfo->binfo, pResBlock);
407,635✔
99

100
  size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
407,539✔
101
  initResultSizeInfo(&pOperator->resultInfo, 4096);
407,539✔
102

103

104
  code = createExprInfo(pAggNode->pAggFuncs, pAggNode->pGroupKeys, &pExprInfo, &num);
407,583✔
105
  TSDB_CHECK_CODE(code, lino, _error);
407,582!
106

107
  code = initAggSup(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, num, keyBufSize, pTaskInfo->id.str,
407,582✔
108
                               pTaskInfo->streamInfo.pState, &pTaskInfo->storageAPI.functionStore);
407,582✔
109
  TSDB_CHECK_CODE(code, lino, _error);
407,583!
110

111
  if (pAggNode->pExprs != NULL) {
407,583✔
112
    code = createExprInfo(pAggNode->pExprs, NULL, &pScalarExprInfo, &numOfScalarExpr);
104,353✔
113
    TSDB_CHECK_CODE(code, lino, _error);
104,368!
114
  }
115

116
  code = initExprSupp(&pInfo->scalarExprSup, pScalarExprInfo, numOfScalarExpr, &pTaskInfo->storageAPI.functionStore);
407,598✔
117
  TSDB_CHECK_CODE(code, lino, _error);
407,450!
118

119
  code = filterInitFromNode((SNode*)pAggNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0,
407,450✔
120
                            GET_STM_RTINFO(pTaskInfo));
407,450!
121
  TSDB_CHECK_CODE(code, lino, _error);
407,535!
122

123
  pInfo->binfo.mergeResultBlock = pAggNode->mergeDataBlock;
407,535✔
124
  pInfo->groupKeyOptimized = pAggNode->groupKeyOptimized;
407,535✔
125
  pInfo->groupId = UINT64_MAX;
407,535✔
126
  pInfo->binfo.inputTsOrder = pAggNode->node.inputTsOrder;
407,535✔
127
  pInfo->binfo.outputTsOrder = pAggNode->node.outputTsOrder;
407,535✔
128
  pInfo->hasCountFunc = pAggNode->hasCountLikeFunc;
407,535✔
129
  pInfo->pOperator = pOperator;
407,535✔
130
  pInfo->cleanGroupResInfo = false;
407,535✔
131

132
  setOperatorInfo(pOperator, "TableAggregate", QUERY_NODE_PHYSICAL_PLAN_HASH_AGG,
407,535✔
133
                  !pAggNode->node.forceCreateNonBlockingOptr, OP_NOT_OPENED, pInfo, pTaskInfo);
407,535✔
134
  pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, getAggregateResultNext, NULL, destroyAggOperatorInfo,
407,537✔
135
                                         optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
136
  setOperatorResetStateFn(pOperator, resetAggregateOperatorState);
407,510✔
137

138
  pOperator->pPhyNode = pAggNode;
407,486✔
139

140
  if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN) {
407,486✔
141
    STableScanInfo* pTableScanInfo = downstream->info;
255,503✔
142
    pTableScanInfo->base.pdInfo.pExprSup = &pOperator->exprSupp;
255,503✔
143
    pTableScanInfo->base.pdInfo.pAggSup = &pInfo->aggSup;
255,503✔
144
  }
145

146
  code = appendDownstream(pOperator, &downstream, 1);
407,486✔
147
  if (code != TSDB_CODE_SUCCESS) {
407,544!
148
    goto _error;
×
149
  }
150

151
  *pOptrInfo = pOperator;
407,544✔
152
  return TSDB_CODE_SUCCESS;
407,544✔
153

154
_error:
×
155
  qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
×
156
  if (pInfo != NULL) {
×
157
    destroyAggOperatorInfo(pInfo);
×
158
  }
159
  destroyOperatorAndDownstreams(pOperator, &downstream, 1);
×
160
  pTaskInfo->code = code;
×
161
  return code;
×
162
}
163

164
void destroyAggOperatorInfo(void* param) {
407,560✔
165
  if (param == NULL) {
407,560!
166
    return;
×
167
  }
168
  SAggOperatorInfo* pInfo = (SAggOperatorInfo*)param;
407,560✔
169
  cleanupBasicInfo(&pInfo->binfo);
407,560✔
170

171
  if (pInfo->pOperator) {
407,666✔
172
    cleanupResultInfo(pInfo->pOperator->pTaskInfo, &pInfo->pOperator->exprSupp, &pInfo->groupResInfo, &pInfo->aggSup,
407,664✔
173
                      pInfo->cleanGroupResInfo);
407,664✔
174
    pInfo->pOperator = NULL;
407,647✔
175
  }
176
  cleanupAggSup(&pInfo->aggSup);
407,649✔
177
  cleanupExprSuppWithoutFilter(&pInfo->scalarExprSup);
407,667✔
178
  cleanupGroupResInfo(&pInfo->groupResInfo);
407,619✔
179
  taosMemoryFreeClear(param);
407,673!
180
}
181

182
/**
183
 * @brief get blocks from downstream and fill results into groupedRes after aggragation
184
 * @retval false if no more groups
185
 * @retval true if there could have new groups coming
186
 * @note if pOperator.blocking is true, scan all blocks from downstream, all groups are handled
187
 *       if false, fill results of ONE GROUP
188
 * */
189
static bool nextGroupedResult(SOperatorInfo* pOperator) {
483,877✔
190
  int32_t           code = TSDB_CODE_SUCCESS;
483,877✔
191
  int32_t           lino = 0;
483,877✔
192
  SExecTaskInfo*    pTaskInfo = pOperator->pTaskInfo;
483,877✔
193
  SAggOperatorInfo* pAggInfo = pOperator->info;
483,877✔
194

195
  if(!pAggInfo) {
483,877!
196
    qError("function:%s, pAggInfo is NULL", __func__);
×
197
    return false;
×
198
  }
199
  if (pOperator->blocking && pAggInfo->hasValidBlock) {
483,877✔
200
    return false;
73,204✔
201
  }
202

203
  SExprSupp*   pSup = &pOperator->exprSupp;
410,673✔
204
  int64_t      st = taosGetTimestampUs();
410,703✔
205
  int32_t      order = pAggInfo->binfo.inputTsOrder;
410,703✔
206
  SSDataBlock* pBlock = pAggInfo->pNewGroupBlock;
410,703✔
207

208
  pAggInfo->cleanGroupResInfo = false;
410,703✔
209
  if (pBlock) {
410,703✔
210
    pAggInfo->pNewGroupBlock = NULL;
3,047✔
211
    tSimpleHashClear(pAggInfo->aggSup.pResultRowHashTable);
3,047✔
212
    code = setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.id.groupId);
3,047✔
213
    QUERY_CHECK_CODE(code, lino, _end);
3,047!
214
    code = setInputDataBlock(pSup, pBlock, order, pBlock->info.scanFlag, true);
3,047✔
215
    QUERY_CHECK_CODE(code, lino, _end);
3,047!
216

217
    code = doAggregateImpl(pOperator, pSup->pCtx);
3,047✔
218
    QUERY_CHECK_CODE(code, lino, _end);
3,047!
219
  }
220
  while (1) {
1,391,095✔
221
    bool blockAllocated = false;
1,801,798✔
222
    pBlock = getNextBlockFromDownstream(pOperator, 0);
1,801,798✔
223
    if (pBlock == NULL) {
1,801,885✔
224
      if (!pAggInfo->hasValidBlock) {
420,161✔
225
        code = createDataBlockForEmptyInput(pOperator, &pBlock);
87,279✔
226
        QUERY_CHECK_CODE(code, lino, _end);
87,274!
227

228
        if (pBlock == NULL) {
87,274✔
229
          break;
74,658✔
230
        }
231
        blockAllocated = true;
12,616✔
232
      } else {
233
        break;
332,882✔
234
      }
235
    }
236
    pAggInfo->hasValidBlock = true;
1,394,340✔
237
    pAggInfo->binfo.pRes->info.scanFlag = pBlock->info.scanFlag;
1,394,340✔
238

239
    // there is an scalar expression that needs to be calculated before apply the group aggregation.
240
    if (pAggInfo->scalarExprSup.pExprInfo != NULL && !blockAllocated) {
1,394,340✔
241
      SExprSupp* pSup1 = &pAggInfo->scalarExprSup;
333,691✔
242
      code = projectApplyFunctions(pSup1->pExprInfo, pBlock, pBlock, pSup1->pCtx, pSup1->numOfExprs, NULL, GET_STM_RTINFO(pOperator->pTaskInfo));
333,691!
243
      if (code != TSDB_CODE_SUCCESS) {
333,552!
244
        destroyDataBlockForEmptyInput(blockAllocated, &pBlock);
×
245
        T_LONG_JMP(pTaskInfo->env, code);
×
246
      }
247
    }
248
    // if non-blocking mode and new group arrived, save the block and break
249
    if (!pOperator->blocking && pAggInfo->groupId != UINT64_MAX && pBlock->info.id.groupId != pAggInfo->groupId) {
1,394,201✔
250
      pAggInfo->pNewGroupBlock = pBlock;
3,095✔
251
      break;
3,095✔
252
    }
253
    // the pDataBlock are always the same one, no need to call this again
254
    code = setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.id.groupId);
1,391,106✔
255
    if (code != TSDB_CODE_SUCCESS) {
1,391,229✔
256
      destroyDataBlockForEmptyInput(blockAllocated, &pBlock);
6✔
257
      T_LONG_JMP(pTaskInfo->env, code);
6!
258
    }
259
    code = setInputDataBlock(pSup, pBlock, order, pBlock->info.scanFlag, true);
1,391,223✔
260
    if (code != TSDB_CODE_SUCCESS) {
1,391,118!
261
      destroyDataBlockForEmptyInput(blockAllocated, &pBlock);
×
262
      T_LONG_JMP(pTaskInfo->env, code);
×
263
    }
264

265
    code = doAggregateImpl(pOperator, pSup->pCtx);
1,391,118✔
266
    if (code != TSDB_CODE_SUCCESS) {
1,391,157!
267
      destroyDataBlockForEmptyInput(blockAllocated, &pBlock);
×
268
      T_LONG_JMP(pTaskInfo->env, code);
×
269
    }
270

271
    destroyDataBlockForEmptyInput(blockAllocated, &pBlock);
1,391,157✔
272
  }
273

274
  // the downstream operator may return with error code, so let's check the code before generating results.
275
  if (pTaskInfo->code != TSDB_CODE_SUCCESS) {
410,635✔
276
    T_LONG_JMP(pTaskInfo->env, pTaskInfo->code);
2!
277
  }
278

279
  code = initGroupedResultInfo(&pAggInfo->groupResInfo, pAggInfo->aggSup.pResultRowHashTable, 0);
410,633✔
280
  QUERY_CHECK_CODE(code, lino, _end);
410,631!
281
  pAggInfo->cleanGroupResInfo = true;
410,631✔
282

283
_end:
410,631✔
284
  if (code != TSDB_CODE_SUCCESS) {
410,631!
285
    qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
×
286
    pTaskInfo->code = code;
×
287
    T_LONG_JMP(pTaskInfo->env, code);
×
288
  }
289
  return pBlock != NULL;
410,631✔
290
}
291

292
int32_t getAggregateResultNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
794,909✔
293
  int32_t           code = TSDB_CODE_SUCCESS;
794,909✔
294
  int32_t           lino = 0;
794,909✔
295
  SAggOperatorInfo* pAggInfo = pOperator->info;
794,909✔
296
  SOptrBasicInfo*   pInfo = &pAggInfo->binfo;
794,909✔
297

298
  if (pOperator->status == OP_EXEC_DONE) {
794,909✔
299
    (*ppRes) = NULL;
311,090✔
300
    return code;
311,090✔
301
  }
302

303
  SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
483,819✔
304
  bool           hasNewGroups = false;
483,819✔
305
  do {
306
    hasNewGroups = nextGroupedResult(pOperator);
483,876✔
307
    code = blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity);
483,817✔
308
    QUERY_CHECK_CODE(code, lino, _end);
483,836!
309

310
    while (1) {
311
      doBuildResultDatablock(pOperator, pInfo, &pAggInfo->groupResInfo, pAggInfo->aggSup.pResultBuf);
483,836✔
312
      code = doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
483,877✔
313
      QUERY_CHECK_CODE(code, lino, _end);
483,866!
314

315
      if (!hasRemainResults(&pAggInfo->groupResInfo)) {
483,866✔
316
        if (!hasNewGroups) setOperatorCompleted(pOperator);
410,648✔
317
        break;
410,656✔
318
      }
319

320
      if (pInfo->pRes->info.rows > 0) {
73,210!
321
        break;
73,210✔
322
      }
323
    }
324
  } while (pInfo->pRes->info.rows == 0 && hasNewGroups);
483,866✔
325

326
  size_t rows = blockDataGetNumOfRows(pInfo->pRes);
483,809✔
327
  pOperator->resultInfo.totalRows += rows;
483,797✔
328

329
_end:
483,797✔
330
  if (code != TSDB_CODE_SUCCESS) {
483,797!
331
    qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
×
332
    pTaskInfo->code = code;
×
333
    T_LONG_JMP(pTaskInfo->env, code);
×
334
  }
335

336
  (*ppRes) = (rows == 0) ? NULL : pInfo->pRes;
483,797✔
337
  return code;
483,797✔
338
}
339

340
static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) {
×
341
  SSDataBlock* pRes = NULL;
×
342
  int32_t code = getAggregateResultNext(pOperator, &pRes);
×
343
  return pRes;
×
344
}
345

346
int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx) {
1,394,083✔
347
  int32_t code = TSDB_CODE_SUCCESS;
1,394,083✔
348
  if (!pOperator || (pOperator->exprSupp.numOfExprs > 0 && pCtx == NULL)) {
1,394,083!
349
    qError("%s failed at line %d since pCtx is NULL.", __func__, __LINE__);
×
350
    return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
×
351
  }
352
  for (int32_t k = 0; k < pOperator->exprSupp.numOfExprs; ++k) {
25,424,321✔
353
    if (functionNeedToExecute(&pCtx[k])) {
24,036,808!
354
      // todo add a dummy function to avoid process check
355
      if (pCtx[k].fpSet.process == NULL) {
24,032,762✔
356
        continue;
49,179✔
357
      }
358

359
      if ((&pCtx[k])->input.pData[0] == NULL) {
23,983,583!
360
        code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
×
361
        qError("%s aggregate function error happens, input data is NULL.", GET_TASKID(pOperator->pTaskInfo));
×
362
      } else {
363
        code = pCtx[k].fpSet.process(&pCtx[k]);
23,983,583✔
364
      }
365

366
      if (code != TSDB_CODE_SUCCESS) {
23,984,218!
367
        if (pCtx[k].fpSet.cleanup != NULL) {
×
368
          pCtx[k].fpSet.cleanup(&pCtx[k]);
×
369
        }
370
        qError("%s aggregate function error happens, code:%s", GET_TASKID(pOperator->pTaskInfo), tstrerror(code));
×
371
        return code;
×
372
      }
373
    }
374
  }
375

376
  return TSDB_CODE_SUCCESS;
1,387,513✔
377
}
378

379
static int32_t createDataBlockForEmptyInput(SOperatorInfo* pOperator, SSDataBlock** ppBlock) {
87,263✔
380
  int32_t code = TSDB_CODE_SUCCESS;
87,263✔
381
  int32_t lino = 0;
87,263✔
382
  SSDataBlock* pBlock = NULL;
87,263✔
383
  if (!tsCountAlwaysReturnValue) {
87,263✔
384
    return TSDB_CODE_SUCCESS;
47,958✔
385
  }
386

387
  SAggOperatorInfo* pAggInfo = pOperator->info;
39,305✔
388
  if (pAggInfo->groupKeyOptimized) {
39,305✔
389
    return TSDB_CODE_SUCCESS;
16,969✔
390
  }
391

392
  SOperatorInfo* downstream = pOperator->pDownstream[0];
22,336✔
393
  if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_PARTITION ||
22,336✔
394
      downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_SORT ||
22,155✔
395
      (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN &&
22,005✔
396
       ((STableScanInfo*)downstream->info)->hasGroupByTag == true)) {
9,173✔
397
    return TSDB_CODE_SUCCESS;
336✔
398
  }
399

400
  SqlFunctionCtx* pCtx = pOperator->exprSupp.pCtx;
22,000✔
401

402
  if (!pAggInfo->hasCountFunc) {
22,000✔
403
    return TSDB_CODE_SUCCESS;
9,383✔
404
  }
405

406
  code = createDataBlock(&pBlock);
12,617✔
407
  if (code) {
12,622!
408
    return code;
×
409
  }
410

411
  pBlock->info.rows = 1;
12,622✔
412
  pBlock->info.capacity = 0;
12,622✔
413

414
  for (int32_t i = 0; i < pOperator->exprSupp.numOfExprs; ++i) {
28,591✔
415
    SColumnInfoData colInfo = {0};
15,970✔
416
    colInfo.hasNull = true;
15,970✔
417
    colInfo.info.type = TSDB_DATA_TYPE_NULL;
15,970✔
418
    colInfo.info.bytes = 1;
15,970✔
419

420
    SExprInfo* pOneExpr = &pOperator->exprSupp.pExprInfo[i];
15,970✔
421
    for (int32_t j = 0; j < pOneExpr->base.numOfParams; ++j) {
32,276✔
422
      SFunctParam* pFuncParam = &pOneExpr->base.pParam[j];
16,307✔
423
      if (pFuncParam->type == FUNC_PARAM_TYPE_COLUMN) {
16,307✔
424
        int32_t slotId = pFuncParam->pCol->slotId;
16,283✔
425
        int32_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
16,283✔
426
        if (slotId >= numOfCols) {
16,282✔
427
          code = taosArrayEnsureCap(pBlock->pDataBlock, slotId + 1);
13,304✔
428
          QUERY_CHECK_CODE(code, lino, _end);
13,305!
429

430
          for (int32_t k = numOfCols; k < slotId + 1; ++k) {
33,656✔
431
            void* tmp = taosArrayPush(pBlock->pDataBlock, &colInfo);
20,352✔
432
            QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
20,351!
433
          }
434
        }
435
      } else if (pFuncParam->type == FUNC_PARAM_TYPE_VALUE) {
24✔
436
        // do nothing
437
      }
438
    }
439
  }
440

441
  code = blockDataEnsureCapacity(pBlock, pBlock->info.rows);
12,621✔
442
  QUERY_CHECK_CODE(code, lino, _end);
12,622!
443

444
  for (int32_t i = 0; i < blockDataGetNumOfCols(pBlock); ++i) {
32,976✔
445
    SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
20,352✔
446
    QUERY_CHECK_NULL(pColInfoData, code, lino, _end, terrno);
20,353!
447
    colDataSetNULL(pColInfoData, 0);
448
  }
449
  *ppBlock = pBlock;
12,622✔
450

451
_end:
12,622✔
452
  if (code != TSDB_CODE_SUCCESS) {
12,622!
453
    blockDataDestroy(pBlock);
×
454
    qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
×
455
  }
456
  return code;
12,621✔
457
}
458

459
void destroyDataBlockForEmptyInput(bool blockAllocated, SSDataBlock** ppBlock) {
1,391,118✔
460
  if (!blockAllocated) {
1,391,118✔
461
    return;
1,378,522✔
462
  }
463

464
  blockDataDestroy(*ppBlock);
12,596✔
465
  *ppBlock = NULL;
12,621✔
466
}
467

468
int32_t setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) {
1,394,283✔
469
  int32_t           code = TSDB_CODE_SUCCESS;
1,394,283✔
470
  SAggOperatorInfo* pAggInfo = pOperator->info;
1,394,283✔
471
  if (pAggInfo->groupId != UINT64_MAX && pAggInfo->groupId == groupId) {
1,394,283✔
472
    return code;
486,108✔
473
  }
474

475
  code = doSetTableGroupOutputBuf(pOperator, numOfOutput, groupId);
908,175✔
476

477
  // record the current active group id
478
  pAggInfo->groupId = groupId;
908,253✔
479
  return code;
908,253✔
480
}
481

482
int32_t doSetTableGroupOutputBuf(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t groupId) {
908,362✔
483
  // for simple group by query without interval, all the tables belong to one group result.
484
  int32_t           code = TSDB_CODE_SUCCESS;
908,362✔
485
  int32_t           lino = 0;
908,362✔
486
  SExecTaskInfo*    pTaskInfo = pOperator->pTaskInfo;
908,362✔
487
  SAggOperatorInfo* pAggInfo = pOperator->info;
908,362✔
488

489
  SResultRowInfo* pResultRowInfo = &pAggInfo->binfo.resultRowInfo;
908,362✔
490
  SqlFunctionCtx* pCtx = pOperator->exprSupp.pCtx;
908,362✔
491
  int32_t*        rowEntryInfoOffset = pOperator->exprSupp.rowEntryInfoOffset;
908,362✔
492

493
  SResultRow* pResultRow =
494
      doSetResultOutBufByKey(pAggInfo->aggSup.pResultBuf, pResultRowInfo, (char*)&groupId, sizeof(groupId), true,
908,362✔
495
                             groupId, pTaskInfo, false, &pAggInfo->aggSup, true);
496
  if (pResultRow == NULL || pTaskInfo->code != 0) {
908,484!
497
    code = pTaskInfo->code;
×
498
    lino = __LINE__;
×
499
    goto _end;
×
500
  }
501
  /*
502
   * not assign result buffer yet, add new result buffer
503
   * all group belong to one result set, and each group result has different group id so set the id to be one
504
   */
505
  if (pResultRow->pageId == -1) {
908,485!
506
    code = addNewResultRowBuf(pResultRow, pAggInfo->aggSup.pResultBuf, pAggInfo->binfo.pRes->info.rowSize);
×
507
    QUERY_CHECK_CODE(code, lino, _end);
×
508
  }
509

510
  code = setResultRowInitCtx(pResultRow, pCtx, numOfOutput, rowEntryInfoOffset);
908,485✔
511
  QUERY_CHECK_CODE(code, lino, _end);
908,265!
512

513
_end:
908,265✔
514
  if (code != TSDB_CODE_SUCCESS) {
908,264✔
515
    qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
6!
516
  }
517
  return code;
908,248✔
518
}
519

520
// a new buffer page for each table. Needs to opt this design
521
int32_t addNewResultRowBuf(SResultRow* pWindowRes, SDiskbasedBuf* pResultBuf, uint32_t size) {
×
522
  if (pWindowRes->pageId != -1) {
×
523
    return 0;
×
524
  }
525

526
  SFilePage* pData = NULL;
×
527

528
  // in the first scan, new space needed for results
529
  int32_t pageId = -1;
×
530
  SArray* list = getDataBufPagesIdList(pResultBuf);
×
531

532
  if (taosArrayGetSize(list) == 0) {
×
533
    pData = getNewBufPage(pResultBuf, &pageId);
×
534
    if (pData == NULL) {
×
535
      qError("failed to get buffer, code:%s", tstrerror(terrno));
×
536
      return terrno;
×
537
    }
538
    pData->num = sizeof(SFilePage);
×
539
  } else {
540
    SPageInfo* pi = getLastPageInfo(list);
×
541
    pData = getBufPage(pResultBuf, getPageId(pi));
×
542
    if (pData == NULL) {
×
543
      qError("failed to get buffer, code:%s", tstrerror(terrno));
×
544
      return terrno;
×
545
    }
546

547
    pageId = getPageId(pi);
×
548

549
    if (pData->num + size > getBufPageSize(pResultBuf)) {
×
550
      // release current page first, and prepare the next one
551
      releaseBufPageInfo(pResultBuf, pi);
×
552

553
      pData = getNewBufPage(pResultBuf, &pageId);
×
554
      if (pData == NULL) {
×
555
        qError("failed to get buffer, code:%s", tstrerror(terrno));
×
556
        return terrno;
×
557
      }
558
      pData->num = sizeof(SFilePage);
×
559
    }
560
  }
561

562
  if (pData == NULL) {
×
563
    return -1;
×
564
  }
565

566
  // set the number of rows in current disk page
567
  if (pWindowRes->pageId == -1) {  // not allocated yet, allocate new buffer
×
568
    pWindowRes->pageId = pageId;
×
569
    pWindowRes->offset = (int32_t)pData->num;
×
570

571
    pData->num += size;
×
572
  }
573

574
  return 0;
×
575
}
576

577
int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t numOfOutput, size_t keyBufSize,
1,074,011✔
578
                         const char* pKey) {
579
  int32_t code = 0;
1,074,011✔
580
  //  _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
581

582
  pAggSup->currentPageId = -1;
1,074,011✔
583
  pAggSup->resultRowSize = getResultRowSize(pCtx, numOfOutput);
1,074,011✔
584
  pAggSup->keyBuf = taosMemoryCalloc(1, keyBufSize + POINTER_BYTES + sizeof(int64_t));
1,074,398!
585
  pAggSup->pResultRowHashTable = tSimpleHashInit(100, taosFastHash);
1,074,420✔
586

587
  if (pAggSup->keyBuf == NULL || pAggSup->pResultRowHashTable == NULL) {
1,074,162!
588
    return terrno;
×
589
  }
590

591
  uint32_t defaultPgsz = 0;
1,074,225✔
592
  int64_t defaultBufsz = 0;
1,074,225✔
593
  code = getBufferPgSize(pAggSup->resultRowSize, &defaultPgsz, &defaultBufsz);
1,074,225✔
594
  if (code) {
1,074,320!
595
    qError("failed to get buff page size, rowSize:%d", pAggSup->resultRowSize);
×
596
    return code;
×
597
  }
598

599
  if (!osTempSpaceAvailable()) {
1,074,320!
600
    code = TSDB_CODE_NO_DISKSPACE;
×
601
    qError("Init stream agg supporter failed since %s, key:%s, tempDir:%s", tstrerror(code), pKey, tsTempDir);
×
602
    return code;
×
603
  }
604

605
  code = createDiskbasedBuf(&pAggSup->pResultBuf, defaultPgsz, defaultBufsz, pKey, tsTempDir);
1,074,141✔
606
  if (code != TSDB_CODE_SUCCESS) {
1,074,322!
607
    qError("Create agg result buf failed since %s, %s", tstrerror(code), pKey);
×
608
    return code;
×
609
  }
610

611
  return code;
1,074,545✔
612
}
613

614
void cleanupResultInfoInStream(SExecTaskInfo* pTaskInfo, void* pState, SExprSupp* pSup, SGroupResInfo* pGroupResInfo) {
×
615
  int32_t         code = TSDB_CODE_SUCCESS;
×
616
  SStorageAPI*    pAPI = &pTaskInfo->storageAPI;
×
617
  int32_t         numOfExprs = pSup->numOfExprs;
×
618
  int32_t*        rowEntryOffset = pSup->rowEntryInfoOffset;
×
619
  SqlFunctionCtx* pCtx = pSup->pCtx;
×
620
  int32_t         numOfRows = getNumOfTotalRes(pGroupResInfo);
×
621
  bool            needCleanup = false;
×
622

623
  for (int32_t j = 0; j < numOfExprs; ++j) {
×
624
    needCleanup |= pCtx[j].needCleanup;
×
625
  }
626
  if (!needCleanup) {
×
627
    return;
×
628
  }
629
  
630
  for (int32_t i = pGroupResInfo->index; i < numOfRows; i += 1) {
×
631
    SResultWindowInfo* pWinInfo = taosArrayGet(pGroupResInfo->pRows, i);
×
632
    SRowBuffPos*       pPos = pWinInfo->pStatePos;
×
633
    SResultRow*        pRow = NULL;
×
634

635
    code = pAPI->stateStore.streamStateGetByPos(pState, pPos, (void**)&pRow);
×
636
    if (TSDB_CODE_SUCCESS != code) {
×
637
      qError("failed to get state by pos, code:%s, %s", tstrerror(code), GET_TASKID(pTaskInfo));
×
638
      continue;
×
639
    }
640

641
    for (int32_t j = 0; j < numOfExprs; ++j) {
×
642
      pCtx[j].resultInfo = getResultEntryInfo(pRow, j, rowEntryOffset);
×
643
      if (pCtx[j].fpSet.cleanup) {
×
644
        pCtx[j].fpSet.cleanup(&pCtx[j]);
×
645
      }
646
    }
647
  }
648
}
649

650
void cleanupResultInfoInGroupResInfo(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf,
425,482✔
651
                                  SGroupResInfo* pGroupResInfo) {
652
  int32_t         numOfExprs = pSup->numOfExprs;
425,482✔
653
  int32_t*        rowEntryOffset = pSup->rowEntryInfoOffset;
425,482✔
654
  SqlFunctionCtx* pCtx = pSup->pCtx;
425,482✔
655
  int32_t         numOfRows = getNumOfTotalRes(pGroupResInfo);
425,482✔
656
  bool            needCleanup = false;
425,508✔
657

658
  for (int32_t j = 0; j < numOfExprs; ++j) {
1,472,031✔
659
    needCleanup |= pCtx[j].needCleanup;
1,046,523✔
660
  }
661
  if (!needCleanup) {
425,508✔
662
    return;
420,000✔
663
  }
664

665
  for (int32_t i = pGroupResInfo->index; i < numOfRows; i += 1) {
5,508!
666
    SResultRow*        pRow = NULL;
×
667
    SResKeyPos*        pPos = taosArrayGetP(pGroupResInfo->pRows, i);
×
668
    SFilePage*         page = getBufPage(pBuf, pPos->pos.pageId);
×
669
    if (page == NULL) {
×
670
      qError("failed to get buffer, code:%s, %s", tstrerror(terrno), GET_TASKID(pTaskInfo));
×
671
      continue;
×
672
    }
673
    pRow = (SResultRow*)((char*)page + pPos->pos.offset);
×
674

675

676
    for (int32_t j = 0; j < numOfExprs; ++j) {
×
677
      pCtx[j].resultInfo = getResultEntryInfo(pRow, j, rowEntryOffset);
×
678
      if (pCtx[j].fpSet.cleanup) {
×
679
        pCtx[j].fpSet.cleanup(&pCtx[j]);
×
680
      }
681
    }
682
    releaseBufPage(pBuf, page);
×
683
  }
684
}
685

686
void cleanupResultInfoInHashMap(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf,
198,472✔
687
                       SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap) {
688
  int32_t         numOfExprs = pSup->numOfExprs;
198,472✔
689
  int32_t*        rowEntryOffset = pSup->rowEntryInfoOffset;
198,472✔
690
  SqlFunctionCtx* pCtx = pSup->pCtx;
198,472✔
691
  bool            needCleanup = false;
198,472✔
692
  for (int32_t j = 0; j < numOfExprs; ++j) {
590,171✔
693
    needCleanup |= pCtx[j].needCleanup;
391,699✔
694
  }
695
  if (!needCleanup) {
198,472✔
696
    return;
198,453✔
697
  }
698

699
  // begin from last iter
700
  void*   pData = pGroupResInfo->dataPos;
19✔
701
  int32_t iter = pGroupResInfo->iter;
19✔
702
  while ((pData = tSimpleHashIterate(pHashmap, pData, &iter)) != NULL) {
21✔
703
    SResultRowPosition* pos = pData;
2✔
704

705
    SFilePage* page = getBufPage(pBuf, pos->pageId);
2✔
706
    if (page == NULL) {
2!
707
      qError("failed to get buffer, code:%s, %s", tstrerror(terrno), GET_TASKID(pTaskInfo));
×
708
      continue;
×
709
    }
710

711
    SResultRow* pRow = (SResultRow*)((char*)page + pos->offset);
2✔
712

713
    for (int32_t j = 0; j < numOfExprs; ++j) {
42✔
714
      pCtx[j].resultInfo = getResultEntryInfo(pRow, j, rowEntryOffset);
40✔
715
      if (pCtx[j].fpSet.cleanup) {
40✔
716
        pCtx[j].fpSet.cleanup(&pCtx[j]);
4✔
717
      }
718
    }
719

720
    releaseBufPage(pBuf, page);
2✔
721
  }
722
}
723

724
void cleanupResultInfo(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SGroupResInfo* pGroupResInfo,
623,976✔
725
                       SAggSupporter *pAggSup, bool cleanGroupResInfo) {
726
  if (cleanGroupResInfo) {
623,976✔
727
    cleanupResultInfoInGroupResInfo(pTaskInfo, pSup, pAggSup->pResultBuf, pGroupResInfo);
425,524✔
728
  } else {
729
    cleanupResultInfoInHashMap(pTaskInfo, pSup, pAggSup->pResultBuf, pGroupResInfo, pAggSup->pResultRowHashTable);
198,452✔
730
  }
731
}
624,024✔
732
void cleanupAggSup(SAggSupporter* pAggSup) {
1,074,627✔
733
  taosMemoryFreeClear(pAggSup->keyBuf);
1,074,627!
734
  tSimpleHashCleanup(pAggSup->pResultRowHashTable);
1,074,705✔
735
  destroyDiskbasedBuf(pAggSup->pResultBuf);
1,074,775✔
736
  memset(pAggSup, 0, sizeof(SAggSupporter));
1,074,782✔
737
}
1,074,782✔
738

739
int32_t initAggSup(SExprSupp* pSup, SAggSupporter* pAggSup, SExprInfo* pExprInfo, int32_t numOfCols, size_t keyBufSize,
1,074,080✔
740
                   const char* pkey, void* pState, SFunctionStateStore* pStore) {
741
  int32_t code = initExprSupp(pSup, pExprInfo, numOfCols, pStore);
1,074,080✔
742
  if (code != TSDB_CODE_SUCCESS) {
1,074,308!
743
    return code;
×
744
  }
745

746
  code = doInitAggInfoSup(pAggSup, pSup->pCtx, numOfCols, keyBufSize, pkey);
1,074,308✔
747
  if (code != TSDB_CODE_SUCCESS) {
1,074,549!
748
    return code;
×
749
  }
750

751
  for (int32_t i = 0; i < numOfCols; ++i) {
3,600,233✔
752
    pSup->pCtx[i].hasWindowOrGroup = pSup->hasWindowOrGroup;
2,525,684✔
753
    if (pState) {
2,525,684!
754
      pSup->pCtx[i].saveHandle.pBuf = NULL;
×
755
      pSup->pCtx[i].saveHandle.pState = pState;
×
756
      pSup->pCtx[i].exprIdx = i;
×
757
    } else {
758
      pSup->pCtx[i].saveHandle.pBuf = pAggSup->pResultBuf;
2,525,684✔
759
    }
760
  }
761

762
  return TSDB_CODE_SUCCESS;
1,074,549✔
763
}
764

765
int32_t applyAggFunctionOnPartialTuples(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, SColumnInfoData* pTimeWindowData,
53,139,935✔
766
                                        int32_t offset, int32_t forwardStep, int32_t numOfTotal, int32_t numOfOutput) {
767
  int32_t code = TSDB_CODE_SUCCESS, lino = 0;
53,139,935✔
768
  for (int32_t k = 0; k < numOfOutput; ++k) {
285,335,246✔
769
    // keep it temporarily
770
    SFunctionCtxStatus status = {0};
231,931,739✔
771
    functionCtxSave(&pCtx[k], &status);
231,931,739✔
772

773
    pCtx[k].input.startRowIndex = offset;
231,937,289✔
774
    pCtx[k].input.numOfRows = forwardStep;
231,937,289✔
775

776
    // not a whole block involved in query processing, statistics data can not be used
777
    // NOTE: the original value of isSet have been changed here
778
    if (pCtx[k].input.colDataSMAIsSet && forwardStep < numOfTotal) {
231,937,289!
779
      pCtx[k].input.colDataSMAIsSet = false;
×
780
    }
781

782
    if (fmIsPlaceHolderFunc(pCtx[k].functionId)) {
231,937,289!
783
      SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(&pCtx[k]);
×
784
      char* p = GET_ROWCELL_INTERBUF(pEntryInfo);
×
785

786
      TAOS_CHECK_EXIT(fmSetStreamPseudoFuncParamVal(pCtx[k].functionId, pCtx[k].pExpr->base.pParamList, &taskInfo->pStreamRuntimeInfo->funcInfo));
×
787

788
      SValueNode *valueNode = (SValueNode *)nodesListGetNode(pCtx[k].pExpr->base.pParamList, 0);
×
789
      pEntryInfo->isNullRes = 0;
×
790
      if (TSDB_DATA_TYPE_NULL == valueNode->node.resType.type || valueNode->isNull) {
×
791
        pEntryInfo->isNullRes = 1;
×
792
      } else if (IS_VAR_DATA_TYPE(pCtx[k].pExpr->base.resSchema.type)){
×
793
        void* v = nodesGetValueFromNode(valueNode);
×
794
        memcpy(p, v, varDataTLen(v));
×
795
      } else {
796
        memcpy(p, nodesGetValueFromNode(valueNode), pCtx[k].pExpr->base.resSchema.bytes);
×
797
      }
798
      
799
      pEntryInfo->numOfRes = 1;
×
800
    } else if (pCtx[k].isPseudoFunc) {
232,894,346✔
801
      SResultRowEntryInfo* pEntryInfo = GET_RES_INFO(&pCtx[k]);
39,919,381✔
802

803
      char* p = GET_ROWCELL_INTERBUF(pEntryInfo);
39,919,381✔
804

805
      SColumnInfoData idata = {0};
39,919,381✔
806
      idata.info.type = TSDB_DATA_TYPE_BIGINT;
39,919,381✔
807
      idata.info.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
39,919,381✔
808
      idata.pData = p;
39,919,381✔
809

810
      SScalarParam out = {.columnData = &idata};
39,919,381✔
811
      SScalarParam tw = {.numOfRows = 5, .columnData = pTimeWindowData};
39,919,381✔
812
      TAOS_CHECK_EXIT(pCtx[k].sfp.process(&tw, 1, &out));
39,919,381!
813
      pEntryInfo->isNullRes = colDataIsNull_s(&idata, 0);
40,442,986✔
814
      pEntryInfo->numOfRes = 1;
40,442,986✔
815
    } else {
816
      if (functionNeedToExecute(&pCtx[k]) && pCtx[k].fpSet.process != NULL) {
192,974,965✔
817
        if ((&pCtx[k])->input.pData[0] == NULL) {
154,625,538!
818
          code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
×
819
          qError("%s apply functions error, input data is NULL.", GET_TASKID(taskInfo));
×
820
        } else {
821
          code = pCtx[k].fpSet.process(&pCtx[k]);
154,625,538✔
822
        }
823

824
        if (code != TSDB_CODE_SUCCESS) {
154,710,225✔
825
          if (pCtx[k].fpSet.cleanup != NULL) {
2!
826
            pCtx[k].fpSet.cleanup(&pCtx[k]);
2✔
827
          }
828
          TAOS_CHECK_EXIT(code);
2!
829
        }
830
      }
831

832
      // restore it
833
      functionCtxRestore(&pCtx[k], &status);
192,858,618✔
834
    }
835
  }
836

837
_exit:
53,403,507✔
838

839
  if (code) {
53,403,509✔
840
    qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
2!
841
    taskInfo->code = code;
2✔
842
  }
843

844
  return code;
53,403,509✔
845
}
846

847
void functionCtxSave(SqlFunctionCtx* pCtx, SFunctionCtxStatus* pStatus) {
231,881,933✔
848
  pStatus->hasAgg = pCtx->input.colDataSMAIsSet;
231,881,933✔
849
  pStatus->numOfRows = pCtx->input.numOfRows;
231,881,933✔
850
  pStatus->startOffset = pCtx->input.startRowIndex;
231,881,933✔
851
}
231,881,933✔
852

853
void functionCtxRestore(SqlFunctionCtx* pCtx, SFunctionCtxStatus* pStatus) {
192,685,235✔
854
  pCtx->input.colDataSMAIsSet = pStatus->hasAgg;
192,685,235✔
855
  pCtx->input.numOfRows = pStatus->numOfRows;
192,685,235✔
856
  pCtx->input.startRowIndex = pStatus->startOffset;
192,685,235✔
857
}
192,685,235✔
858

859
static int32_t resetAggregateOperatorState(SOperatorInfo* pOper) {
×
860
  SAggOperatorInfo* pAgg = pOper->info;
×
861
  SAggPhysiNode*   pAggNode = (SAggPhysiNode*)pOper->pPhyNode;
×
862
  
863
  pOper->status = OP_NOT_OPENED;
×
864
  size_t keyBufSize = sizeof(int64_t) + sizeof(int64_t) + POINTER_BYTES;
×
865
  SExecTaskInfo*  pTaskInfo = pOper->pTaskInfo;
×
866
  cleanupResultInfo(pTaskInfo, &pOper->exprSupp, &pAgg->groupResInfo, &pAgg->aggSup,
×
867
                      pAgg->cleanGroupResInfo);
×
868
  cleanupGroupResInfo(&pAgg->groupResInfo);
×
869
  resetBasicOperatorState(&pAgg->binfo);
×
870
  
871
  int32_t code = resetAggSup(&pOper->exprSupp, &pAgg->aggSup, pTaskInfo, pAggNode->pAggFuncs, pAggNode->pGroupKeys,
×
872
    keyBufSize, pTaskInfo->id.str, pTaskInfo->streamInfo.pState, &pTaskInfo->storageAPI.functionStore);
×
873

874
  if (code == 0) {
×
875
    code = resetExprSupp(&pAgg->scalarExprSup, pTaskInfo, pAggNode->pExprs, NULL,
×
876
                          &pTaskInfo->storageAPI.functionStore);
877
  }
878

879
  pAgg->groupId = UINT64_MAX;
×
880
  pAgg->cleanGroupResInfo = false;
×
881
  pAgg->hasValidBlock = false;
×
882
  return 0;
×
883
}
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