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

taosdata / TDengine / #4848

12 Nov 2025 01:06AM UTC coverage: 63.27% (+0.6%) from 62.651%
#4848

push

travis-ci

web-flow
Merge f12882a7a into e27395247

33 of 36 new or added lines in 4 files covered. (91.67%)

2652 existing lines in 104 files now uncovered.

138980 of 219661 relevant lines covered (63.27%)

110230098.27 hits per line

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

91.67
/source/libs/executor/inc/executorInt.h
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
#ifndef TDENGINE_EXECUTORINT_H
16
#define TDENGINE_EXECUTORINT_H
17

18
#ifdef __cplusplus
19
extern "C" {
20
#endif
21

22
#include "os.h"
23
#include "tcommon.h"
24
#include "theap.h"
25
#include "tlosertree.h"
26
#include "tsort.h"
27
#include "tvariant.h"
28

29
#include "dataSinkMgt.h"
30
#include "executil.h"
31
#include "executor.h"
32
#include "planner.h"
33
#include "scalar.h"
34
#include "taosdef.h"
35
#include "tarray.h"
36
#include "tfill.h"
37
#include "thash.h"
38
#include "tlockfree.h"
39
#include "tmsg.h"
40
#include "tpagedbuf.h"
41
#include "tlrucache.h"
42
#include "tworker.h"
43

44
typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int32_t order);
45

46
typedef struct STsdbReader STsdbReader;
47
typedef struct STqReader   STqReader;
48

49
typedef enum SOperatorParamType { OP_GET_PARAM = 1, OP_NOTIFY_PARAM } SOperatorParamType;
50

51
typedef enum EExtWinMode {
52
  EEXT_MODE_SCALAR = 1,
53
  EEXT_MODE_AGG,
54
  EEXT_MODE_INDEFR_FUNC,
55
} EExtWinMode;
56

57
#define IS_VALID_SESSION_WIN(winInfo)        ((winInfo).sessionWin.win.skey > 0)
58
#define SET_SESSION_WIN_INVALID(winInfo)     ((winInfo).sessionWin.win.skey = INT64_MIN)
59
#define IS_INVALID_SESSION_WIN_KEY(winKey)   ((winKey).win.skey <= 0)
60
#define SET_SESSION_WIN_KEY_INVALID(pWinKey) ((pWinKey)->win.skey = INT64_MIN)
61

62
#define IS_STREAM_MODE(_task) ((_task)->execModel == OPTR_EXEC_MODEL_STREAM)
63

64
/**
65
 * If the number of generated results is greater than this value,
66
 * query query will be halt and return results to client immediate.
67
 */
68
typedef struct SResultInfo {  // TODO refactor
69
  int64_t totalRows;          // total generated result size in rows
70
  int64_t totalBytes;         // total results in bytes.
71
  int32_t capacity;           // capacity of current result output buffer
72
  int32_t threshold;          // result size threshold in rows.
73
} SResultInfo;
74

75
typedef struct STableQueryInfo {
76
  TSKEY              lastKey;  // last check ts, todo remove it later
77
  SResultRowPosition pos;      // current active time window
78
} STableQueryInfo;
79

80
typedef struct SLimit {
81
  int64_t limit;
82
  int64_t offset;
83
} SLimit;
84

85
typedef struct STableScanAnalyzeInfo SFileBlockLoadRecorder;
86

87
enum {
88
  STREAM_RECOVER_STEP__NONE = 0,
89
  STREAM_RECOVER_STEP__PREPARE1,
90
  STREAM_RECOVER_STEP__PREPARE2,
91
  STREAM_RECOVER_STEP__SCAN1,
92
};
93

94
extern int32_t exchangeObjRefPool;
95

96
typedef struct {
97
  char*   pData;
98
  bool    isNull;
99
  int16_t type;
100
  int32_t bytes;
101
} SGroupKeys, SStateKeys;
102

103
typedef struct {
104
  char*           tablename;
105
  char*           dbname;
106
  int32_t         tversion;
107
  int32_t         rversion;
108
  SSchemaWrapper* sw;
109
  SSchemaWrapper* qsw;
110
} SSchemaInfo;
111

112
typedef struct SExchangeOpStopInfo {
113
  int32_t operatorType;
114
  int64_t refId;
115
} SExchangeOpStopInfo;
116

117
typedef struct SGcOperatorParam {
118
  int64_t sessionId;
119
  int32_t downstreamIdx;
120
  int32_t vgId;
121
  int64_t tbUid;
122
  bool    needCache;
123
} SGcOperatorParam;
124

125
typedef struct SGcNotifyOperatorParam {
126
  int32_t downstreamIdx;
127
  int32_t vgId;
128
  int64_t tbUid;
129
} SGcNotifyOperatorParam;
130

131
struct SExprSupp {
132
  SExprInfo*      pExprInfo;
133
  int32_t         numOfExprs;  // the number of scalar expression in group operator
134
  SqlFunctionCtx* pCtx;
135
  int32_t*        rowEntryInfoOffset;  // offset value for each row result cell info
136
  SFilterInfo*    pFilterInfo;
137
  bool            hasWindowOrGroup;
138
  bool            hasIndefRowsFunc;
139
};
140

141
typedef enum {
142
  EX_SOURCE_DATA_NOT_READY = 0x1,
143
  EX_SOURCE_DATA_STARTED,
144
  EX_SOURCE_DATA_READY,
145
  EX_SOURCE_DATA_EXHAUSTED,
146
} EX_SOURCE_STATUS;
147

148
#define COL_MATCH_FROM_COL_ID  0x1
149
#define COL_MATCH_FROM_SLOT_ID 0x2
150

151
typedef struct SLoadRemoteDataInfo {
152
  uint64_t totalSize;     // total load bytes from remote
153
  uint64_t totalRows;     // total number of rows
154
  uint64_t totalElapsed;  // total elapsed time
155
} SLoadRemoteDataInfo;
156

157
typedef struct SLimitInfo {
158
  SLimit   limit;
159
  SLimit   slimit;
160
  uint64_t currentGroupId;
161
  int64_t  remainGroupOffset;
162
  int64_t  numOfOutputGroups;
163
  int64_t  remainOffset;
164
  int64_t  numOfOutputRows;
165
} SLimitInfo;
166

167
typedef struct SSortMergeJoinOperatorParam {
168
  bool initDownstream;
169
} SSortMergeJoinOperatorParam;
170

