2022-02-13 18:31:18 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can use, redistribute, and/or modify
|
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3
|
|
|
|
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _TD_PLANN_NODES_H_
|
|
|
|
|
#define _TD_PLANN_NODES_H_
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-02-28 09:02:43 +00:00
|
|
|
#include "query.h"
|
2022-04-26 10:15:06 +00:00
|
|
|
#include "querynodes.h"
|
2022-03-10 02:35:24 +00:00
|
|
|
#include "tname.h"
|
2022-02-13 18:31:18 +00:00
|
|
|
|
2022-06-26 06:44:58 +00:00
|
|
|
#define SLOT_NAME_LEN TSDB_TABLE_NAME_LEN + TSDB_COL_NAME_LEN
|
|
|
|
|
|
2022-07-18 08:55:31 +00:00
|
|
|
typedef enum EDataOrderLevel {
|
|
|
|
|
DATA_ORDER_LEVEL_NONE = 1,
|
|
|
|
|
DATA_ORDER_LEVEL_IN_BLOCK,
|
2022-07-21 06:35:36 +00:00
|
|
|
DATA_ORDER_LEVEL_IN_GROUP,
|
|
|
|
|
DATA_ORDER_LEVEL_GLOBAL
|
2022-07-18 08:55:31 +00:00
|
|
|
} EDataOrderLevel;
|
|
|
|
|
|
2022-07-21 11:21:15 +00:00
|
|
|
typedef enum EGroupAction {
|
|
|
|
|
GROUP_ACTION_NONE = 1,
|
|
|
|
|
GROUP_ACTION_SET,
|
|
|
|
|
GROUP_ACTION_KEEP,
|
|
|
|
|
GROUP_ACTION_CLEAR
|
|
|
|
|
} EGroupAction;
|
|
|
|
|
|
2023-11-07 01:23:06 +00:00
|
|
|
typedef enum EMergeType {
|
|
|
|
|
MERGE_TYPE_SORT = 1,
|
|
|
|
|
MERGE_TYPE_NON_SORT,
|
|
|
|
|
MERGE_TYPE_COLUMNS,
|
|
|
|
|
MERGE_TYPE_MAX_VALUE
|
|
|
|
|
} EMergeType;
|
|
|
|
|
|
2022-02-13 18:31:18 +00:00
|
|
|
typedef struct SLogicNode {
|
2022-04-26 10:15:06 +00:00
|
|
|
ENodeType type;
|
2023-06-28 11:39:04 +00:00
|
|
|
bool dynamicOp;
|
2023-08-16 06:28:39 +00:00
|
|
|
bool stmtRoot;
|
2022-04-26 10:15:06 +00:00
|
|
|
SNodeList* pTargets; // SColumnNode
|
|
|
|
|
SNode* pConditions;
|
|
|
|
|
SNodeList* pChildren;
|
2022-02-13 18:31:18 +00:00
|
|
|
struct SLogicNode* pParent;
|
2023-08-16 06:28:39 +00:00
|
|
|
SNodeList* pHint;
|
2022-04-26 10:15:06 +00:00
|
|
|
int32_t optimizedFlag;
|
2022-05-25 13:20:11 +00:00
|
|
|
uint8_t precision;
|
2022-06-23 10:03:15 +00:00
|
|
|
SNode* pLimit;
|
|
|
|
|
SNode* pSlimit;
|
2022-07-18 08:55:31 +00:00
|
|
|
EDataOrderLevel requireDataOrder; // requirements for input data
|
|
|
|
|
EDataOrderLevel resultDataOrder; // properties of the output data
|
2022-07-21 11:21:15 +00:00
|
|
|
EGroupAction groupAction;
|
2023-06-16 02:26:09 +00:00
|
|
|
EOrder inputTsOrder;
|
|
|
|
|
EOrder outputTsOrder;
|
2023-07-20 07:07:55 +00:00
|
|
|
bool forceCreateNonBlockingOptr; // true if the operator can use non-blocking(pipeline) mode
|
2024-03-19 08:01:14 +00:00
|
|
|
bool splitDone;
|
2022-02-13 18:31:18 +00:00
|
|
|
} SLogicNode;
|
|
|
|
|
|
2022-06-15 05:49:29 +00:00
|
|
|
typedef enum EScanType {
|
|
|
|
|
SCAN_TYPE_TAG = 1,
|
|
|
|
|
SCAN_TYPE_TABLE,
|
|
|
|
|
SCAN_TYPE_SYSTEM_TABLE,
|
|
|
|
|
SCAN_TYPE_STREAM,
|
2022-06-18 10:37:18 +00:00
|
|
|
SCAN_TYPE_TABLE_MERGE,
|
2022-06-21 11:52:26 +00:00
|
|
|
SCAN_TYPE_BLOCK_INFO,
|
2022-11-15 08:38:51 +00:00
|
|
|
SCAN_TYPE_LAST_ROW,
|
|
|
|
|
SCAN_TYPE_TABLE_COUNT
|
2022-06-15 05:49:29 +00:00
|
|
|
} EScanType;
|
2022-02-23 06:34:18 +00:00
|
|
|
|
2022-02-13 18:31:18 +00:00
|
|
|
typedef struct SScanLogicNode {
|
2022-06-05 07:48:06 +00:00
|
|
|
SLogicNode node;
|
|
|
|
|
SNodeList* pScanCols;
|
|
|
|
|
SNodeList* pScanPseudoCols;
|
|
|
|
|
int8_t tableType;
|
|
|
|
|
uint64_t tableId;
|
2022-06-06 09:51:25 +00:00
|
|
|
uint64_t stableId;
|
2022-06-05 07:48:06 +00:00
|
|
|
SVgroupsInfo* pVgroupList;
|
|
|
|
|
EScanType scanType;
|
|
|
|
|
uint8_t scanSeq[2]; // first is scan count, and second is reverse scan count
|
|
|
|
|
STimeWindow scanRange;
|
|
|
|
|
SName tableName;
|
|
|
|
|
bool showRewrite;
|
|
|
|
|
double ratio;
|
|
|
|
|
SNodeList* pDynamicScanFuncs;
|
|
|
|
|
int32_t dataRequired;
|
|
|
|
|
int64_t interval;
|
|
|
|
|
int64_t offset;
|
|
|
|
|
int64_t sliding;
|
|
|
|
|
int8_t intervalUnit;
|
|
|
|
|
int8_t slidingUnit;
|
|
|
|
|
SNode* pTagCond;
|
2022-06-18 12:15:47 +00:00
|
|
|
SNode* pTagIndexCond;
|
2022-06-05 07:48:06 +00:00
|
|
|
int8_t triggerType;
|
|
|
|
|
int64_t watermark;
|
2022-12-06 08:07:11 +00:00
|
|
|
int64_t deleteMark;
|
2022-06-30 08:16:05 +00:00
|
|
|
int8_t igExpired;
|
2023-02-08 10:46:12 +00:00
|
|
|
int8_t igCheckUpdate;
|
2022-06-10 02:16:18 +00:00
|
|
|
SArray* pSmaIndexes;
|
2023-12-15 10:11:22 +00:00
|
|
|
SArray* pTsmas;
|
2024-03-06 06:50:16 +00:00
|
|
|
SArray* pTsmaTargetTbVgInfo;
|
|
|
|
|
SArray* pTsmaTargetTbInfo;
|
2022-06-27 07:57:02 +00:00
|
|
|
SNodeList* pGroupTags;
|
|
|
|
|
bool groupSort;
|
2022-09-26 10:39:47 +00:00
|
|
|
SNodeList* pTags; // for create stream
|
|
|
|
|
SNode* pSubtable; // for create stream
|
2022-07-15 00:43:40 +00:00
|
|
|
int8_t cacheLastMode;
|
2022-07-18 08:55:31 +00:00
|
|
|
bool hasNormalCols; // neither tag column nor primary key tag column
|
2022-07-28 11:27:37 +00:00
|
|
|
bool sortPrimaryKey;
|
2022-10-12 08:32:29 +00:00
|
|
|
bool igLastNull;
|
2023-07-20 07:07:55 +00:00
|
|
|
bool groupOrderScan;
|
2023-08-14 11:26:53 +00:00
|
|
|
bool onlyMetaCtbIdx; // for tag scan with no tbname
|
2023-12-06 01:39:38 +00:00
|
|
|
bool filesetDelimited; // returned blocks delimited by fileset
|
2023-12-25 03:54:23 +00:00
|
|
|
bool isCountByTag; // true if selectstmt hasCountFunc & part by tag/tbname
|
2024-01-14 05:44:40 +00:00
|
|
|
SArray* pFuncTypes; // for last, last_row
|
2024-02-02 06:45:04 +00:00
|
|
|
bool paraTablesSort; // for table merge scan
|
2024-03-08 06:36:55 +00:00
|
|
|
bool smallDataTsSort; // disable row id sort for table merge scan
|
2024-03-06 03:48:32 +00:00
|
|
|
bool needSplit;
|
2022-02-13 18:31:18 +00:00
|
|
|
} SScanLogicNode;
|
|
|
|
|
|
|
|
|
|
typedef struct SJoinLogicNode {
|
2023-06-27 11:36:51 +00:00
|
|
|
SLogicNode node;
|
|
|
|
|
EJoinType joinType;
|
2023-11-29 12:06:30 +00:00
|
|
|
EJoinSubType subType;
|
|
|
|
|
SNode* pWindowOffset;
|
|
|
|
|
SNode* pJLimit;
|
2023-06-27 11:36:51 +00:00
|
|
|
EJoinAlgorithm joinAlgo;
|
2024-02-29 09:52:53 +00:00
|
|
|
SNode* addPrimEqCond;
|
2023-06-27 11:36:51 +00:00
|
|
|
SNode* pPrimKeyEqCond;
|
|
|
|
|
SNode* pColEqCond;
|
2023-11-30 12:09:49 +00:00
|
|
|
SNode* pColOnCond;
|
2023-06-27 11:36:51 +00:00
|
|
|
SNode* pTagEqCond;
|
2023-06-28 11:39:04 +00:00
|
|
|
SNode* pTagOnCond;
|
2023-11-30 12:09:49 +00:00
|
|
|
SNode* pFullOnCond; // except prim eq cond
|
2024-02-23 09:59:45 +00:00
|
|
|
SNodeList* pLeftEqNodes;
|
|
|
|
|
SNodeList* pRightEqNodes;
|
2024-02-27 10:18:25 +00:00
|
|
|
bool allEqTags;
|
2023-06-27 11:36:51 +00:00
|
|
|
bool isSingleTableJoin;
|
|
|
|
|
bool hasSubQuery;
|
2023-08-17 05:50:26 +00:00
|
|
|
bool isLowLevelJoin;
|
2024-02-22 10:59:10 +00:00
|
|
|
bool seqWinGroup;
|
2024-02-23 09:59:45 +00:00
|
|
|
bool grpJoin;
|
2024-04-10 11:27:36 +00:00
|
|
|
bool hashJoinHint;
|
2024-04-23 01:14:42 +00:00
|
|
|
bool batchScanHint;
|
2024-04-10 11:27:36 +00:00
|
|
|
|
|
|
|
|
// FOR HASH JOIN
|
2024-04-12 07:44:23 +00:00
|
|
|
int32_t timeRangeTarget; //table onCond filter
|
|
|
|
|
STimeWindow timeRange; //table onCond filter
|
|
|
|
|
SNode* pLeftOnCond; //table onCond filter
|
|
|
|
|
SNode* pRightOnCond; //table onCond filter
|
2022-02-13 18:31:18 +00:00
|
|
|
} SJoinLogicNode;
|
|
|
|
|
|
|
|
|
|
typedef struct SAggLogicNode {
|
|
|
|
|
SLogicNode node;
|
|
|
|
|
SNodeList* pGroupKeys;
|
|
|
|
|
SNodeList* pAggFuncs;
|
2022-06-30 02:23:35 +00:00
|
|
|
bool hasLastRow;
|
2022-10-12 08:32:29 +00:00
|
|
|
bool hasLast;
|
2022-07-22 07:06:01 +00:00
|
|
|
bool hasTimeLineFunc;
|
2022-08-06 07:26:34 +00:00
|
|
|
bool onlyHasKeepOrderFunc;
|
2022-12-28 09:27:23 +00:00
|
|
|
bool hasGroupKeyOptimized;
|
2023-09-04 01:41:02 +00:00
|
|
|
bool isGroupTb;
|
|
|
|
|
bool isPartTb; // true if partition keys has tbname
|
2023-11-08 10:42:41 +00:00
|
|
|
bool hasGroup;
|
2024-03-22 07:25:14 +00:00
|
|
|
SNodeList *pTsmaSubplans;
|
2022-02-13 18:31:18 +00:00
|
|
|
} SAggLogicNode;
|
|
|
|
|
|
|
|
|
|
typedef struct SProjectLogicNode {
|
|
|
|
|
SLogicNode node;
|
|
|
|
|
SNodeList* pProjections;
|
2022-04-26 10:15:06 +00:00
|
|
|
char stmtName[TSDB_TABLE_NAME_LEN];
|
2022-08-08 10:32:04 +00:00
|
|
|
bool ignoreGroupId;
|
2024-01-15 03:58:29 +00:00
|
|
|
bool inputIgnoreGroup;
|
2024-05-27 08:20:13 +00:00
|
|
|
bool isSetOpProj;
|
2022-02-13 18:31:18 +00:00
|
|
|
} SProjectLogicNode;
|
|
|
|
|
|
2022-05-31 03:29:10 +00:00
|
|
|
typedef struct SIndefRowsFuncLogicNode {
|
|
|
|
|
SLogicNode node;
|
2022-06-19 11:39:12 +00:00
|
|
|
SNodeList* pFuncs;
|
2022-06-26 06:44:58 +00:00
|
|
|
bool isTailFunc;
|
2022-06-27 13:30:20 +00:00
|
|
|
bool isUniqueFunc;
|
2022-07-01 05:31:22 +00:00
|
|
|
bool isTimeLineFunc;
|
2022-05-31 03:29:10 +00:00
|
|
|
} SIndefRowsFuncLogicNode;
|
|
|
|
|
|
2022-06-19 11:39:12 +00:00
|
|
|
typedef struct SInterpFuncLogicNode {
|
|
|
|
|
SLogicNode node;
|
|
|
|
|
SNodeList* pFuncs;
|
|
|
|
|
STimeWindow timeRange;
|
|
|
|
|
int64_t interval;
|
2022-06-20 04:00:57 +00:00
|
|
|
EFillMode fillMode;
|
|
|
|
|
SNode* pFillValues; // SNodeListNode
|
|
|
|
|
SNode* pTimeSeries; // SColumnNode
|
2022-06-19 11:39:12 +00:00
|
|
|
} SInterpFuncLogicNode;
|
|
|
|
|
|
2023-06-27 11:36:51 +00:00
|
|
|
typedef struct SGroupCacheLogicNode {
|
|
|
|
|
SLogicNode node;
|
2023-06-30 11:20:36 +00:00
|
|
|
bool grpColsMayBeNull;
|
2023-07-14 05:30:13 +00:00
|
|
|
bool grpByUid;
|
|
|
|
|
bool globalGrp;
|
2023-07-19 02:37:30 +00:00
|
|
|
bool batchFetch;
|
2023-06-28 11:39:04 +00:00
|
|
|
SNodeList* pGroupCols;
|
2023-06-27 11:36:51 +00:00
|
|
|
} SGroupCacheLogicNode;
|
|
|
|
|
|
2023-07-19 02:37:30 +00:00
|
|
|
typedef struct SDynQueryCtrlStbJoin {
|
2023-07-26 11:17:59 +00:00
|
|
|
bool batchFetch;
|
2023-07-06 11:33:31 +00:00
|
|
|
SNodeList* pVgList;
|
|
|
|
|
SNodeList* pUidList;
|
2023-08-09 02:30:35 +00:00
|
|
|
bool srcScan[2];
|
2023-07-19 02:37:30 +00:00
|
|
|
} SDynQueryCtrlStbJoin;
|
|
|
|
|
|
|
|
|
|
typedef struct SDynQueryCtrlLogicNode {
|
|
|
|
|
SLogicNode node;
|
|
|
|
|
EDynQueryType qType;
|
|
|
|
|
SDynQueryCtrlStbJoin stbJoin;
|
2023-06-28 11:39:04 +00:00
|
|
|
} SDynQueryCtrlLogicNode;
|
2023-06-27 11:36:51 +00:00
|
|
|
|
2022-06-05 07:48:06 +00:00
|
|
|
typedef enum EModifyTableType { MODIFY_TABLE_TYPE_INSERT = 1, MODIFY_TABLE_TYPE_DELETE } EModifyTableType;
|
|
|
|
|
|
|
|
|
|
typedef struct SVnodeModifyLogicNode {
|
|
|
|
|
SLogicNode node;
|
|
|
|
|
EModifyTableType modifyType;
|
|
|
|
|
int32_t msgType;
|
|
|
|
|
SArray* pDataBlocks;
|
|
|
|
|
SVgDataBlocks* pVgDataBlocks;
|
2022-06-06 10:39:23 +00:00
|
|
|
SNode* pAffectedRows; // SColumnNode
|
2022-09-14 09:51:21 +00:00
|
|
|
SNode* pStartTs; // SColumnNode
|
|
|
|
|
SNode* pEndTs; // SColumnNode
|
2022-06-05 07:48:06 +00:00
|
|
|
uint64_t tableId;
|
2022-07-06 08:16:54 +00:00
|
|
|
uint64_t stableId;
|
2022-06-05 07:48:06 +00:00
|
|
|
int8_t tableType; // table type
|
2022-07-27 09:11:57 +00:00
|
|
|
char tableName[TSDB_TABLE_NAME_LEN];
|
2022-07-27 07:25:57 +00:00
|
|
|
char tsColName[TSDB_COL_NAME_LEN];
|
2022-06-05 07:48:06 +00:00
|
|
|
STimeWindow deleteTimeRange;
|
2022-07-05 13:12:10 +00:00
|
|
|
SVgroupsInfo* pVgroupList;
|
2022-07-06 08:16:54 +00:00
|
|
|
SNodeList* pInsertCols;
|
2022-06-05 07:48:06 +00:00
|
|
|
} SVnodeModifyLogicNode;
|
2022-03-03 12:25:16 +00:00
|
|
|
|
2022-03-09 09:32:12 +00:00
|
|
|
typedef struct SExchangeLogicNode {
|
|
|
|
|
SLogicNode node;
|
2022-09-23 03:26:03 +00:00
|
|
|
int32_t srcStartGroupId;
|
|
|
|
|
int32_t srcEndGroupId;
|
2022-11-24 07:16:38 +00:00
|
|
|
bool seqRecvData;
|
2022-03-09 09:32:12 +00:00
|
|
|
} SExchangeLogicNode;
|
|
|
|
|
|
2022-06-02 02:45:27 +00:00
|
|
|
typedef struct SMergeLogicNode {
|
|
|
|
|
SLogicNode node;
|
|
|
|
|
SNodeList* pMergeKeys;
|
2022-06-06 09:51:25 +00:00
|
|
|
SNodeList* pInputs;
|
2022-06-02 02:45:27 +00:00
|
|
|
int32_t numOfChannels;
|
2023-12-27 06:38:02 +00:00
|
|
|
int32_t numOfSubplans;
|
2022-06-02 02:45:27 +00:00
|
|
|
int32_t srcGroupId;
|
2023-12-27 06:38:02 +00:00
|
|
|
int32_t srcEndGroupId;
|
2023-11-07 01:23:06 +00:00
|
|
|
bool colsMerge;
|
|
|
|
|
bool needSort;
|
2022-06-27 07:57:02 +00:00
|
|
|
bool groupSort;
|
2023-05-09 03:33:47 +00:00
|
|
|
bool ignoreGroupId;
|
2023-09-07 05:51:09 +00:00
|
|
|
bool inputWithGroupId;
|
2022-06-02 02:45:27 +00:00
|
|
|
} SMergeLogicNode;
|
|
|
|
|
|
2022-12-08 01:36:37 +00:00
|
|
|
typedef enum EWindowType {
|
|
|
|
|
WINDOW_TYPE_INTERVAL = 1,
|
|
|
|
|
WINDOW_TYPE_SESSION,
|
|
|
|
|
WINDOW_TYPE_STATE,
|
2024-01-17 06:22:19 +00:00
|
|
|
WINDOW_TYPE_EVENT,
|
|
|
|
|
WINDOW_TYPE_COUNT
|
2022-12-08 01:36:37 +00:00
|
|
|
} EWindowType;
|
2022-03-13 19:28:50 +00:00
|
|
|
|
2022-06-17 06:13:45 +00:00
|
|
|
typedef enum EWindowAlgorithm {
|
2022-06-05 07:48:06 +00:00
|
|
|
INTERVAL_ALGO_HASH = 1,
|
2022-06-06 09:51:25 +00:00
|
|
|
INTERVAL_ALGO_MERGE,
|
2022-06-05 07:48:06 +00:00
|
|
|
INTERVAL_ALGO_STREAM_FINAL,
|
|
|
|
|
INTERVAL_ALGO_STREAM_SEMI,
|
|
|
|
|
INTERVAL_ALGO_STREAM_SINGLE,
|
2022-06-17 06:13:45 +00:00
|
|
|
SESSION_ALGO_STREAM_SEMI,
|
|
|
|
|
SESSION_ALGO_STREAM_FINAL,
|
|
|
|
|
SESSION_ALGO_STREAM_SINGLE,
|
|
|
|
|
SESSION_ALGO_MERGE,
|
2023-12-05 12:07:20 +00:00
|
|
|
INTERVAL_ALGO_STREAM_MID,
|
2022-06-17 06:13:45 +00:00
|
|
|
} EWindowAlgorithm;
|
2022-06-02 08:37:46 +00:00
|
|
|
|
2022-03-11 10:11:25 +00:00
|
|
|
typedef struct SWindowLogicNode {
|
2022-06-18 10:37:18 +00:00
|
|
|
SLogicNode node;
|
|
|
|
|
EWindowType winType;
|
|
|
|
|
SNodeList* pFuncs;
|
|
|
|
|
int64_t interval;
|
|
|
|
|
int64_t offset;
|
|
|
|
|
int64_t sliding;
|
|
|
|
|
int8_t intervalUnit;
|
|
|
|
|
int8_t slidingUnit;
|
|
|
|
|
int64_t sessionGap;
|
|
|
|
|
SNode* pTspk;
|
2022-06-19 11:39:12 +00:00
|
|
|
SNode* pTsEnd;
|
2022-06-18 10:37:18 +00:00
|
|
|
SNode* pStateExpr;
|
2022-12-08 01:36:37 +00:00
|
|
|
SNode* pStartCond;
|
|
|
|
|
SNode* pEndCond;
|
2022-06-18 10:37:18 +00:00
|
|
|
int8_t triggerType;
|
|
|
|
|
int64_t watermark;
|
2022-12-06 08:07:11 +00:00
|
|
|
int64_t deleteMark;
|
2022-06-30 08:16:05 +00:00
|
|
|
int8_t igExpired;
|
2023-02-08 10:46:12 +00:00
|
|
|
int8_t igCheckUpdate;
|
2022-06-18 10:37:18 +00:00
|
|
|
EWindowAlgorithm windowAlgo;
|
2023-09-04 01:41:02 +00:00
|
|
|
bool isPartTb;
|
2024-01-17 06:22:19 +00:00
|
|
|
int64_t windowCount;
|
2024-01-26 07:56:26 +00:00
|
|
|
int64_t windowSliding;
|
2024-03-22 07:25:14 +00:00
|
|
|
SNodeList* pTsmaSubplans;
|
2022-03-11 10:11:25 +00:00
|
|
|
} SWindowLogicNode;
|
|
|
|
|
|
2022-04-30 03:40:12 +00:00
|
|
|
typedef struct SFillLogicNode {
|
2022-04-30 06:07:44 +00:00
|
|
|
SLogicNode node;
|
|
|
|
|
EFillMode mode;
|
2022-08-02 08:18:53 +00:00
|
|
|
SNodeList* pFillExprs;
|
|
|
|
|
SNodeList* pNotFillExprs;
|
2022-04-30 06:07:44 +00:00
|
|
|
SNode* pWStartTs;
|
|
|
|
|
SNode* pValues; // SNodeListNode
|
|
|
|
|
STimeWindow timeRange;
|
2022-04-30 03:40:12 +00:00
|
|
|
} SFillLogicNode;
|
|
|
|
|
|
2022-03-26 06:58:44 +00:00
|
|
|
typedef struct SSortLogicNode {
|
|
|
|
|
SLogicNode node;
|
|
|
|
|
SNodeList* pSortKeys;
|
2022-06-26 06:44:58 +00:00
|
|
|
bool groupSort;
|
2023-07-14 08:03:59 +00:00
|
|
|
bool skipPKSortOpt;
|
2023-08-29 07:46:03 +00:00
|
|
|
bool calcGroupId;
|
2023-09-04 01:41:02 +00:00
|
|
|
bool excludePkCol; // exclude PK ts col when calc group id
|
2022-03-26 06:58:44 +00:00
|
|
|
} SSortLogicNode;
|
|
|
|
|
|
2022-03-29 06:52:40 +00:00
|
|
|
typedef struct SPartitionLogicNode {
|
|
|
|
|
SLogicNode node;
|
|
|
|
|
SNodeList* pPartitionKeys;
|
2022-09-26 10:39:47 +00:00
|
|
|
SNodeList* pTags;
|
|
|
|
|
SNode* pSubtable;
|
2023-09-19 06:56:02 +00:00
|
|
|
SNodeList* pAggFuncs;
|
2023-09-04 01:41:02 +00:00
|
|
|
|
|
|
|
|
bool needBlockOutputTsOrder; // if true, partition output block will have ts order maintained
|
2023-09-07 05:51:09 +00:00
|
|
|
int32_t pkTsColId;
|
|
|
|
|
uint64_t pkTsColTbId;
|
2022-03-29 06:52:40 +00:00
|
|
|
} SPartitionLogicNode;
|
|
|
|
|
|
2022-03-03 12:25:16 +00:00
|
|
|
typedef enum ESubplanType {
|
|
|
|
|
SUBPLAN_TYPE_MERGE = 1,
|
|
|
|
|
SUBPLAN_TYPE_PARTIAL,
|
|
|
|
|
SUBPLAN_TYPE_SCAN,
|
2022-06-15 08:47:03 +00:00
|
|
|
SUBPLAN_TYPE_MODIFY,
|
|
|
|
|
SUBPLAN_TYPE_COMPUTE
|
2022-03-03 12:25:16 +00:00
|
|
|
} ESubplanType;
|
|
|
|
|
|
2022-03-09 09:32:12 +00:00
|
|
|
typedef struct SSubplanId {
|
|
|
|
|
uint64_t queryId;
|
2022-04-26 10:15:06 +00:00
|
|
|
int32_t groupId;
|
|
|
|
|
int32_t subplanId;
|
2022-03-09 09:32:12 +00:00
|
|
|
} SSubplanId;
|
|
|
|
|
|
2022-03-23 10:44:02 +00:00
|
|
|
typedef struct SLogicSubplan {
|
2022-04-26 10:15:06 +00:00
|
|
|
ENodeType type;
|
|
|
|
|
SSubplanId id;
|
|
|
|
|
SNodeList* pChildren;
|
|
|
|
|
SNodeList* pParents;
|
|
|
|
|
SLogicNode* pNode;
|
|
|
|
|
ESubplanType subplanType;
|
2022-03-09 09:32:12 +00:00
|
|
|
SVgroupsInfo* pVgroupList;
|
2022-04-26 10:15:06 +00:00
|
|
|
int32_t level;
|
|
|
|
|
int32_t splitFlag;
|
2022-06-15 08:47:03 +00:00
|
|
|
int32_t numOfComputeNodes;
|
2022-03-23 10:44:02 +00:00
|
|
|
} SLogicSubplan;
|
2022-03-02 02:50:51 +00:00
|
|
|
|
|
|
|
|
typedef struct SQueryLogicPlan {
|
2022-04-26 10:15:06 +00:00
|
|
|
ENodeType type;
|
2022-03-09 11:53:00 +00:00
|
|
|
SNodeList* pTopSubplans;
|
2022-03-02 02:50:51 +00:00
|
|
|
} SQueryLogicPlan;
|
|
|
|
|
|
2022-02-23 06:34:18 +00:00
|
|
|
typedef struct SSlotDescNode {
|
|
|
|
|
ENodeType type;
|
2022-04-26 10:15:06 +00:00
|
|
|
int16_t slotId;
|
2022-02-23 06:34:18 +00:00
|
|
|
SDataType dataType;
|
2022-04-26 10:15:06 +00:00
|
|
|
bool reserve;
|
|
|
|
|
bool output;
|
|
|
|
|
bool tag;
|
2022-06-26 06:44:58 +00:00
|
|
|
char name[SLOT_NAME_LEN];
|
2022-02-23 06:34:18 +00:00
|
|
|
} SSlotDescNode;
|
|
|
|
|
|
2022-02-25 08:29:40 +00:00
|
|
|
typedef struct SDataBlockDescNode {
|
2022-04-26 10:15:06 +00:00
|
|
|
ENodeType type;
|
|
|
|
|
int16_t dataBlockId;
|
2022-02-23 06:34:18 +00:00
|
|
|
SNodeList* pSlots;
|
2022-04-26 10:15:06 +00:00
|
|
|
int32_t totalRowSize;
|
|
|
|
|
int32_t outputRowSize;
|
|
|
|
|
uint8_t precision;
|
2022-02-25 08:29:40 +00:00
|
|
|
} SDataBlockDescNode;
|
2022-02-23 06:34:18 +00:00
|
|
|
|
|
|
|
|
typedef struct SPhysiNode {
|
2022-04-26 10:15:06 +00:00
|
|
|
ENodeType type;
|
2023-07-03 11:29:46 +00:00
|
|
|
bool dynamicOp;
|
2023-06-16 02:26:09 +00:00
|
|
|
EOrder inputTsOrder;
|
|
|
|
|
EOrder outputTsOrder;
|
2022-03-04 07:17:04 +00:00
|
|
|
SDataBlockDescNode* pOutputDataBlockDesc;
|
2022-04-26 10:15:06 +00:00
|
|
|
SNode* pConditions;
|
|
|
|
|
SNodeList* pChildren;
|
|
|
|
|
struct SPhysiNode* pParent;
|
2022-06-23 10:03:15 +00:00
|
|
|
SNode* pLimit;
|
|
|
|
|
SNode* pSlimit;
|
2023-07-20 07:07:55 +00:00
|
|
|
bool forceCreateNonBlockingOptr;
|
2022-02-23 06:34:18 +00:00
|
|
|
} SPhysiNode;
|
|
|
|
|
|
|
|
|
|
typedef struct SScanPhysiNode {
|
2022-03-19 07:02:31 +00:00
|
|
|
SPhysiNode node;
|
2022-02-23 06:34:18 +00:00
|
|
|
SNodeList* pScanCols;
|
2022-04-26 10:15:06 +00:00
|
|
|
SNodeList* pScanPseudoCols;
|
|
|
|
|
uint64_t uid; // unique id of the table
|
2022-06-06 09:51:25 +00:00
|
|
|
uint64_t suid;
|
2022-04-26 10:15:06 +00:00
|
|
|
int8_t tableType;
|
|
|
|
|
SName tableName;
|
2023-07-20 07:07:55 +00:00
|
|
|
bool groupOrderScan;
|
2022-02-23 06:34:18 +00:00
|
|
|
} SScanPhysiNode;
|
|
|
|
|
|
2023-08-11 06:47:28 +00:00
|
|
|
typedef struct STagScanPhysiNode {
|
2023-08-15 08:10:54 +00:00
|
|
|
SScanPhysiNode scan;
|
2023-08-11 06:47:28 +00:00
|
|
|
bool onlyMetaCtbIdx; //no tbname, tag index not used.
|
|
|
|
|
} STagScanPhysiNode;
|
|
|
|
|
|
2022-06-18 10:37:18 +00:00
|
|
|
typedef SScanPhysiNode SBlockDistScanPhysiNode;
|
2022-07-14 08:06:28 +00:00
|
|
|
|
|
|
|
|
typedef struct SLastRowScanPhysiNode {
|
|
|
|
|
SScanPhysiNode scan;
|
|
|
|
|
SNodeList* pGroupTags;
|
|
|
|
|
bool groupSort;
|
2022-10-12 08:32:29 +00:00
|
|
|
bool ignoreNull;
|
2023-11-09 06:23:42 +00:00
|
|
|
SNodeList* pTargets;
|
2024-01-14 05:44:40 +00:00
|
|
|
SArray* pFuncTypes;
|
2022-07-14 08:06:28 +00:00
|
|
|
} SLastRowScanPhysiNode;
|
2022-02-23 06:34:18 +00:00
|
|
|
|
2022-11-22 08:39:30 +00:00
|
|
|
typedef SLastRowScanPhysiNode STableCountScanPhysiNode;
|
|
|
|
|
|
2022-03-11 07:58:29 +00:00
|
|
|
typedef struct SSystemTableScanPhysiNode {
|
|
|
|
|
SScanPhysiNode scan;
|
2022-04-26 10:15:06 +00:00
|
|
|
SEpSet mgmtEpSet;
|
|
|
|
|
bool showRewrite;
|
|
|
|
|
int32_t accountId;
|
2022-08-24 09:36:10 +00:00
|
|
|
bool sysInfo;
|
2022-03-11 07:58:29 +00:00
|
|
|
} SSystemTableScanPhysiNode;
|
|
|
|
|
|
2022-02-23 06:34:18 +00:00
|
|
|
typedef struct STableScanPhysiNode {
|
|
|
|
|
SScanPhysiNode scan;
|
2022-04-26 10:15:06 +00:00
|
|
|
uint8_t scanSeq[2]; // first is scan count, and second is reverse scan count
|
|
|
|
|
STimeWindow scanRange;
|
|
|
|
|
double ratio;
|
|
|
|
|
int32_t dataRequired;
|
|
|
|
|
SNodeList* pDynamicScanFuncs;
|
2022-06-27 07:57:02 +00:00
|
|
|
SNodeList* pGroupTags;
|
|
|
|
|
bool groupSort;
|
2022-09-26 10:39:47 +00:00
|
|
|
SNodeList* pTags;
|
|
|
|
|
SNode* pSubtable;
|
2022-04-26 10:15:06 +00:00
|
|
|
int64_t interval;
|
|
|
|
|
int64_t offset;
|
|
|
|
|
int64_t sliding;
|
|
|
|
|
int8_t intervalUnit;
|
|
|
|
|
int8_t slidingUnit;
|
2022-05-27 08:03:43 +00:00
|
|
|
int8_t triggerType;
|
|
|
|
|
int64_t watermark;
|
2022-06-30 08:16:05 +00:00
|
|
|
int8_t igExpired;
|
2022-07-27 03:55:19 +00:00
|
|
|
bool assignBlockUid;
|
2023-02-07 07:29:05 +00:00
|
|
|
int8_t igCheckUpdate;
|
2023-12-06 02:45:12 +00:00
|
|
|
bool filesetDelimited;
|
2023-12-13 15:25:37 +00:00
|
|
|
bool needCountEmptyTable;
|
2024-02-02 06:45:04 +00:00
|
|
|
bool paraTablesSort;
|
2024-03-08 06:36:55 +00:00
|
|
|
bool smallDataTsSort;
|
2022-02-23 06:34:18 +00:00
|
|
|
} STableScanPhysiNode;
|
|
|
|
|
|
|
|
|
|
typedef STableScanPhysiNode STableSeqScanPhysiNode;
|
2022-06-15 05:49:29 +00:00
|
|
|
typedef STableScanPhysiNode STableMergeScanPhysiNode;
|
2022-05-10 07:34:41 +00:00
|
|
|
typedef STableScanPhysiNode SStreamScanPhysiNode;
|
2022-02-23 06:34:18 +00:00
|
|
|
|
|
|
|
|
typedef struct SProjectPhysiNode {
|
|
|
|
|
SPhysiNode node;
|
|
|
|
|
SNodeList* pProjections;
|
2022-07-18 08:55:31 +00:00
|
|
|
bool mergeDataBlock;
|
2022-08-08 10:32:04 +00:00
|
|
|
bool ignoreGroupId;
|
2024-01-16 00:13:47 +00:00
|
|
|
bool inputIgnoreGroup;
|
2022-02-23 06:34:18 +00:00
|
|
|
} SProjectPhysiNode;
|
|
|
|
|
|
2022-05-31 03:29:10 +00:00
|
|
|
typedef struct SIndefRowsFuncPhysiNode {
|
|
|
|
|
SPhysiNode node;
|
|
|
|
|
SNodeList* pExprs;
|
2022-06-19 11:39:12 +00:00
|
|
|
SNodeList* pFuncs;
|
2022-05-31 03:29:10 +00:00
|
|
|
} SIndefRowsFuncPhysiNode;
|
|
|
|
|
|
2022-06-19 11:39:12 +00:00
|
|
|
typedef struct SInterpFuncPhysiNode {
|
|
|
|
|
SPhysiNode node;
|
|
|
|
|
SNodeList* pExprs;
|
|
|
|
|
SNodeList* pFuncs;
|
|
|
|
|
STimeWindow timeRange;
|
|
|
|
|
int64_t interval;
|
2022-07-04 09:40:20 +00:00
|
|
|
int8_t intervalUnit;
|
2022-06-20 04:00:57 +00:00
|
|
|
EFillMode fillMode;
|
|
|
|
|
SNode* pFillValues; // SNodeListNode
|
|
|
|
|
SNode* pTimeSeries; // SColumnNode
|
2022-06-19 11:39:12 +00:00
|
|
|
} SInterpFuncPhysiNode;
|
|
|
|
|
|
2022-07-25 07:17:53 +00:00
|
|
|
typedef struct SSortMergeJoinPhysiNode {
|
2023-12-01 10:33:50 +00:00
|
|
|
SPhysiNode node;
|
|
|
|
|
EJoinType joinType;
|
|
|
|
|
EJoinSubType subType;
|
|
|
|
|
SNode* pWindowOffset;
|
|
|
|
|
SNode* pJLimit;
|
2024-01-12 10:29:27 +00:00
|
|
|
int32_t asofOpType;
|
|
|
|
|
SNode* leftPrimExpr;
|
|
|
|
|
SNode* rightPrimExpr;
|
2023-12-01 10:33:50 +00:00
|
|
|
int32_t leftPrimSlotId;
|
|
|
|
|
int32_t rightPrimSlotId;
|
|
|
|
|
SNodeList* pEqLeft;
|
|
|
|
|
SNodeList* pEqRight;
|
|
|
|
|
SNode* pPrimKeyCond; //remove
|
|
|
|
|
SNode* pColEqCond; //remove
|
|
|
|
|
SNode* pColOnCond;
|
|
|
|
|
SNode* pFullOnCond;
|
|
|
|
|
SNodeList* pTargets;
|
2023-12-14 06:13:01 +00:00
|
|
|
SQueryStat inputStat[2];
|
2024-02-22 10:59:10 +00:00
|
|
|
bool seqWinGroup;
|
2024-02-23 09:59:45 +00:00
|
|
|
bool grpJoin;
|
2022-07-25 07:17:53 +00:00
|
|
|
} SSortMergeJoinPhysiNode;
|
2022-04-30 03:40:12 +00:00
|
|
|
|
2023-06-15 11:34:15 +00:00
|
|
|
typedef struct SHashJoinPhysiNode {
|
2023-12-01 10:33:50 +00:00
|
|
|
SPhysiNode node;
|
|
|
|
|
EJoinType joinType;
|
|
|
|
|
EJoinSubType subType;
|
|
|
|
|
SNode* pWindowOffset;
|
|
|
|
|
SNode* pJLimit;
|
|
|
|
|
SNodeList* pOnLeft;
|
|
|
|
|
SNodeList* pOnRight;
|
2024-04-12 07:44:23 +00:00
|
|
|
SNode* leftPrimExpr;
|
|
|
|
|
SNode* rightPrimExpr;
|
|
|
|
|
int32_t leftPrimSlotId;
|
|
|
|
|
int32_t rightPrimSlotId;
|
|
|
|
|
int32_t timeRangeTarget; //table onCond filter
|
|
|
|
|
STimeWindow timeRange; //table onCond filter
|
|
|
|
|
SNode* pLeftOnCond; //table onCond filter
|
|
|
|
|
SNode* pRightOnCond; //table onCond filter
|
|
|
|
|
SNode* pFullOnCond; //preFilter
|
2023-12-01 10:33:50 +00:00
|
|
|
SNodeList* pTargets;
|
|
|
|
|
SQueryStat inputStat[2];
|
|
|
|
|
|
2024-04-10 11:27:36 +00:00
|
|
|
// only in planner internal
|
2023-12-01 10:33:50 +00:00
|
|
|
SNode* pPrimKeyCond;
|
|
|
|
|
SNode* pColEqCond;
|
|
|
|
|
SNode* pTagEqCond;
|
2023-06-15 11:34:15 +00:00
|
|
|
} SHashJoinPhysiNode;
|
|
|
|
|
|
2023-06-29 11:28:32 +00:00
|
|
|
typedef struct SGroupCachePhysiNode {
|
|
|
|
|
SPhysiNode node;
|
2023-06-30 11:20:36 +00:00
|
|
|
bool grpColsMayBeNull;
|
2023-07-11 11:34:03 +00:00
|
|
|
bool grpByUid;
|
2023-07-14 05:30:13 +00:00
|
|
|
bool globalGrp;
|
2023-07-19 02:37:30 +00:00
|
|
|
bool batchFetch;
|
2023-06-29 11:28:32 +00:00
|
|
|
SNodeList* pGroupCols;
|
|
|
|
|
} SGroupCachePhysiNode;
|
|
|
|
|
|
2023-07-05 03:07:08 +00:00
|
|
|
typedef struct SStbJoinDynCtrlBasic {
|
2023-07-26 11:17:59 +00:00
|
|
|
bool batchFetch;
|
2023-07-03 11:29:46 +00:00
|
|
|
int32_t vgSlot[2];
|
|
|
|
|
int32_t uidSlot[2];
|
2023-08-09 02:30:35 +00:00
|
|
|
bool srcScan[2];
|
2023-07-05 03:07:08 +00:00
|
|
|
} SStbJoinDynCtrlBasic;
|
2023-07-03 11:29:46 +00:00
|
|
|
|
2023-06-29 11:28:32 +00:00
|
|
|
typedef struct SDynQueryCtrlPhysiNode {
|
|
|
|
|
SPhysiNode node;
|
|
|
|
|
EDynQueryType qType;
|
2023-07-03 11:29:46 +00:00
|
|
|
union {
|
2023-07-05 03:07:08 +00:00
|
|
|
SStbJoinDynCtrlBasic stbJoin;
|
2023-07-03 11:29:46 +00:00
|
|
|
};
|
2023-06-29 11:28:32 +00:00
|
|
|
} SDynQueryCtrlPhysiNode;
|
|
|
|
|
|
2022-02-24 10:18:41 +00:00
|
|
|
typedef struct SAggPhysiNode {
|
|
|
|
|
SPhysiNode node;
|
2022-04-26 10:15:06 +00:00
|
|
|
SNodeList* pExprs; // these are expression list of group_by_clause and parameter expression of aggregate function
|
2022-03-26 06:58:44 +00:00
|
|
|
SNodeList* pGroupKeys;
|
2022-02-24 10:18:41 +00:00
|
|
|
SNodeList* pAggFuncs;
|
2022-08-01 13:05:44 +00:00
|
|
|
bool mergeDataBlock;
|
2022-12-28 09:27:23 +00:00
|
|
|
bool groupKeyOptimized;
|
2024-03-11 11:29:08 +00:00
|
|
|
bool hasCountLikeFunc;
|
2022-02-24 10:18:41 +00:00
|
|
|
} SAggPhysiNode;
|
|
|
|
|
|
2022-03-09 09:32:12 +00:00
|
|
|
typedef struct SDownstreamSourceNode {
|
2022-04-26 10:15:06 +00:00
|
|
|
ENodeType type;
|
2022-02-28 09:02:43 +00:00
|
|
|
SQueryNodeAddr addr;
|
2022-04-26 10:15:06 +00:00
|
|
|
uint64_t taskId;
|
|
|
|
|
uint64_t schedId;
|
2022-06-30 03:04:49 +00:00
|
|
|
int32_t execId;
|
2022-07-06 12:33:23 +00:00
|
|
|
int32_t fetchMsgType;
|
2022-09-09 11:03:42 +00:00
|
|
|
bool localExec;
|
2022-03-09 09:32:12 +00:00
|
|
|
} SDownstreamSourceNode;
|
2022-02-28 09:02:43 +00:00
|
|
|
|
|
|
|
|
typedef struct SExchangePhysiNode {
|
2022-03-09 09:32:12 +00:00
|
|
|
SPhysiNode node;
|
2022-09-23 03:26:03 +00:00
|
|
|
// for set operators, there will be multiple execution groups under one exchange, and the ids of these execution
|
|
|
|
|
// groups are consecutive
|
|
|
|
|
int32_t srcStartGroupId;
|
|
|
|
|
int32_t srcEndGroupId;
|
2022-06-09 07:17:10 +00:00
|
|
|
bool singleChannel;
|
2022-03-09 09:32:12 +00:00
|
|
|
SNodeList* pSrcEndPoints; // element is SDownstreamSource, scheduler fill by calling qSetSuplanExecutionNode
|
2022-11-24 07:16:38 +00:00
|
|
|
bool seqRecvData;
|
2022-02-28 09:02:43 +00:00
|
|
|
} SExchangePhysiNode;
|
|
|
|
|
|
2022-06-02 02:45:27 +00:00
|
|
|
typedef struct SMergePhysiNode {
|
|
|
|
|
SPhysiNode node;
|
2023-11-07 01:23:06 +00:00
|
|
|
EMergeType type;
|
2022-06-02 02:45:27 +00:00
|
|
|
SNodeList* pMergeKeys;
|
2022-06-06 09:51:25 +00:00
|
|
|
SNodeList* pTargets;
|
2022-06-02 02:45:27 +00:00
|
|
|
int32_t numOfChannels;
|
2023-12-27 06:38:02 +00:00
|
|
|
int32_t numOfSubplans;
|
2022-06-02 02:45:27 +00:00
|
|
|
int32_t srcGroupId;
|
2023-12-27 06:38:02 +00:00
|
|
|
int32_t srcEndGroupId;
|
2022-06-27 07:57:02 +00:00
|
|
|
bool groupSort;
|
2023-05-09 03:33:47 +00:00
|
|
|
bool ignoreGroupId;
|
2023-09-07 05:51:09 +00:00
|
|
|
bool inputWithGroupId;
|
2022-06-02 02:45:27 +00:00
|
|
|
} SMergePhysiNode;
|
|
|
|
|
|
2023-05-19 06:32:03 +00:00
|
|
|
typedef struct SWindowPhysiNode {
|
2022-03-11 10:11:25 +00:00
|
|
|
SPhysiNode node;
|
2022-04-26 10:15:06 +00:00
|
|
|
SNodeList* pExprs; // these are expression list of parameter expression of function
|
2022-03-13 19:28:50 +00:00
|
|
|
SNodeList* pFuncs;
|
2022-06-19 11:39:12 +00:00
|
|
|
SNode* pTspk; // timestamp primary key
|
|
|
|
|
SNode* pTsEnd; // window end timestamp
|
2022-04-26 10:15:06 +00:00
|
|
|
int8_t triggerType;
|
|
|
|
|
int64_t watermark;
|
2022-12-06 08:07:11 +00:00
|
|
|
int64_t deleteMark;
|
2022-06-30 08:16:05 +00:00
|
|
|
int8_t igExpired;
|
2024-03-21 02:50:07 +00:00
|
|
|
int8_t destHasPrimayKey;
|
2022-08-01 13:05:44 +00:00
|
|
|
bool mergeDataBlock;
|
2023-05-19 06:32:03 +00:00
|
|
|
} SWindowPhysiNode;
|
2022-03-23 10:44:02 +00:00
|
|
|
|
|
|
|
|
typedef struct SIntervalPhysiNode {
|
2023-05-19 06:32:03 +00:00
|
|
|
SWindowPhysiNode window;
|
2022-04-26 10:15:06 +00:00
|
|
|
int64_t interval;
|
|
|
|
|
int64_t offset;
|
|
|
|
|
int64_t sliding;
|
|
|
|
|
int8_t intervalUnit;
|
|
|
|
|
int8_t slidingUnit;
|
2022-03-11 10:11:25 +00:00
|
|
|
} SIntervalPhysiNode;
|
|
|
|
|
|
2022-06-23 10:03:15 +00:00
|
|
|
typedef SIntervalPhysiNode SMergeIntervalPhysiNode;
|
2022-06-22 02:53:22 +00:00
|
|
|
typedef SIntervalPhysiNode SMergeAlignedIntervalPhysiNode;
|
2022-05-09 12:20:05 +00:00
|
|
|
typedef SIntervalPhysiNode SStreamIntervalPhysiNode;
|
2022-06-02 08:37:46 +00:00
|
|
|
typedef SIntervalPhysiNode SStreamFinalIntervalPhysiNode;
|
|
|
|
|
typedef SIntervalPhysiNode SStreamSemiIntervalPhysiNode;
|
2023-12-05 12:07:20 +00:00
|
|
|
typedef SIntervalPhysiNode SStreamMidIntervalPhysiNode;
|
2022-05-09 12:20:05 +00:00
|
|
|
|
2022-04-30 03:40:12 +00:00
|
|
|
typedef struct SFillPhysiNode {
|
2022-04-30 06:07:44 +00:00
|
|
|
SPhysiNode node;
|
|
|
|
|
EFillMode mode;
|
2022-08-02 08:18:53 +00:00
|
|
|
SNodeList* pFillExprs;
|
|
|
|
|
SNodeList* pNotFillExprs;
|
2022-04-30 06:07:44 +00:00
|
|
|
SNode* pWStartTs; // SColumnNode
|
|
|
|
|
SNode* pValues; // SNodeListNode
|
|
|
|
|
STimeWindow timeRange;
|
2022-04-30 03:40:12 +00:00
|
|
|
} SFillPhysiNode;
|
|
|
|
|
|
2022-09-27 10:11:44 +00:00
|
|
|
typedef SFillPhysiNode SStreamFillPhysiNode;
|
|
|
|
|
|
2022-04-06 07:22:41 +00:00
|
|
|
typedef struct SMultiTableIntervalPhysiNode {
|
|
|
|
|
SIntervalPhysiNode interval;
|
2022-04-26 10:15:06 +00:00
|
|
|
SNodeList* pPartitionKeys;
|
2022-04-06 07:22:41 +00:00
|
|
|
} SMultiTableIntervalPhysiNode;
|
|
|
|
|
|
2022-03-23 10:44:02 +00:00
|
|
|
typedef struct SSessionWinodwPhysiNode {
|
2023-05-19 06:32:03 +00:00
|
|
|
SWindowPhysiNode window;
|
2022-04-26 10:15:06 +00:00
|
|
|
int64_t gap;
|
2022-03-23 10:44:02 +00:00
|
|
|
} SSessionWinodwPhysiNode;
|
|
|
|
|
|
2022-05-20 11:34:39 +00:00
|
|
|
typedef SSessionWinodwPhysiNode SStreamSessionWinodwPhysiNode;
|
2022-06-17 06:13:45 +00:00
|
|
|
typedef SSessionWinodwPhysiNode SStreamSemiSessionWinodwPhysiNode;
|
|
|
|
|
typedef SSessionWinodwPhysiNode SStreamFinalSessionWinodwPhysiNode;
|
2022-05-20 11:34:39 +00:00
|
|
|
|
2022-04-06 07:22:41 +00:00
|
|
|
typedef struct SStateWinodwPhysiNode {
|
2023-05-19 06:32:03 +00:00
|
|
|
SWindowPhysiNode window;
|
2022-04-26 10:15:06 +00:00
|
|
|
SNode* pStateKey;
|
2022-04-06 07:22:41 +00:00
|
|
|
} SStateWinodwPhysiNode;
|
|
|
|
|
|
2022-06-04 12:06:07 +00:00
|
|
|
typedef SStateWinodwPhysiNode SStreamStateWinodwPhysiNode;
|
|
|
|
|
|
2022-12-08 01:36:37 +00:00
|
|
|
typedef struct SEventWinodwPhysiNode {
|
2023-05-19 06:32:03 +00:00
|
|
|
SWindowPhysiNode window;
|
2022-12-08 01:36:37 +00:00
|
|
|
SNode* pStartCond;
|
|
|
|
|
SNode* pEndCond;
|
|
|
|
|
} SEventWinodwPhysiNode;
|
|
|
|
|
|
2022-12-13 06:18:03 +00:00
|
|
|
typedef SEventWinodwPhysiNode SStreamEventWinodwPhysiNode;
|
|
|
|
|
|
2024-01-17 06:22:19 +00:00
|
|
|
typedef struct SCountWinodwPhysiNode {
|
|
|
|
|
SWindowPhysiNode window;
|
|
|
|
|
int64_t windowCount;
|
2024-01-26 07:56:26 +00:00
|
|
|
int64_t windowSliding;
|
2024-01-17 06:22:19 +00:00
|
|
|
} SCountWinodwPhysiNode;
|
|
|
|
|
|
|
|
|
|
typedef SCountWinodwPhysiNode SStreamCountWinodwPhysiNode;
|
|
|
|
|
|
2022-03-26 06:58:44 +00:00
|
|
|
typedef struct SSortPhysiNode {
|
|
|
|
|
SPhysiNode node;
|
2022-04-26 10:15:06 +00:00
|
|
|
SNodeList* pExprs; // these are expression list of order_by_clause and parameter expression of aggregate function
|
|
|
|
|
SNodeList* pSortKeys; // element is SOrderByExprNode, and SOrderByExprNode::pExpr is SColumnNode
|
2022-04-07 11:08:28 +00:00
|
|
|
SNodeList* pTargets;
|
2023-08-29 07:46:03 +00:00
|
|
|
bool calcGroupId;
|
2023-09-04 01:41:02 +00:00
|
|
|
bool excludePkCol;
|
2022-03-26 06:58:44 +00:00
|
|
|
} SSortPhysiNode;
|
|
|
|
|
|
2022-06-22 15:01:55 +00:00
|
|
|
typedef SSortPhysiNode SGroupSortPhysiNode;
|
|
|
|
|
|
2022-04-06 07:22:41 +00:00
|
|
|
typedef struct SPartitionPhysiNode {
|
|
|
|
|
SPhysiNode node;
|
2022-04-26 10:15:06 +00:00
|
|
|
SNodeList* pExprs; // these are expression list of partition_by_clause
|
2022-04-06 07:22:41 +00:00
|
|
|
SNodeList* pPartitionKeys;
|
2022-04-07 11:08:28 +00:00
|
|
|
SNodeList* pTargets;
|
2023-09-04 01:41:02 +00:00
|
|
|
|
|
|
|
|
bool needBlockOutputTsOrder;
|
|
|
|
|
int32_t tsSlotId;
|
2022-04-06 07:22:41 +00:00
|
|
|
} SPartitionPhysiNode;
|
|
|
|
|
|
2022-09-26 10:39:47 +00:00
|
|
|
typedef struct SStreamPartitionPhysiNode {
|
|
|
|
|
SPartitionPhysiNode part;
|
|
|
|
|
SNodeList* pTags;
|
|
|
|
|
SNode* pSubtable;
|
|
|
|
|
} SStreamPartitionPhysiNode;
|
2022-09-01 07:05:24 +00:00
|
|
|
|
2022-02-28 09:02:43 +00:00
|
|
|
typedef struct SDataSinkNode {
|
2022-04-26 10:15:06 +00:00
|
|
|
ENodeType type;
|
2022-03-04 07:17:04 +00:00
|
|
|
SDataBlockDescNode* pInputDataBlockDesc;
|
2022-02-28 09:02:43 +00:00
|
|
|
} SDataSinkNode;
|
|
|
|
|
|
|
|
|
|
typedef struct SDataDispatcherNode {
|
|
|
|
|
SDataSinkNode sink;
|
|
|
|
|
} SDataDispatcherNode;
|
|
|
|
|
|
|
|
|
|
typedef struct SDataInserterNode {
|
|
|
|
|
SDataSinkNode sink;
|
2022-04-26 10:15:06 +00:00
|
|
|
int32_t numOfTables;
|
|
|
|
|
uint32_t size;
|
2022-10-17 07:43:42 +00:00
|
|
|
void* pData;
|
2022-02-28 09:02:43 +00:00
|
|
|
} SDataInserterNode;
|
|
|
|
|
|
2022-07-05 13:12:10 +00:00
|
|
|
typedef struct SQueryInserterNode {
|
|
|
|
|
SDataSinkNode sink;
|
2022-07-06 08:16:54 +00:00
|
|
|
SNodeList* pCols;
|
2022-07-05 13:12:10 +00:00
|
|
|
uint64_t tableId;
|
2022-07-06 08:16:54 +00:00
|
|
|
uint64_t stableId;
|
2022-07-05 13:12:10 +00:00
|
|
|
int8_t tableType; // table type
|
2022-07-27 09:11:57 +00:00
|
|
|
char tableName[TSDB_TABLE_NAME_LEN];
|
2022-07-05 13:12:10 +00:00
|
|
|
int32_t vgId;
|
|
|
|
|
SEpSet epSet;
|
2023-02-07 10:35:42 +00:00
|
|
|
bool explain;
|
2022-07-05 13:12:10 +00:00
|
|
|
} SQueryInserterNode;
|
|
|
|
|
|
2022-06-05 07:48:06 +00:00
|
|
|
typedef struct SDataDeleterNode {
|
|
|
|
|
SDataSinkNode sink;
|
|
|
|
|
uint64_t tableId;
|
|
|
|
|
int8_t tableType; // table type
|
2022-07-27 09:11:57 +00:00
|
|
|
char tableFName[TSDB_TABLE_NAME_LEN];
|
2022-07-26 09:43:22 +00:00
|
|
|
char tsColName[TSDB_COL_NAME_LEN];
|
2022-06-05 07:48:06 +00:00
|
|
|
STimeWindow deleteTimeRange;
|
2022-06-06 10:39:23 +00:00
|
|
|
SNode* pAffectedRows;
|
2022-09-14 09:51:21 +00:00
|
|
|
SNode* pStartTs;
|
|
|
|
|
SNode* pEndTs;
|
2022-06-05 07:48:06 +00:00
|
|
|
} SDataDeleterNode;
|
|
|
|
|
|
2022-03-02 02:50:51 +00:00
|
|
|
typedef struct SSubplan {
|
2022-04-26 10:15:06 +00:00
|
|
|
ENodeType type;
|
|
|
|
|
SSubplanId id; // unique id of the subplan
|
|
|
|
|
ESubplanType subplanType;
|
|
|
|
|
int32_t msgType; // message type for subplan, used to denote the send message type to vnode.
|
|
|
|
|
int32_t level; // the execution level of current subplan, starting from 0 in a top-down manner.
|
|
|
|
|
char dbFName[TSDB_DB_FNAME_LEN];
|
2022-06-24 09:27:43 +00:00
|
|
|
char user[TSDB_USER_LEN];
|
2022-04-26 10:15:06 +00:00
|
|
|
SQueryNodeAddr execNode; // for the scan/modify subplan, the optional execution node
|
|
|
|
|
SQueryNodeStat execNodeStat; // only for scan subplan
|
|
|
|
|
SNodeList* pChildren; // the datasource subplan,from which to fetch the result
|
|
|
|
|
SNodeList* pParents; // the data destination subplan, get data from current subplan
|
|
|
|
|
SPhysiNode* pNode; // physical plan of current subplan
|
|
|
|
|
SDataSinkNode* pDataSink; // data of the subplan flow into the datasink
|
2022-05-23 11:50:08 +00:00
|
|
|
SNode* pTagCond;
|
2022-06-18 12:15:47 +00:00
|
|
|
SNode* pTagIndexCond;
|
2022-10-28 02:46:04 +00:00
|
|
|
bool showRewrite;
|
2024-02-04 04:28:00 +00:00
|
|
|
bool isView;
|
|
|
|
|
bool isAudit;
|
2023-08-10 03:09:21 +00:00
|
|
|
bool dynamicRowThreshold;
|
2024-02-04 04:28:00 +00:00
|
|
|
int32_t rowsThreshold;
|
2022-03-02 02:50:51 +00:00
|
|
|
} SSubplan;
|
|
|
|
|
|
2022-04-26 10:15:06 +00:00
|
|
|
typedef enum EExplainMode { EXPLAIN_MODE_DISABLE = 1, EXPLAIN_MODE_STATIC, EXPLAIN_MODE_ANALYZE } EExplainMode;
|
2022-03-30 06:50:50 +00:00
|
|
|
|
|
|
|
|
typedef struct SExplainInfo {
|
|
|
|
|
EExplainMode mode;
|
2022-04-26 10:15:06 +00:00
|
|
|
bool verbose;
|
|
|
|
|
double ratio;
|
2022-03-30 06:50:50 +00:00
|
|
|
} SExplainInfo;
|
2022-03-29 06:52:40 +00:00
|
|
|
|
2022-03-02 02:50:51 +00:00
|
|
|
typedef struct SQueryPlan {
|
2022-04-26 10:15:06 +00:00
|
|
|
ENodeType type;
|
|
|
|
|
uint64_t queryId;
|
|
|
|
|
int32_t numOfSubplans;
|
|
|
|
|
SNodeList* pSubplans; // Element is SNodeListNode. The execution level of subplan, starting from 0.
|
2022-03-30 06:50:50 +00:00
|
|
|
SExplainInfo explainInfo;
|
2023-06-12 08:10:54 +00:00
|
|
|
void* pPostPlan;
|
2022-03-02 02:50:51 +00:00
|
|
|
} SQueryPlan;
|
|
|
|
|
|
2022-08-06 07:26:34 +00:00
|
|
|
const char* dataOrderStr(EDataOrderLevel order);
|
|
|
|
|
|
2022-02-13 18:31:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /*_TD_PLANN_NODES_H_*/
|