nodes.h 13.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * 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_NODES_H_
#define _TD_NODES_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "tdef.h"

25 26
#define nodeType(nodeptr)              (((const SNode*)(nodeptr))->type)
#define setNodeType(nodeptr, nodetype) (((SNode*)(nodeptr))->type = (nodetype))
27 28 29

#define LIST_LENGTH(l) (NULL != (l) ? (l)->length : 0)

30 31 32 33
#define FOREACH(node, list)                                                                                   \
  for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL), *pNext;                                     \
       (NULL != cell ? (node = cell->pNode, pNext = cell->pNext, true) : (node = NULL, pNext = NULL, false)); \
       cell = pNext)
34

35 36
#define REPLACE_NODE(newNode) cell->pNode = (SNode*)(newNode)

X
Xiaoyu Wang 已提交
37 38
#define INSERT_LIST(target, src) nodesListInsertList((target), cell, src)

39
#define WHERE_EACH(node, list)                               \
X
Xiaoyu Wang 已提交
40 41 42 43 44 45 46 47
  SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); \
  while (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false))

#define WHERE_NEXT cell = cell->pNext

// only be use in WHERE_EACH
#define ERASE_NODE(list) cell = nodesListErase((list), cell)

48 49 50 51 52 53 54
#define FORBOTH(node1, list1, node2, list2)                                               \
  for (SListCell* cell1 = (NULL != (list1) ? (list1)->pHead : NULL),                      \
                  *cell2 = (NULL != (list2) ? (list2)->pHead : NULL);                     \
       (NULL == cell1 ? (node1 = NULL, false) : (node1 = cell1->pNode, true)),            \
                  (NULL == cell2 ? (node2 = NULL, false) : (node2 = cell2->pNode, true)), \
                  (node1 != NULL && node2 != NULL);                                       \
       cell1 = cell1->pNext, cell2 = cell2->pNext)
55

X
Xiaoyu Wang 已提交
56 57 58
#define REPLACE_LIST1_NODE(newNode) cell1->pNode = (SNode*)(newNode)
#define REPLACE_LIST2_NODE(newNode) cell2->pNode = (SNode*)(newNode)

59 60 61 62
#define FOREACH_FOR_REWRITE(node, list)                           \
  for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); \
       (NULL != cell ? (node = &(cell->pNode), true) : (node = NULL, false)); cell = cell->pNext)

X
Xiaoyu Wang 已提交
63 64 65 66 67 68
#define NODES_DESTORY_NODE(node) \
  do {                           \
    nodesDestroyNode((node));    \
    (node) = NULL;               \
  } while (0)

X
Xiaoyu Wang 已提交
69 70 71 72
#define NODES_DESTORY_LIST(list) \
  do {                           \
    nodesDestroyList((list));    \
    (list) = NULL;               \
73
  } while (0)
74

X
Xiaoyu Wang 已提交
75 76 77 78 79 80
#define NODES_CLEAR_LIST(list) \
  do {                         \
    nodesClearList((list));    \
    (list) = NULL;             \
  } while (0)