171
typedef struct SExchangeOperatorBasicParam {
172
  int32_t               vgId;
173
  int32_t               srcOpType;
174
  int32_t               version;
175
  bool                  tableSeq;
176
  SArray*               uidList;
177
  bool                  isVtbRefScan;
178
  bool                  isVtbTagScan;
179
  bool                  isVtbSysScan;
180
  bool                  isNewDeployed; // used with newDeployedSrc
181
  bool                  isVSuperTable;
182
  SOrgTbInfo*           colMap;
183
  STimeWindow           window;
184
  SDownstreamSourceNode newDeployedSrc; // used with isNewDeployed
185
} SExchangeOperatorBasicParam;
186

187
typedef struct SExchangeOperatorBatchParam {
188
  bool       multiParams;
189
  SSHashObj* pBatchs;  // SExchangeOperatorBasicParam
190
} SExchangeOperatorBatchParam;
191

192
typedef struct SExchangeOperatorParam {
193
  bool                        multiParams;
194
  SExchangeOperatorBasicParam basic;
195
} SExchangeOperatorParam;
196

197
typedef struct SExchangeSrcIndex {
198
  int32_t srcIdx;
199
  int32_t inUseIdx;
200
} SExchangeSrcIndex;
201

202
typedef struct SExchangeInfo {
203
  int64_t    seqId;
204
  SArray*    pSources;
205
  SSHashObj* pHashSources;
206
  SArray*    pSourceDataInfo;
207
  tsem_t     ready;
208
  void*      pTransporter;
209

210
  // SArray<SSDataBlock*>, result block list, used to keep the multi-block that
211
  // passed by downstream operator
212
  SArray*      pResultBlockList;
213
  SArray*      pRecycledBlocks;  // build a pool for small data block to avoid to repeatly create and then destroy.
214
  SSDataBlock* pDummyBlock;      // dummy block, not keep data
215
  bool         seqLoadData;      // sequential load data or not, false by default
216
  bool         dynamicOp;
217
  bool         dynTbname;         // %%tbname for stream    
218
  int32_t      current;
219
  SLoadRemoteDataInfo loadInfo;
220
  uint64_t            self;
221
  SLimitInfo          limitInfo;
222
  int64_t             openedTs;  // start exec time stamp, todo: move to SLoadRemoteDataInfo
223
  char*               pTaskId;
224
  SArray*             pFetchRpcHandles;
225
} SExchangeInfo;
226

227
typedef struct SScanInfo {
228
  int32_t numOfAsc;
229
  int32_t numOfDesc;
230
} SScanInfo;
231

232
typedef struct SSampleExecInfo {
233
  double   sampleRatio;  // data block sample ratio, 1 by default
234
  uint32_t seed;         // random seed value
235
} SSampleExecInfo;
236

237
enum {
238
  TABLE_SCAN__TABLE_ORDER = 1,
239
  TABLE_SCAN__BLOCK_ORDER = 2,
240
};
241

242
typedef enum ETableCountState {
243
  TABLE_COUNT_STATE_NONE = 0,       // before start scan
244
  TABLE_COUNT_STATE_SCAN = 1,       // cur group scanning
245
  TABLE_COUNT_STATE_PROCESSED = 2,  // cur group processed
246
  TABLE_COUNT_STATE_END = 3,        // finish or noneed to process
247
} ETableCountState;
248

249
struct SAggSupporter {
250
  SSHashObj*     pResultRowHashTable;  // quick locate the window object for each result
251
  char*          keyBuf;               // window key buffer
252
  SDiskbasedBuf* pResultBuf;           // query result buffer based on blocked-wised disk file
253
  int32_t        resultRowSize;  // the result buffer size for each result row, with the meta data size for each row
254
  int32_t        currentPageId;  // current write page id
255
};
256

257
typedef struct {
258
  // if the upstream is an interval operator, the interval info is also kept here to get the time window to check if
259
  // current data block needs to be loaded.
260
  SInterval      interval;
261
  SAggSupporter* pAggSup;
262
  SExprSupp*     pExprSup;  // expr supporter of aggregate operator
263
} SAggOptrPushDownInfo;
264

265
typedef struct STableMetaCacheInfo {
266
  SLRUCache* pTableMetaEntryCache;  // 100 by default
267
  uint64_t   metaFetch;
268
  uint64_t   cacheHit;
269
} STableMetaCacheInfo;
270

271
typedef struct STableScanBase {
272
  STsdbReader*           dataReader;
273
  SFileBlockLoadRecorder readRecorder;
274
  SQueryTableDataCond    cond;
275
  SQueryTableDataCond    orgCond; // use for virtual super table scan
276
  SAggOptrPushDownInfo   pdInfo;
277
  SColMatchInfo          matchInfo;
278
  SReadHandle            readHandle;
279
  SExprSupp              pseudoSup;
280
  STableMetaCacheInfo    metaCache;
281
  int32_t                scanFlag;  // table scan flag to denote if it is a repeat/reverse/main scan
282
  int32_t                dataBlockLoadFlag;
283
  SLimitInfo             limitInfo;
284
  // there are more than one table list exists in one task, if only one vnode exists.
285
  STableListInfo* pTableListInfo;
286
  TsdReader       readerAPI;
287
} STableScanBase;
288

289
typedef struct STableScanInfo {
290
  STableScanBase  base;
291
  SScanInfo       scanInfo;
292
  int32_t         scanTimes;
293
  SSDataBlock*    pResBlock;
294
  SHashObj*       pIgnoreTables;
295
  SSampleExecInfo sample;           // sample execution info
296
  int32_t         tableStartIndex;  // current group scan start
297
  int32_t         tableEndIndex;    // current group scan end
298
  int32_t         currentGroupId;
299
  int32_t         currentTable;
300
  int8_t          scanMode;
301
  int8_t          assignBlockUid;
302
  uint8_t         countState;  // empty table count state
303
  bool            hasGroupByTag;
304
  bool            filesetDelimited;
305
  bool            needCountEmptyTable;
306
  SSDataBlock*    pOrgBlock;
307
  bool            ignoreTag;
308
  bool            virtualStableScan;
309
  SHashObj*       readerCache;
310
  bool            newReader;
311
} STableScanInfo;
312

313
typedef enum ESubTableInputType {
314
  SUB_TABLE_MEM_BLOCK,
315
  SUB_TABLE_EXT_PAGES,
316
} ESubTableInputType;
317

318
typedef struct STmsSubTableInput {
319
  STsdbReader*        pReader;
320
  SQueryTableDataCond tblCond;
321
  STableKeyInfo*      pKeyInfo;
322
  bool                bInMemReader;
323
  ESubTableInputType  type;
324
  SSDataBlock*        pReaderBlock;
325

326
  SArray*      aBlockPages;
327
  SSDataBlock* pPageBlock;
328
  int32_t      pageIdx;
329

330
  int32_t      rowIdx;
331
  int64_t*     aTs;
332
  SSDataBlock* pInputBlock;
333
} STmsSubTableInput;
334

335
typedef struct SBlockOrderInfo SBlockOrderInfo;
336
typedef struct STmsSubTablesMergeInfo {
337
  SBlockOrderInfo* pTsOrderInfo;
338
  SBlockOrderInfo* pPkOrderInfo;
339

340
  int32_t                 numSubTables;
341
  STmsSubTableInput*      aInputs;
342
  SMultiwayMergeTreeInfo* pTree;
343
  int32_t                 numSubTablesCompleted;
344

345
  int32_t        numTableBlocksInMem;
346
  SDiskbasedBuf* pBlocksBuf;
347

348
  int32_t numInMemReaders;
349
} STmsSubTablesMergeInfo;
350

351
typedef struct STableMergeScanInfo {
352
  int32_t         tableStartIndex;
353
  int32_t         tableEndIndex;
354
  bool            hasGroupId;
355
  uint64_t        groupId;
356
  STableScanBase  base;
357
  int32_t         bufPageSize;
358
  uint32_t        sortBufSize;  // max buffer size for in-memory sort
359
  SArray*         pSortInfo;
360
  SSortHandle*    pSortHandle;
361
  SSDataBlock*    pSortInputBlock;
362
  SSDataBlock*    pReaderBlock;
363
  int64_t         startTs;  // sort start time
364
  SLimitInfo      limitInfo;
365
  int64_t         numOfRows;
366
  SScanInfo       scanInfo;
367
  int32_t         scanTimes;
368
  int32_t         readIdx;
369
  SSDataBlock*    pResBlock;
370
  SSampleExecInfo sample;         // sample execution info
371
  SSHashObj*      mTableNumRows;  // uid->num of table rows
372
  SHashObj*       mSkipTables;
373
  int64_t         mergeLimit;
374
  SSortExecInfo   sortExecInfo;
375
  bool            needCountEmptyTable;
376
  bool            bGroupProcessed;  // the group return data means processed
377
  bool            filesetDelimited;
378
  bool            bNewFilesetEvent;
379
  bool            bNextDurationBlockEvent;
380
  int32_t         numNextDurationBlocks;
381
  SSDataBlock*    nextDurationBlocks[2];
382
  bool            rtnNextDurationBlocks;
383
  int32_t         nextDurationBlocksIdx;
384
  bool            bSortRowId;
385

386
  STmsSubTablesMergeInfo* pSubTablesMergeInfo;
387
} STableMergeScanInfo;
388

389
typedef struct STagScanFilterContext {
390
  SHashObj* colHash;
391
  int32_t   index;
392
  SArray*   cInfoList;
393
  int32_t   code;
394
} STagScanFilterContext;
395

396
typedef struct STagScanInfo {
397
  SColumnInfo*          pCols;
398
  SSDataBlock*          pRes;
399
  SColMatchInfo         matchInfo;
400
  int32_t               curPos;
401
  SReadHandle           readHandle;
402
  STableListInfo*       pTableListInfo;
403
  uint64_t              suid;
404
  void*                 pCtbCursor;
405
  SNode*                pTagCond;
406
  SNode*                pTagIndexCond;
407
  STagScanFilterContext filterCtx;
408
  SArray*               aUidTags;     // SArray<STUidTagInfo>
409
  SArray*               aFilterIdxs;  // SArray<int32_t>
410
  SStorageAPI*          pStorageAPI;
411
  SLimitInfo            limitInfo;
412
} STagScanInfo;
413

414
typedef enum EStreamScanMode {
415
  STREAM_SCAN_FROM_READERHANDLE = 1,
416
  STREAM_SCAN_FROM_RES,
417
  STREAM_SCAN_FROM_UPDATERES,
418
  STREAM_SCAN_FROM_DELETE_DATA,
419
  STREAM_SCAN_FROM_DATAREADER_RETRIEVE,
420
  STREAM_SCAN_FROM_DATAREADER_RANGE,
421
  STREAM_SCAN_FROM_CREATE_TABLERES,
422
} EStreamScanMode;
423

424
enum {
425
  PROJECT_RETRIEVE_CONTINUE = 0x1,
426
  PROJECT_RETRIEVE_DONE = 0x2,
427
};
428

429
typedef struct SStreamAggSupporter {
430
  int32_t         resultRowSize;  // the result buffer size for each result row, with the meta data size for each row
431
  SSDataBlock*    pScanBlock;
432
  SStreamState*   pState;
433
  int64_t         gap;        // stream session window gap
434
  SqlFunctionCtx* pDummyCtx;  // for combine
435
  SSHashObj*      pResultRows;
436
  int32_t         stateKeySize;
437
  int16_t         stateKeyType;
438
  SDiskbasedBuf*  pResultBuf;
439
  SStateStore     stateStore;
440
  STimeWindow     winRange;
441
  SStorageAPI*    pSessionAPI;
442
  struct SUpdateInfo* pUpdateInfo;
443
  int32_t             windowCount;
444
  int32_t             windowSliding;
445
  SStreamStateCur*    pCur;
446
} SStreamAggSupporter;
447

448
typedef struct SWindowSupporter {
449
  SStreamAggSupporter* pStreamAggSup;
450
  int64_t              gap;
451
  uint16_t             parentType;
452
  SAggSupporter*       pIntervalAggSup;
453
} SWindowSupporter;
454

455
typedef struct SPartitionBySupporter {
456
  SArray* pGroupCols;     // group by columns, SArray<SColumn>
457
  SArray* pGroupColVals;  // current group column values, SArray<SGroupKeys>
458
  char*   keyBuf;         // group by keys for hash
459
  bool    needCalc;       // partition by column
460
} SPartitionBySupporter;
461

462
typedef struct SPartitionDataInfo {
463
  uint64_t groupId;
464
  char*    tbname;
465
  SArray*  rowIds;
466
} SPartitionDataInfo;
467