81
typedef enum ENodeType {
82 83
  // Syntax nodes are used in parser and planner module, and some are also used in executor module, such as COLUMN,
  // VALUE, OPERATOR, FUNCTION and so on.
84 85 86 87 88 89 90 91 92 93
  QUERY_NODE_COLUMN = 1,
  QUERY_NODE_VALUE,
  QUERY_NODE_OPERATOR,
  QUERY_NODE_LOGIC_CONDITION,
  QUERY_NODE_FUNCTION,
  QUERY_NODE_REAL_TABLE,
  QUERY_NODE_TEMP_TABLE,
  QUERY_NODE_JOIN_TABLE,
  QUERY_NODE_GROUPING_SET,
  QUERY_NODE_ORDER_BY_EXPR,
94
  QUERY_NODE_LIMIT,
95 96 97
  QUERY_NODE_STATE_WINDOW,
  QUERY_NODE_SESSION_WINDOW,
  QUERY_NODE_INTERVAL_WINDOW,
98 99
  QUERY_NODE_NODE_LIST,
  QUERY_NODE_FILL,
100
  QUERY_NODE_RAW_EXPR,  // Only be used in parser module.
X
Xiaoyu Wang 已提交
101
  QUERY_NODE_TARGET,
X
Xiaoyu Wang 已提交
102
  QUERY_NODE_DATABLOCK_DESC,
X
Xiaoyu Wang 已提交
103
  QUERY_NODE_SLOT_DESC,
X
Xiaoyu Wang 已提交
104
  QUERY_NODE_COLUMN_DEF,
X
Xiaoyu Wang 已提交
105
  QUERY_NODE_DOWNSTREAM_SOURCE,
X
Xiaoyu Wang 已提交
106 107 108
  QUERY_NODE_DATABASE_OPTIONS,
  QUERY_NODE_TABLE_OPTIONS,
  QUERY_NODE_INDEX_OPTIONS,
109
  QUERY_NODE_EXPLAIN_OPTIONS,
110
  QUERY_NODE_STREAM_OPTIONS,
111
  QUERY_NODE_LEFT_VALUE,
112
  QUERY_NODE_COLUMN_REF,
X
Xiaoyu Wang 已提交
113 114
  QUERY_NODE_WHEN_THEN,
  QUERY_NODE_CASE_WHEN,
X
Xiaoyu Wang 已提交
115
  QUERY_NODE_EVENT_WINDOW,
116

117
  // Statement nodes are used in parser and planner module.
118
  QUERY_NODE_SET_OPERATOR = 100,
119
  QUERY_NODE_SELECT_STMT,
X
Xiaoyu Wang 已提交
120
  QUERY_NODE_VNODE_MODIFY_STMT,
121
  QUERY_NODE_CREATE_DATABASE_STMT,
122
  QUERY_NODE_DROP_DATABASE_STMT,
123
  QUERY_NODE_ALTER_DATABASE_STMT,
X
Xiaoyu Wang 已提交
124
  QUERY_NODE_FLUSH_DATABASE_STMT,
X
Xiaoyu Wang 已提交
125
  QUERY_NODE_TRIM_DATABASE_STMT,
X
Xiaoyu Wang 已提交
126
  QUERY_NODE_CREATE_TABLE_STMT,
127
  QUERY_NODE_CREATE_SUBTABLE_CLAUSE,
X
Xiaoyu Wang 已提交
128
  QUERY_NODE_CREATE_MULTI_TABLES_STMT,
129 130
  QUERY_NODE_DROP_TABLE_CLAUSE,
  QUERY_NODE_DROP_TABLE_STMT,
131
  QUERY_NODE_DROP_SUPER_TABLE_STMT,
132
  QUERY_NODE_ALTER_TABLE_STMT,
133
  QUERY_NODE_ALTER_SUPER_TABLE_STMT,
134 135 136 137 138 139
  QUERY_NODE_CREATE_USER_STMT,
  QUERY_NODE_ALTER_USER_STMT,
  QUERY_NODE_DROP_USER_STMT,
  QUERY_NODE_USE_DATABASE_STMT,
  QUERY_NODE_CREATE_DNODE_STMT,
  QUERY_NODE_DROP_DNODE_STMT,
140
  QUERY_NODE_ALTER_DNODE_STMT,
X
Xiaoyu Wang 已提交
141
  QUERY_NODE_CREATE_INDEX_STMT,
142
  QUERY_NODE_DROP_INDEX_STMT,
X
Xiaoyu Wang 已提交
143
  QUERY_NODE_CREATE_QNODE_STMT,
144
  QUERY_NODE_DROP_QNODE_STMT,
145 146 147 148 149 150
  QUERY_NODE_CREATE_BNODE_STMT,
  QUERY_NODE_DROP_BNODE_STMT,
  QUERY_NODE_CREATE_SNODE_STMT,
  QUERY_NODE_DROP_SNODE_STMT,
  QUERY_NODE_CREATE_MNODE_STMT,
  QUERY_NODE_DROP_MNODE_STMT,
151 152
  QUERY_NODE_CREATE_TOPIC_STMT,
  QUERY_NODE_DROP_TOPIC_STMT,
X
Xiaoyu Wang 已提交
153
  QUERY_NODE_DROP_CGROUP_STMT,
154
  QUERY_NODE_ALTER_LOCAL_STMT,
155
  QUERY_NODE_EXPLAIN_STMT,
156 157
  QUERY_NODE_DESCRIBE_STMT,
  QUERY_NODE_RESET_QUERY_CACHE_STMT,
X
Xiaoyu Wang 已提交
158
  QUERY_NODE_COMPACT_DATABASE_STMT,
159 160 161 162
  QUERY_NODE_CREATE_FUNCTION_STMT,
  QUERY_NODE_DROP_FUNCTION_STMT,
  QUERY_NODE_CREATE_STREAM_STMT,
  QUERY_NODE_DROP_STREAM_STMT,
X
Xiaoyu Wang 已提交
163
  QUERY_NODE_BALANCE_VGROUP_STMT,
164 165 166 167
  QUERY_NODE_MERGE_VGROUP_STMT,
  QUERY_NODE_REDISTRIBUTE_VGROUP_STMT,
  QUERY_NODE_SPLIT_VGROUP_STMT,
  QUERY_NODE_SYNCDB_STMT,
168 169
  QUERY_NODE_GRANT_STMT,
  QUERY_NODE_REVOKE_STMT,
170
  QUERY_NODE_SHOW_DNODES_STMT,
X
Xiaoyu Wang 已提交
171
  QUERY_NODE_SHOW_MNODES_STMT,
X
Xiaoyu Wang 已提交
172 173
  QUERY_NODE_SHOW_MODULES_STMT,
  QUERY_NODE_SHOW_QNODES_STMT,
174 175
  QUERY_NODE_SHOW_SNODES_STMT,
  QUERY_NODE_SHOW_BNODES_STMT,
176
  QUERY_NODE_SHOW_CLUSTER_STMT,
177
  QUERY_NODE_SHOW_DATABASES_STMT,
X
Xiaoyu Wang 已提交
178 179
  QUERY_NODE_SHOW_FUNCTIONS_STMT,
  QUERY_NODE_SHOW_INDEXES_STMT,
180
  QUERY_NODE_SHOW_STABLES_STMT,
X
Xiaoyu Wang 已提交
181
  QUERY_NODE_SHOW_STREAMS_STMT,
182
  QUERY_NODE_SHOW_TABLES_STMT,
183
  QUERY_NODE_SHOW_TAGS_STMT,
184
  QUERY_NODE_SHOW_USERS_STMT,
X
Xiaoyu Wang 已提交
185
  QUERY_NODE_SHOW_LICENCES_STMT,
186
  QUERY_NODE_SHOW_VGROUPS_STMT,
187
  QUERY_NODE_SHOW_TOPICS_STMT,
188 189 190
  QUERY_NODE_SHOW_CONSUMERS_STMT,
  QUERY_NODE_SHOW_CONNECTIONS_STMT,
  QUERY_NODE_SHOW_QUERIES_STMT,
191
  QUERY_NODE_SHOW_APPS_STMT,
192 193
  QUERY_NODE_SHOW_VARIABLES_STMT,
  QUERY_NODE_SHOW_DNODE_VARIABLES_STMT,
X
Xiaoyu Wang 已提交
194 195
  QUERY_NODE_SHOW_TRANSACTIONS_STMT,
  QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT,
196
  QUERY_NODE_SHOW_VNODES_STMT,
197
  QUERY_NODE_SHOW_USER_PRIVILEGES_STMT,
198 199 200
  QUERY_NODE_SHOW_CREATE_DATABASE_STMT,
  QUERY_NODE_SHOW_CREATE_TABLE_STMT,
  QUERY_NODE_SHOW_CREATE_STABLE_STMT,
201
  QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT,
X
Xiaoyu Wang 已提交
202 203
  QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT,
  QUERY_NODE_SHOW_SCORES_STMT,
204
  QUERY_NODE_SHOW_TABLE_TAGS_STMT,
205 206
  QUERY_NODE_KILL_CONNECTION_STMT,
  QUERY_NODE_KILL_QUERY_STMT,
207
  QUERY_NODE_KILL_TRANSACTION_STMT,
X
Xiaoyu Wang 已提交
208
  QUERY_NODE_DELETE_STMT,
209
  QUERY_NODE_INSERT_STMT,
X
Xiaoyu Wang 已提交
210
  QUERY_NODE_QUERY,
211
  QUERY_NODE_SHOW_DB_ALIVE_STMT,
212 213
  QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT,
  QUERY_NODE_BALANCE_VGROUP_LEADER_STMT,
D
dapan1121 已提交
214 215 216
  QUERY_NODE_RESTORE_DNODE_STMT,
  QUERY_NODE_RESTORE_QNODE_STMT,
  QUERY_NODE_RESTORE_MNODE_STMT,
H
Haojun Liao 已提交
217
  QUERY_NODE_RESTORE_VNODE_STMT,
218 219
  QUERY_NODE_PAUSE_STREAM_STMT,
  QUERY_NODE_RESUME_STREAM_STMT,
X
Xiaoyu Wang 已提交
220

X
Xiaoyu Wang 已提交
221
  // logic plan node
222
  QUERY_NODE_LOGIC_PLAN_SCAN = 1000,
X
Xiaoyu Wang 已提交
223 224
  QUERY_NODE_LOGIC_PLAN_JOIN,
  QUERY_NODE_LOGIC_PLAN_AGG,
X
Xiaoyu Wang 已提交
225
  QUERY_NODE_LOGIC_PLAN_PROJECT,
X
Xiaoyu Wang 已提交
226
  QUERY_NODE_LOGIC_PLAN_VNODE_MODIFY,
X
Xiaoyu Wang 已提交
227
  QUERY_NODE_LOGIC_PLAN_EXCHANGE,
X
Xiaoyu Wang 已提交
228
  QUERY_NODE_LOGIC_PLAN_MERGE,
X
Xiaoyu Wang 已提交
229
  QUERY_NODE_LOGIC_PLAN_WINDOW,
X
Xiaoyu Wang 已提交
230
  QUERY_NODE_LOGIC_PLAN_FILL,
X
Xiaoyu Wang 已提交
231
  QUERY_NODE_LOGIC_PLAN_SORT,
232
  QUERY_NODE_LOGIC_PLAN_PARTITION,
233
  QUERY_NODE_LOGIC_PLAN_INDEF_ROWS_FUNC,
X
Xiaoyu Wang 已提交
234
  QUERY_NODE_LOGIC_PLAN_INTERP_FUNC,
X
Xiaoyu Wang 已提交
235 236
  QUERY_NODE_LOGIC_SUBPLAN,
  QUERY_NODE_LOGIC_PLAN,
X
Xiaoyu Wang 已提交
237 238

  // physical plan node
239
  QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN = 1100,
X
Xiaoyu Wang 已提交
240
  QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN,
X
Xiaoyu Wang 已提交
241
  QUERY_NODE_PHYSICAL_PLAN_TABLE_SEQ_SCAN,
X
Xiaoyu Wang 已提交
242
  QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN,
X
Xiaoyu Wang 已提交
243
  QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN,
244
  QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN,
245
  QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN,
X
Xiaoyu Wang 已提交
246
  QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN,
X
Xiaoyu Wang 已提交
247
  QUERY_NODE_PHYSICAL_PLAN_PROJECT,
248 249
  QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN,
  QUERY_NODE_PHYSICAL_PLAN_HASH_AGG,
X
Xiaoyu Wang 已提交
250
  QUERY_NODE_PHYSICAL_PLAN_EXCHANGE,
X
Xiaoyu Wang 已提交
251
  QUERY_NODE_PHYSICAL_PLAN_MERGE,
X
Xiaoyu Wang 已提交
252
  QUERY_NODE_PHYSICAL_PLAN_SORT,
S
shenglian zhou 已提交
253
  QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT,
X
Xiaoyu Wang 已提交
254
  QUERY_NODE_PHYSICAL_PLAN_HASH_INTERVAL,
255
  QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL,
256
  QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL,
X
Xiaoyu Wang 已提交
257
  QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL,
5
54liuyao 已提交
258
  QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL,
259
  QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL,
X
Xiaoyu Wang 已提交
260
  QUERY_NODE_PHYSICAL_PLAN_FILL,
5
54liuyao 已提交
261
  QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL,
262 263
  QUERY_NODE_PHYSICAL_PLAN_MERGE_SESSION,
  QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION,
264
  QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION,
265 266 267
  QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION,
  QUERY_NODE_PHYSICAL_PLAN_MERGE_STATE,
  QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE,
268
  QUERY_NODE_PHYSICAL_PLAN_PARTITION,
269
  QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION,
270
  QUERY_NODE_PHYSICAL_PLAN_INDEF_ROWS_FUNC,
X
Xiaoyu Wang 已提交
271
  QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC,
X
Xiaoyu Wang 已提交
272
  QUERY_NODE_PHYSICAL_PLAN_DISPATCH,
273
  QUERY_NODE_PHYSICAL_PLAN_INSERT,
274
  QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT,
X
Xiaoyu Wang 已提交
275
  QUERY_NODE_PHYSICAL_PLAN_DELETE,
X
Xiaoyu Wang 已提交
276
  QUERY_NODE_PHYSICAL_SUBPLAN,
X
Xiaoyu Wang 已提交
277
  QUERY_NODE_PHYSICAL_PLAN,
X
Xiaoyu Wang 已提交
278
  QUERY_NODE_PHYSICAL_PLAN_TABLE_COUNT_SCAN,
X
Xiaoyu Wang 已提交
279 280
  QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT,
  QUERY_NODE_PHYSICAL_PLAN_STREAM_EVENT
281 282 283 284
} ENodeType;