468
typedef struct STimeWindowAggSupp {
469
  int8_t          calTrigger;
470
  int8_t          calTriggerSaved;
471
  int64_t         deleteMark;
472
  int64_t         deleteMarkSaved;
473
  int64_t         waterMark;
474
  TSKEY           maxTs;
475
  TSKEY           minTs;
476
  SColumnInfoData timeWindowData;  // query time window info for scalar function execution.
477
} STimeWindowAggSupp;
478

479
typedef struct SStreamNotifyEventSupp {
480
  SHashObj*    pWindowEventHashMap;  // Hash map from gorupid+skey+eventType to the list node of window event.
481
  SHashObj*    pTableNameHashMap;    // Hash map from groupid to the dest child table name.
482
  SSDataBlock* pEventBlock;          // The datablock contains all window events and results.
483
  SArray*      pSessionKeys;
484
  const char*  windowType;
485
} SStreamNotifyEventSupp;
486

487
typedef struct SSteamOpBasicInfo {
488
  int32_t                primaryPkIndex;
489
  int16_t                operatorFlag;
490
  SStreamNotifyEventSupp notifyEventSup;
491
  bool                   recvCkBlock;
492
  SSDataBlock*           pCheckpointRes;
493
  SSHashObj*             pSeDeleted;
494
  void*                  pDelIterator;
495
  SSDataBlock*           pDelRes;
496
  SArray*                pUpdated;
497
  STableTsDataState*     pTsDataState;
498
  int32_t                numOfRecv;
499
} SSteamOpBasicInfo;
500

501
typedef struct SStreamFillSupporter {
502
  int32_t        type;  // fill type
503
  SInterval      interval;
504
  SResultRowData prev;
505
  TSKEY          prevOriginKey;
506
  SResultRowData cur;
507
  SResultRowData next;
508
  TSKEY          nextOriginKey;
509
  SResultRowData nextNext;
510
  SFillColInfo*  pAllColInfo;  // fill exprs and not fill exprs
511
  SExprSupp      notFillExprSup;
512
  int32_t        numOfAllCols;  // number of all exprs, including the tags columns
513
  int32_t        numOfFillCols;
514
  int32_t        numOfNotFillCols;
515
  int32_t        rowSize;
516
  SSHashObj*     pResMap;
517
  bool           hasDelete;
518
  SStorageAPI*   pAPI;
519
  STimeWindow    winRange;
520
  int32_t        pkColBytes;
521
  __compar_fn_t  comparePkColFn;
522
  int32_t*       pOffsetInfo;
523
  bool           normalFill;
524
  void*          pEmptyRow;
525
  SArray*        pResultRange;
526
} SStreamFillSupporter;
527

528
typedef struct SStreamScanInfo {
529
  SSteamOpBasicInfo basic;
530
  SExprInfo*        pPseudoExpr;
531
  int32_t           numOfPseudoExpr;
532
  SExprSupp         tbnameCalSup;
533
  SExprSupp*        pPartTbnameSup;
534
  SExprSupp         tagCalSup;
535
  int32_t           primaryTsIndex;  // primary time stamp slot id
536
  int32_t           primaryKeyIndex;
537
  SReadHandle       readHandle;
538
  SInterval         interval;  // if the upstream is an interval operator, the interval info is also kept here.
539
  SColMatchInfo     matchInfo;
540

541
  SArray*      pBlockLists;  // multiple SSDatablock.
542
  SSDataBlock* pRes;         // result SSDataBlock
543
  SSDataBlock* pUpdateRes;   // update SSDataBlock
544
  int32_t      updateResIndex;
545
  int32_t      blockType;        // current block type
546
  int32_t      validBlockIndex;  // Is current data has returned?
547
  uint64_t     numOfExec;        // execution times
548
  STqReader*   tqReader;
549

550
  SHashObj*       pVtableMergeHandles;  // key: vtable uid, value: SStreamVtableMergeHandle
551
  SDiskbasedBuf*  pVtableMergeBuf;      // page buffer used by vtable merge
552
  SArray*         pVtableReadyHandles;
553
  STableListInfo* pTableListInfo;
554

555
  uint64_t            groupId;
556
  bool                igCheckGroupId;
557
  struct SUpdateInfo* pUpdateInfo;
558

559
  EStreamScanMode       scanMode;
560
  struct SOperatorInfo* pStreamScanOp;
561
  struct SOperatorInfo* pTableScanOp;
562
  SArray*               childIds;
563
  SWindowSupporter      windowSup;
564
  SPartitionBySupporter partitionSup;
565
  SExprSupp*            pPartScalarSup;
566
  bool                  assignBlockUid;  // assign block uid to groupId, temporarily used for generating rollup SMA.
567
  int32_t               scanWinIndex;    // for state operator
568
  SSDataBlock*          pDeleteDataRes;  // delete data SSDataBlock
569
  int32_t               deleteDataIndex;
570
  STimeWindow           updateWin;
571
  STimeWindowAggSupp    twAggSup;
572
  SSDataBlock*          pUpdateDataRes;
573
  SStreamFillSupporter* pFillSup;
574
  // status for tmq
575
  SNodeList* pGroupTags;
576
  SNode*     pTagCond;
577
  SNode*     pTagIndexCond;
578

579
  // recover
580
  int32_t      blockRecoverTotCnt;
581
  SSDataBlock* pRecoverRes;
582

583
  SSDataBlock*      pCreateTbRes;
584
  int8_t            igCheckUpdate;
585
  int8_t            igExpired;
586
  void*             pState;  // void
587
  SStoreTqReader    readerFn;
588
  SStateStore       stateStore;
589
  SSDataBlock*      pCheckpointRes;
590
  int8_t            pkColType;
591
  int32_t           pkColLen;
592
  bool              useGetResultRange;
593
  STimeWindow       lastScanRange;
594
  SSDataBlock*      pRangeScanRes;  // update SSDataBlock
595
  bool              hasPart;
596

597
  //nonblock data scan
598
  TSKEY                  recalculateInterval;
599
  __compar_fn_t          comparePkColFn;
600
  SScanRange             curRange;
601
  struct SOperatorInfo*  pRecTableScanOp;
602
  bool                   scanAllTables;
603
  SSHashObj*             pRecRangeMap;
604
  SArray*                pRecRangeRes;
605
} SStreamScanInfo;
606

607
typedef struct {
608
  struct SVnode*       vnode;  // todo remove this
609
  SSDataBlock          pRes;   // result SSDataBlock
610
  STsdbReader*         dataReader;
611
  struct SSnapContext* sContext;
612
  SStorageAPI*         pAPI;
613
  STableListInfo*      pTableListInfo;
614
} SStreamRawScanInfo;
615

616
typedef struct STableCountScanSupp {
617
  int16_t dbNameSlotId;
618
  int16_t stbNameSlotId;
619
  int16_t tbCountSlotId;
620
  bool    groupByDbName;
621
  bool    groupByStbName;
622
  char    dbNameFilter[TSDB_DB_NAME_LEN];
623
  char    stbNameFilter[TSDB_TABLE_NAME_LEN];
624
} STableCountScanSupp;
625

626
typedef struct SOptrBasicInfo {
627
  SResultRowInfo resultRowInfo;
628
  SSDataBlock*   pRes;
629
  bool           mergeResultBlock;
630
  int32_t        inputTsOrder;
631
  int32_t        outputTsOrder;
632
} SOptrBasicInfo;
633

634
typedef struct SIntervalAggOperatorInfo {
635
  SOptrBasicInfo     binfo;              // basic info
636
  SAggSupporter      aggSup;             // aggregate supporter
637
  SExprSupp          scalarSupp;         // supporter for perform scalar function
638
  SGroupResInfo      groupResInfo;       // multiple results build supporter
639
  SInterval          interval;           // interval info
640
  int32_t            primaryTsIndex;     // primary time stamp slot id from result of downstream operator.
641
  STimeWindow        win;                // query time range
642
  bool               timeWindowInterpo;  // interpolation needed or not
643
  SArray*            pInterpCols;        // interpolation columns
644
  EOPTR_EXEC_MODEL   execModel;          // operator execution model [batch model|stream model]
645
  STimeWindowAggSupp twAggSup;
646
  SArray*            pPrevValues;  //  SArray<SGroupKeys> used to keep the previous not null value for interpolation.
647
  bool               cleanGroupResInfo;
648
  struct SOperatorInfo* pOperator;
649
  // for limit optimization
650
  bool          limited;
651
  int64_t       limit;
652
  bool          slimited;
653
  int64_t       slimit;
654
  uint64_t      curGroupId;  // initialize to UINT64_MAX
655
  uint64_t      handledGroupNum;
656
  BoundedQueue* pBQ;
657
} SIntervalAggOperatorInfo;
658

659
typedef struct SMergeAlignedIntervalAggOperatorInfo {
660
  SIntervalAggOperatorInfo* intervalAggOperatorInfo;
661

662
  uint64_t     groupId;  // current groupId
663
  int64_t      curTs;    // current ts
664
  SSDataBlock* prefetchedBlock;
665
  SResultRow*  pResultRow;
666
} SMergeAlignedIntervalAggOperatorInfo;
667

668
typedef struct SOpCheckPointInfo {
669
  uint16_t  checkPointId;
670
  SHashObj* children;  // key:child id
671
} SOpCheckPointInfo;
672

673
typedef struct SDataGroupInfo {
674
  uint64_t groupId;
675
  int64_t  numOfRows;
676
  SArray*  pPageList;
677
  SArray*  blockForNotLoaded;   // SSDataBlock that data is not loaded
678
  int32_t  offsetForNotLoaded;  // read offset for SSDataBlock that data is not loaded
679
} SDataGroupInfo;
680

681
typedef struct SWindowRowsSup {
682
  STimeWindow win;
683
  TSKEY       prevTs;
684
  int32_t     startRowIndex;
685
  int32_t     numOfRows;
686
  uint64_t    groupId;
687
  uint32_t    numNullRows;  // number of continuous rows with null state col
688
} SWindowRowsSup;
689

2,147,483,647✔
690
// return true if there are continuous rows with null state col
2,147,483,647✔
691
// state window operator needs to handle these rows specially
692
static inline bool hasContinuousNullRows(SWindowRowsSup* pRowSup) {
693
  return pRowSup->numNullRows > 0;
694
}
1,163,412,540✔
695

1,163,412,540✔
696
// reset on initialization or found of a row with non-null state col
1,163,412,540✔
697
static inline void resetNumNullRows(SWindowRowsSup* pRowSup) {
698
  pRowSup->numNullRows = 0;
30,653✔
699
}
30,653✔
UNCOV
700

×
701
static inline void resetWindowRowsSup(SWindowRowsSup* pRowSup) {
702
  if (NULL == pRowSup) {
703
    return;
30,653✔
704
  }
30,653✔
705

30,653✔
706
  pRowSup->win.skey = pRowSup->win.ekey = 0;
30,653✔
707
  pRowSup->prevTs = pRowSup->startRowIndex = 0;
708
  pRowSup->numOfRows = pRowSup->groupId = 0;
709
  resetNumNullRows(pRowSup);
710
}
711

712
typedef int32_t (*AggImplFn)(struct SOperatorInfo* pOperator, SSDataBlock* pBlock);
713

714
typedef struct SSessionAggOperatorInfo {
715
  SOptrBasicInfo        binfo;
716
  SAggSupporter         aggSup;
717
  SExprSupp             scalarSupp;  // supporter for perform scalar function
718
  SGroupResInfo         groupResInfo;
719
  SWindowRowsSup        winSup;
720
  bool                  reptScan;  // next round scan
721
  int64_t               gap;       // session window gap
722
  int32_t               tsSlotId;  // primary timestamp slot id
723
  STimeWindowAggSupp    twAggSup;
724
  struct SOperatorInfo* pOperator;
725
  bool                  cleanGroupResInfo;
726
} SSessionAggOperatorInfo;
727

728
typedef struct SStateWindowOperatorInfo {
729
  SOptrBasicInfo        binfo;
730
  SAggSupporter         aggSup;
731
  SExprSupp             scalarSup;
732
  SGroupResInfo         groupResInfo;
733
  SWindowRowsSup        winSup;
734
  SColumn               stateCol;
735
  bool                  hasKey;
736
  SStateKeys            stateKey;
737
  int32_t               tsSlotId;  // primary timestamp column slot id
738
  STimeWindowAggSupp    twAggSup;
739
  struct SOperatorInfo* pOperator;
740
  bool                  cleanGroupResInfo;
741
  int64_t               trueForLimit;
742
  EStateWinExtendOption extendOption;
743
} SStateWindowOperatorInfo;
744

745