/**
 * The first field of a node of any type is guaranteed to be the ENodeType.
285
 * Hence the type of any node can be gotten by casting it to SNode.
286 287 288 289 290
 */
typedef struct SNode {
  ENodeType type;
} SNode;

291
typedef struct SListCell {
292
  struct SListCell* pPrev;
293
  struct SListCell* pNext;
294
  SNode*            pNode;
295 296 297
} SListCell;

typedef struct SNodeList {
298
  int32_t    length;
299 300
  SListCell* pHead;
  SListCell* pTail;
301 302
} SNodeList;

303 304
typedef struct SNodeAllocator SNodeAllocator;

305 306 307 308 309 310 311 312
int32_t nodesInitAllocatorSet();
void    nodesDestroyAllocatorSet();
int32_t nodesCreateAllocator(int64_t queryId, int32_t chunkSize, int64_t* pAllocatorId);
int32_t nodesAcquireAllocator(int64_t allocatorId);
int32_t nodesReleaseAllocator(int64_t allocatorId);
int64_t nodesMakeAllocatorWeakRef(int64_t allocatorId);
int64_t nodesReleaseAllocatorWeakRef(int64_t allocatorId);
void    nodesDestroyAllocator(int64_t allocatorId);
313

314 315
SNode* nodesMakeNode(ENodeType type);
void   nodesDestroyNode(SNode* pNode);
D
dapan1121 已提交
316
void   nodesFree(void* p);
317 318