746
typedef struct SEventWindowOperatorInfo {
747
  SOptrBasicInfo     binfo;
748
  SAggSupporter      aggSup;
749
  SExprSupp          scalarSup;
750
  SWindowRowsSup     winSup;
751
  int32_t            tsSlotId;  // primary timestamp column slot id
752
  STimeWindowAggSupp twAggSup;
753
  uint64_t           groupId;  // current group id, used to identify the data block from different groups
754
  SFilterInfo*       pStartCondInfo;
755
  SFilterInfo*       pEndCondInfo;
756
  bool               inWindow;
757
  SResultRow*        pRow;
758
  SSDataBlock*       pPreDataBlock;
759
  struct SOperatorInfo*     pOperator;
760
  int64_t            trueForLimit;
761
} SEventWindowOperatorInfo;
762

763
#define OPTR_IS_OPENED(_optr)  (((_optr)->status & OP_OPENED) == OP_OPENED)
764
#define OPTR_SET_OPENED(_optr) ((_optr)->status |= OP_OPENED)
765
#define OPTR_CLR_OPENED(_optr) ((_optr)->status &= ~OP_OPENED)
766

767
SSchemaWrapper* extractQueriedColumnSchema(SScanPhysiNode* pScanNode);
768

769
int32_t initQueriedTableSchemaInfo(SReadHandle* pHandle, SScanPhysiNode* pScanNode, const char* dbName,
770
                                   SExecTaskInfo* pTaskInfo);
771
void    cleanupQueriedTableScanInfo(void* p);
772

773
void initBasicInfo(SOptrBasicInfo* pInfo, SSDataBlock* pBlock);
774
void cleanupBasicInfo(SOptrBasicInfo* pInfo);
775

776
int32_t initExprSupp(SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfExpr, SFunctionStateStore* pStore);
777
void checkIndefRowsFuncs(SExprSupp* pSup);
778
void    cleanupExprSupp(SExprSupp* pSup);
779
void    cleanupExprSuppWithoutFilter(SExprSupp* pSupp);
780

781
void     cleanupResultInfoInStream(SExecTaskInfo* pTaskInfo, void* pState, SExprSupp* pSup,
782
                                   SGroupResInfo* pGroupResInfo);
783
void     cleanupResultInfoInHashMap(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf,
784
                                    SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap);
785
void     cleanupResultInfo(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SGroupResInfo* pGroupResInfo,
786
                           SAggSupporter *pAggSup, bool cleanHashmap);
787
void     cleanupResultInfoWithoutHash(SExecTaskInfo* pTaskInfo, SExprSupp* pSup, SDiskbasedBuf* pBuf,
788
                                      SGroupResInfo* pGroupResInfo);
789

790
int32_t initAggSup(SExprSupp* pSup, SAggSupporter* pAggSup, SExprInfo* pExprInfo, int32_t numOfCols, size_t keyBufSize,
791
                   const char* pkey, void* pState, SFunctionStateStore* pStore);
792
void    cleanupAggSup(SAggSupporter* pAggSup);
793

794
void initResultSizeInfo(SResultInfo* pResultInfo, int32_t numOfRows);
795

796
void doBuildResultDatablock(struct SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SGroupResInfo* pGroupResInfo,
797
                            SDiskbasedBuf* pBuf);
798

799
/**
800
 * @brief copydata from hash table, instead of copying from SGroupResInfo's pRow
801
 */
802
void doCopyToSDataBlockByHash(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprSupp* pSup, SDiskbasedBuf* pBuf,
803
                              SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap, int32_t threshold, bool ignoreGroup);
804
void doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprSupp* pSup, SDiskbasedBuf* pBuf,
805
                        SGroupResInfo* pGroupResInfo, int32_t threshold, bool ignoreGroup, int64_t minWindowSize);
806

807
bool hasLimitOffsetInfo(SLimitInfo* pLimitInfo);
808
bool hasSlimitOffsetInfo(SLimitInfo* pLimitInfo);
809
void initLimitInfo(const SNode* pLimit, const SNode* pSLimit, SLimitInfo* pLimitInfo);
810
void resetLimitInfoForNextGroup(SLimitInfo* pLimitInfo);
811
bool applyLimitOffset(SLimitInfo* pLimitInfo, SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo);
812

813
int32_t applyAggFunctionOnPartialTuples(SExecTaskInfo* taskInfo, SqlFunctionCtx* pCtx, SColumnInfoData* pTimeWindowData,
814
                                        int32_t offset, int32_t forwardStep, int32_t numOfTotal, int32_t numOfOutput);
815

816
int32_t setFunctionResultOutput(struct SOperatorInfo* pOperator, SOptrBasicInfo* pInfo, SAggSupporter* pSup, int32_t stage,
817
                             int32_t numOfExprs);
818
int32_t      setRowTsColumnOutputInfo(SqlFunctionCtx* pCtx, int32_t numOfCols, SArray** pResList);                             
819
int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, char* pData, SArray* pColList, char** pNextStart);
820
void    updateLoadRemoteInfo(SLoadRemoteDataInfo* pInfo, int64_t numOfRows, int32_t dataLen, int64_t startTs,
821
                             struct SOperatorInfo* pOperator);
822

823
STimeWindow getFirstQualifiedTimeWindow(int64_t ts, STimeWindow* pWindow, SInterval* pInterval, int32_t order);
824
int32_t     getBufferPgSize(int32_t rowSize, uint32_t* defaultPgsz, int64_t* defaultBufsz);
825

826
extern void doDestroyExchangeOperatorInfo(void* param);
827

828
int32_t doFilter(SSDataBlock* pBlock, SFilterInfo* pFilterInfo, SColMatchInfo* pColMatchInfo, SColumnInfoData** pRet);
829
int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int32_t numOfExpr, SSDataBlock* pBlock,
830
                               int32_t rows, SExecTaskInfo* pTask, STableMetaCacheInfo* pCache);
831

832
int32_t appendOneRowToDataBlock(SSDataBlock* pBlock, STupleHandle* pTupleHandle);
833
int32_t setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numOfOutput,
834
                            int32_t* rowEntryInfoOffset);
835
void    clearResultRowInitFlag(SqlFunctionCtx* pCtx, int32_t numOfOutput);
836

837
SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pResultRowInfo, char* pData,
838
                                   int32_t bytes, bool masterscan, uint64_t groupId, SExecTaskInfo* pTaskInfo,
839
                                   bool isIntervalQuery, SAggSupporter* pSup, bool keepGroup);
840

841
int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx,
842
                              int32_t numOfOutput, SArray* pPseudoList, const void* pExtraParams);
843
int32_t projectApplyFunctionsWithSelect(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock,
844
                                        SqlFunctionCtx* pCtx, int32_t numOfOutput, SArray* pPseudoList,
845
                                        const void* pExtraParams, bool doSelectFunc, bool hasIndefRowsFunc);
846

847
int32_t setInputDataBlock(SExprSupp* pExprSupp, SSDataBlock* pBlock, int32_t order, int32_t scanFlag,
848
                          bool createDummyCol);
849

850
int32_t checkForQueryBuf(size_t numOfTables);
851

852
int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, SExecTaskInfo* pTask, SReadHandle* readHandle);
853

854
STimeWindow getActiveTimeWindow(SDiskbasedBuf* pBuf, SResultRowInfo* pResultRowInfo, int64_t ts, SInterval* pInterval,
855
                                int32_t order);
856
int32_t getNumOfRowsInTimeWindow(SDataBlockInfo* pDataBlockInfo, TSKEY* pPrimaryColumn, int32_t startPos, TSKEY ekey,
857
                                 __block_search_fn_t searchFn, STableQueryInfo* item, int32_t order);
858
int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order);
859
SResultRow* getNewResultRow(SDiskbasedBuf* pResultBuf, int32_t* currentPageId, int32_t interBufSize);
860
void getCurSessionWindow(SStreamAggSupporter* pAggSup, TSKEY startTs, TSKEY endTs, uint64_t groupId, SSessionKey* pKey);
861
bool isInTimeWindow(STimeWindow* pWin, TSKEY ts, int64_t gap);
862
bool functionNeedToExecute(SqlFunctionCtx* pCtx);
863
bool isOverdue(TSKEY ts, STimeWindowAggSupp* pSup);
864
bool isCloseWindow(STimeWindow* pWin, STimeWindowAggSupp* pSup);
865
bool isDeletedStreamWindow(STimeWindow* pWin, uint64_t groupId, void* pState, STimeWindowAggSupp* pTwSup,
866
                           SStateStore* pStore);
867

868
uint64_t calGroupIdByData(SPartitionBySupporter* pParSup, SExprSupp* pExprSup, SSDataBlock* pBlock, int32_t rowId);
869

870
void finalizeResultRows(SDiskbasedBuf* pBuf, SResultRowPosition* resultRowPosition, SExprSupp* pSup,
871
                        SSDataBlock* pBlock, SExecTaskInfo* pTaskInfo);
872

873
bool    groupbyTbname(SNodeList* pGroupList);
874
void    getNextIntervalWindow(SInterval* pInterval, STimeWindow* tw, int32_t order);
875
int32_t getForwardStepsInBlock(int32_t numOfRows, __block_search_fn_t searchFn, TSKEY ekey, int32_t pos, int32_t order,
876
                               int64_t* pData);
877
SSDataBlock* buildCreateTableBlock(SExprSupp* tbName, SExprSupp* tag);
878
SExprInfo*   createExpr(SNodeList* pNodeList, int32_t* numOfExprs);
879

880
int32_t copyResultrowToDataBlock(SExprInfo* pExprInfo, int32_t numOfExprs, SResultRow* pRow, SqlFunctionCtx* pCtx,
881
                                 SSDataBlock* pBlock, const int32_t* rowEntryOffset, SExecTaskInfo* pTaskInfo);
882
void doUpdateNumOfRows(SqlFunctionCtx* pCtx, SResultRow* pRow, int32_t numOfExprs, const int32_t* rowEntryOffset);
883

884
void    streamOpReleaseState(struct SOperatorInfo* pOperator);
885
void    streamOpReloadState(struct SOperatorInfo* pOperator);
886
void    destroyStreamAggSupporter(SStreamAggSupporter* pSup);
887
void    clearGroupResInfo(SGroupResInfo* pGroupResInfo);
888
int32_t initBasicInfoEx(SOptrBasicInfo* pBasicInfo, SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfCols,
889
                        SSDataBlock* pResultBlock, SFunctionStateStore* pStore);
890
int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SExprSupp* pExpSup, int32_t numOfOutput, int64_t gap,
891
                               SStreamState* pState, int32_t keySize, int16_t keyType, SStateStore* pStore,
892
                               SReadHandle* pHandle, STimeWindowAggSupp* pTwAggSup, const char* taskIdStr,
893
                               SStorageAPI* pApi, int32_t tsIndex, int8_t stateType, int32_t ratio);
894
int32_t initDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uint16_t type,
895
                       int32_t tsColIndex, STimeWindowAggSupp* pTwSup, struct SSteamOpBasicInfo* pBasic, int64_t recalculateInterval);
896
int32_t getMaxTsWins(const SArray* pAllWins, SArray* pMaxWins);
897
void    initGroupResInfoFromArrayList(SGroupResInfo* pGroupResInfo, SArray* pArrayList);
898
void    getSessionHashKey(const SSessionKey* pKey, SSessionKey* pHashKey);
899
int32_t deleteSessionWinState(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SSHashObj* pMapUpdate,
900
                              SSHashObj* pMapDelete, SSHashObj* pPkDelete, bool needAdd);
901
int32_t getAllSessionWindow(SSHashObj* pHashMap, SSHashObj* pStUpdated);
902
int32_t closeSessionWindow(SSHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SSHashObj* pClosed);
903
int32_t copyUpdateResult(SSHashObj** ppWinUpdated, SArray* pUpdated, __compar_fn_t compar);
904
int32_t sessionKeyCompareAsc(const void* pKey1, const void* pKey2);
905
void    removeSessionDeleteResults(SSHashObj* pHashMap, SArray* pWins);
906
int32_t doOneWindowAggImpl(SColumnInfoData* pTimeWindowData, SResultWindowInfo* pCurWin, SResultRow** pResult,
907
                           int32_t startIndex, int32_t winRows, int32_t rows, int32_t numOutput,
908
                           struct SOperatorInfo* pOperator, int64_t winDelta);