SNodeList* nodesMakeList();
319 320 321 322
int32_t    nodesListAppend(SNodeList* pList, SNode* pNode);
int32_t    nodesListStrictAppend(SNodeList* pList, SNode* pNode);
int32_t    nodesListMakeAppend(SNodeList** pList, SNode* pNode);
int32_t    nodesListMakeStrictAppend(SNodeList** pList, SNode* pNode);
323 324
int32_t    nodesListAppendList(SNodeList* pTarget, SNodeList* pSrc);
int32_t    nodesListStrictAppendList(SNodeList* pTarget, SNodeList* pSrc);
325
int32_t    nodesListPushFront(SNodeList* pList, SNode* pNode);
326
SListCell* nodesListErase(SNodeList* pList, SListCell* pCell);
327
void       nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc);
328
SNode*     nodesListGetNode(SNodeList* pList, int32_t index);
X
Xiaoyu Wang 已提交
329
SListCell* nodesListGetCell(SNodeList* pList, int32_t index);
330
void       nodesDestroyList(SNodeList* pList);
331 332
bool       nodesListMatch(const SNodeList* pList, const SNodeList* pSubList);

X
Xiaoyu Wang 已提交
333 334
// Only clear the linked list structure, without releasing the elements inside
void nodesClearList(SNodeList* pList);
335

336
typedef enum EDealRes { DEAL_RES_CONTINUE = 1, DEAL_RES_IGNORE_CHILD, DEAL_RES_ERROR, DEAL_RES_END } EDealRes;
337

338
typedef EDealRes (*FNodeWalker)(SNode* pNode, void* pContext);
339
void nodesWalkExpr(SNode* pNode, FNodeWalker walker, void* pContext);
X
Xiaoyu Wang 已提交
340
void nodesWalkExprs(SNodeList* pList, FNodeWalker walker, void* pContext);
341
void nodesWalkExprPostOrder(SNode* pNode, FNodeWalker walker, void* pContext);
X
Xiaoyu Wang 已提交
342
void nodesWalkExprsPostOrder(SNodeList* pList, FNodeWalker walker, void* pContext);
343 344

typedef EDealRes (*FNodeRewriter)(SNode** pNode, void* pContext);
X
Xiaoyu Wang 已提交
345 346 347 348
void nodesRewriteExpr(SNode** pNode, FNodeRewriter rewriter, void* pContext);
void nodesRewriteExprs(SNodeList* pList, FNodeRewriter rewriter, void* pContext);
void nodesRewriteExprPostOrder(SNode** pNode, FNodeRewriter rewriter, void* pContext);
void nodesRewriteExprsPostOrder(SNodeList* pList, FNodeRewriter rewriter, void* pContext);
349