909
void    setSessionWinOutputInfo(SSHashObj* pStUpdated, SResultWindowInfo* pWinInfo);
910
int32_t saveSessionOutputBuf(SStreamAggSupporter* pAggSup, SResultWindowInfo* pWinInfo);
911
int32_t saveResult(SResultWindowInfo winInfo, SSHashObj* pStUpdated);
912
int32_t saveDeleteRes(SSHashObj* pStDelete, SSessionKey key);
913
void    removeSessionResult(SStreamAggSupporter* pAggSup, SSHashObj* pHashMap, SSHashObj* pResMap, SSessionKey* pKey);
914
void    doBuildDeleteDataBlock(struct SOperatorInfo* pOp, SSHashObj* pStDeleted, SSDataBlock* pBlock, void** Ite,
915
                               SGroupResInfo* pGroupResInfo);
916
void    doBuildSessionResult(struct SOperatorInfo* pOperator, void* pState, SGroupResInfo* pGroupResInfo,
917
                             SSDataBlock* pBlock, SArray* pSessionKeys);
918
int32_t getSessionWindowInfoByKey(SStreamAggSupporter* pAggSup, SSessionKey* pKey, SResultWindowInfo* pWinInfo);
919
void    getNextSessionWinInfo(SStreamAggSupporter* pAggSup, SSHashObj* pStUpdated, SResultWindowInfo* pCurWin,
920
                              SResultWindowInfo* pNextWin);
921
int32_t compactTimeWindow(SExprSupp* pSup, SStreamAggSupporter* pAggSup, STimeWindowAggSupp* pTwAggSup,
922
                          SExecTaskInfo* pTaskInfo, SResultWindowInfo* pCurWin, SResultWindowInfo* pNextWin,
923
                          SSHashObj* pStUpdated, SSHashObj* pStDeleted, bool addGap);
924
void    releaseOutputBuf(void* pState, SRowBuffPos* pPos, SStateStore* pAPI);
925
void    resetWinRange(STimeWindow* winRange);
926
int64_t getDeleteMark(SWindowPhysiNode* pWinPhyNode, int64_t interval);
927
void    resetUnCloseSessionWinInfo(SSHashObj* winMap);
928
void    setStreamOperatorCompleted(struct SOperatorInfo* pOperator);
929
void    reloadAggSupFromDownStream(struct SOperatorInfo* downstream, SStreamAggSupporter* pAggSup);
930
void    destroyFlusedPos(void* pRes);
931
bool    isIrowtsPseudoColumn(SExprInfo* pExprInfo);
932
bool    isIsfilledPseudoColumn(SExprInfo* pExprInfo);
933
bool    isInterpFunc(SExprInfo* pExprInfo);
934
bool    isIrowtsOriginPseudoColumn(SExprInfo* pExprInfo);
935

936
int32_t encodeSSessionKey(void** buf, SSessionKey* key);
937
void*   decodeSSessionKey(void* buf, SSessionKey* key);
938
int32_t encodeSResultWindowInfo(void** buf, SResultWindowInfo* key, int32_t outLen);
939
void*   decodeSResultWindowInfo(void* buf, SResultWindowInfo* key, int32_t outLen);
940
int32_t encodeSTimeWindowAggSupp(void** buf, STimeWindowAggSupp* pTwAggSup);
941
void*   decodeSTimeWindowAggSupp(void* buf, STimeWindowAggSupp* pTwAggSup);
942

943
void    destroyOperatorParamValue(void* pValues);
944
int32_t mergeOperatorParams(SOperatorParam* pDst, SOperatorParam* pSrc);
945
int32_t buildTableScanOperatorParam(SOperatorParam** ppRes, SArray* pUidList, int32_t srcOpType, bool tableSeq);
946
int32_t buildTableScanOperatorParamEx(SOperatorParam** ppRes, SArray* pUidList, int32_t srcOpType, SOrgTbInfo *pMap, bool tableSeq, STimeWindow *window);
947
void    freeExchangeGetBasicOperatorParam(void* pParam);
948
void    freeOperatorParam(SOperatorParam* pParam, SOperatorParamType type);
949
void    freeResetOperatorParams(struct SOperatorInfo* pOperator, SOperatorParamType type, bool allFree);
950
int32_t getNextBlockFromDownstreamImpl(struct SOperatorInfo* pOperator, int32_t idx, bool clearParam,
951
                                       SSDataBlock** pResBlock);
952
void getCountWinRange(SStreamAggSupporter* pAggSup, const SSessionKey* pKey, EStreamType mode, SSessionKey* pDelRange);
953
void    doDeleteSessionWindow(SStreamAggSupporter* pAggSup, SSessionKey* pKey);
954

955
int32_t saveDeleteInfo(SArray* pWins, SSessionKey key);
956
void    removeSessionResults(SStreamAggSupporter* pAggSup, SSHashObj* pHashMap, SArray* pWins);
957
int32_t copyDeleteWindowInfo(SArray* pResWins, SSHashObj* pStDeleted);
958
int32_t copyDeleteSessionKey(SSHashObj* source, SSHashObj* dest);
959

960
bool inSlidingWindow(SInterval* pInterval, STimeWindow* pWin, SDataBlockInfo* pBlockInfo);
961
bool inCalSlidingWindow(SInterval* pInterval, STimeWindow* pWin, TSKEY calStart, TSKEY calEnd, EStreamType blockType);
962
bool compareVal(const char* v, const SStateKeys* pKey);
963
bool inWinRange(STimeWindow* range, STimeWindow* cur);
964
int32_t doDeleteTimeWindows(SStreamAggSupporter* pAggSup, SSDataBlock* pBlock, SArray* result);
965

966
int32_t getNextQualifiedWindow(SInterval* pInterval, STimeWindow* pNext, SDataBlockInfo* pDataBlockInfo,
967
                               TSKEY* primaryKeys, int32_t prevPosition, int32_t order);
968
int32_t extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const SColumnInfoData* p, int32_t status);
969
bool    getIgoreNullRes(SExprSupp* pExprSup);
970
bool    checkNullRow(SExprSupp* pExprSup, SSDataBlock* pSrcBlock, int32_t index, bool ignoreNull);
971
int64_t getMinWindowSize(struct SOperatorInfo* pOperator);
972

973
void    destroyTmqScanOperatorInfo(void* param);
974
int32_t checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock* pBlock, bool out);
975
void resetBasicOperatorState(SOptrBasicInfo* pBasicInfo);
976

977
int32_t addNewResultRowBuf(SResultRow* pWindowRes, SDiskbasedBuf* pResultBuf, uint32_t size);
978

979
#ifdef __cplusplus
980
}
981
#endif
982

983
#endif  // TDENGINE_EXECUTORINT_H
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