350
bool nodesEqualNode(const SNode* a, const SNode* b);
351
bool nodesMatchNode(const SNode* pSub, const SNode* pNode);
352

353
SNode*     nodesCloneNode(const SNode* pNode);
X
Xiaoyu Wang 已提交
354
SNodeList* nodesCloneList(const SNodeList* pList);
355

356
const char* nodesNodeName(ENodeType type);
357
int32_t     nodesNodeToString(const SNode* pNode, bool format, char** pStr, int32_t* pLen);
358
int32_t     nodesStringToNode(const char* pStr, SNode** pNode);
359

X
Xiaoyu Wang 已提交
360 361 362
int32_t nodesListToString(const SNodeList* pList, bool format, char** pStr, int32_t* pLen);
int32_t nodesStringToList(const char* pStr, SNodeList** pList);

363 364 365
int32_t nodesNodeToMsg(const SNode* pNode, char** pMsg, int32_t* pLen);
int32_t nodesMsgToNode(const char* pStr, int32_t len, SNode** pNode);

366 367
int32_t nodesNodeToSQL(SNode* pNode, char* buf, int32_t bufSize, int32_t* len);
char*   nodesGetNameFromColumnNode(SNode* pNode);
D
dapan1121 已提交
368
int32_t nodesGetOutputNumFromSlotList(SNodeList* pSlots);
D
dapan1121 已提交
369

370 371 372 373 374
#ifdef __cplusplus
}
#endif

#endif /*_TD_NODES_H_*/