nodesCloneFuncs.c 13.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * 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/>.
 */

X
Xiaoyu Wang 已提交
16
#include "nodesUtil.h"
17
#include "plannodes.h"
X
Xiaoyu Wang 已提交
18 19
#include "querynodes.h"
#include "taos.h"
X
Xiaoyu Wang 已提交
20
#include "taoserror.h"
21

X
Xiaoyu Wang 已提交
22 23
#define COPY_ALL_SCALAR_FIELDS             \
  do {                                     \
X
Xiaoyu Wang 已提交
24
    memcpy((pDst), (pSrc), sizeof(*pSrc)); \
X
Xiaoyu Wang 已提交
25
  } while (0)
X
Xiaoyu Wang 已提交
26

X
Xiaoyu Wang 已提交
27 28
#define COPY_SCALAR_FIELD(fldname)     \
  do {                                 \
X
Xiaoyu Wang 已提交
29
    (pDst)->fldname = (pSrc)->fldname; \
X
Xiaoyu Wang 已提交
30
  } while (0)
31

X
Xiaoyu Wang 已提交
32 33
#define COPY_CHAR_ARRAY_FIELD(fldname)        \
  do {                                        \
X
Xiaoyu Wang 已提交
34
    strcpy((pDst)->fldname, (pSrc)->fldname); \
X
Xiaoyu Wang 已提交
35
  } while (0)
X
Xiaoyu Wang 已提交
36

X
Xiaoyu Wang 已提交
37 38 39 40 41
#define COPY_CHAR_POINT_FIELD(fldname)         \
  do {                                         \
    if (NULL == (pSrc)->fldname) {             \
      break;                                   \
    }                                          \
X
Xiaoyu Wang 已提交
42
    (pDst)->fldname = strdup((pSrc)->fldname); \
X
Xiaoyu Wang 已提交
43
  } while (0)
X
Xiaoyu Wang 已提交
44

X
Xiaoyu Wang 已提交
45 46 47 48 49
#define CLONE_NODE_FIELD(fldname)                      \
  do {                                                 \
    if (NULL == (pSrc)->fldname) {                     \
      break;                                           \
    }                                                  \
X
Xiaoyu Wang 已提交
50
    (pDst)->fldname = nodesCloneNode((pSrc)->fldname); \
X
Xiaoyu Wang 已提交
51 52 53 54 55 56 57 58 59 60 61
    if (NULL == (pDst)->fldname) {                     \
      nodesDestroyNode((SNode*)(pDst));                \
      return NULL;                                     \
    }                                                  \
  } while (0)

#define CLONE_NODE_LIST_FIELD(fldname)                 \
  do {                                                 \
    if (NULL == (pSrc)->fldname) {                     \
      break;                                           \
    }                                                  \
X
Xiaoyu Wang 已提交
62
    (pDst)->fldname = nodesCloneList((pSrc)->fldname); \
X
Xiaoyu Wang 已提交
63 64 65 66 67 68 69 70 71 72 73
    if (NULL == (pDst)->fldname) {                     \
      nodesDestroyNode((SNode*)(pDst));                \
      return NULL;                                     \
    }                                                  \
  } while (0)

#define CLONE_OBJECT_FIELD(fldname, cloneFunc)    \
  do {                                            \
    if (NULL == (pSrc)->fldname) {                \
      break;                                      \
    }                                             \
74
    (pDst)->fldname = cloneFunc((pSrc)->fldname); \
X
Xiaoyu Wang 已提交
75 76 77 78 79 80 81 82
    if (NULL == (pDst)->fldname) {                \
      nodesDestroyNode((SNode*)(pDst));           \
      return NULL;                                \
    }                                             \
  } while (0)

#define COPY_BASE_OBJECT_FIELD(fldname, copyFunc)                   \
  do {                                                              \
83
    if (NULL == copyFunc(&((pSrc)->fldname), &((pDst)->fldname))) { \
X
Xiaoyu Wang 已提交
84 85 86
      return NULL;                                                  \
    }                                                               \
  } while (0)
87

X
Xiaoyu Wang 已提交
88 89 90 91 92 93 94 95 96 97 98 99 100
static void dataTypeCopy(const SDataType* pSrc, SDataType* pDst) {
  COPY_SCALAR_FIELD(type);
  COPY_SCALAR_FIELD(precision);
  COPY_SCALAR_FIELD(scale);
  COPY_SCALAR_FIELD(bytes);
}

static void exprNodeCopy(const SExprNode* pSrc, SExprNode* pDst) {
  dataTypeCopy(&pSrc->resType, &pDst->resType);
  COPY_CHAR_ARRAY_FIELD(aliasName);
}

static SNode* columnNodeCopy(const SColumnNode* pSrc, SColumnNode* pDst) {
X
Xiaoyu Wang 已提交
101
  exprNodeCopy((const SExprNode*)pSrc, (SExprNode*)pDst);
X
Xiaoyu Wang 已提交
102 103 104 105 106 107
  COPY_SCALAR_FIELD(colId);
  COPY_SCALAR_FIELD(colType);
  COPY_CHAR_ARRAY_FIELD(dbName);
  COPY_CHAR_ARRAY_FIELD(tableName);
  COPY_CHAR_ARRAY_FIELD(tableAlias);
  COPY_CHAR_ARRAY_FIELD(colName);
X
Xiaoyu Wang 已提交
108 109
  COPY_SCALAR_FIELD(dataBlockId);
  COPY_SCALAR_FIELD(slotId);
X
Xiaoyu Wang 已提交
110 111 112 113
  return (SNode*)pDst;
}

static SNode* valueNodeCopy(const SValueNode* pSrc, SValueNode* pDst) {
X
Xiaoyu Wang 已提交
114
  COPY_ALL_SCALAR_FIELDS;
X
Xiaoyu Wang 已提交
115
  exprNodeCopy((const SExprNode*)pSrc, (SExprNode*)pDst);
X
Xiaoyu Wang 已提交
116
  COPY_CHAR_POINT_FIELD(literal);
X
Xiaoyu Wang 已提交
117 118 119
  if (!pSrc->translate) {
    return (SNode*)pDst;
  }
X
Xiaoyu Wang 已提交
120 121 122 123
  switch (pSrc->node.resType.type) {
    case TSDB_DATA_TYPE_NCHAR:
    case TSDB_DATA_TYPE_VARCHAR:
    case TSDB_DATA_TYPE_VARBINARY:
wafwerar's avatar
wafwerar 已提交
124
      pDst->datum.p = taosMemoryMalloc(pSrc->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
X
Xiaoyu Wang 已提交
125 126 127 128
      if (NULL == pDst->datum.p) {
        nodesDestroyNode(pDst);
        return NULL;
      }
X
bugfix  
Xiaoyu Wang 已提交
129
      memcpy(pDst->datum.p, pSrc->datum.p, pSrc->node.resType.bytes + VARSTR_HEADER_SIZE + 1);
X
Xiaoyu Wang 已提交
130 131 132 133 134 135 136 137 138 139 140 141
      break;
    case TSDB_DATA_TYPE_JSON:
    case TSDB_DATA_TYPE_DECIMAL:
    case TSDB_DATA_TYPE_BLOB:
      // todo
    default:
      break;
  }
  return (SNode*)pDst;
}

static SNode* operatorNodeCopy(const SOperatorNode* pSrc, SOperatorNode* pDst) {
X
Xiaoyu Wang 已提交
142
  exprNodeCopy((const SExprNode*)pSrc, (SExprNode*)pDst);
X
Xiaoyu Wang 已提交
143
  COPY_SCALAR_FIELD(opType);
144 145
  CLONE_NODE_FIELD(pLeft);
  CLONE_NODE_FIELD(pRight);
X
Xiaoyu Wang 已提交
146 147 148 149
  return (SNode*)pDst;
}

static SNode* logicConditionNodeCopy(const SLogicConditionNode* pSrc, SLogicConditionNode* pDst) {
X
Xiaoyu Wang 已提交
150
  exprNodeCopy((const SExprNode*)pSrc, (SExprNode*)pDst);
X
Xiaoyu Wang 已提交
151
  COPY_SCALAR_FIELD(condType);
152
  CLONE_NODE_LIST_FIELD(pParameterList);
X
Xiaoyu Wang 已提交
153 154 155 156
  return (SNode*)pDst;
}

static SNode* functionNodeCopy(const SFunctionNode* pSrc, SFunctionNode* pDst) {
S
slzhou 已提交
157
  COPY_ALL_SCALAR_FIELDS;
X
Xiaoyu Wang 已提交
158
  exprNodeCopy((const SExprNode*)pSrc, (SExprNode*)pDst);
X
Xiaoyu Wang 已提交
159 160 161
  COPY_CHAR_ARRAY_FIELD(functionName);
  COPY_SCALAR_FIELD(funcId);
  COPY_SCALAR_FIELD(funcType);
162
  CLONE_NODE_LIST_FIELD(pParameterList);
X
Xiaoyu Wang 已提交
163 164 165
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
166
static SNode* targetNodeCopy(const STargetNode* pSrc, STargetNode* pDst) {
X
Xiaoyu Wang 已提交
167
  COPY_SCALAR_FIELD(dataBlockId);
X
Xiaoyu Wang 已提交
168
  COPY_SCALAR_FIELD(slotId);
169
  CLONE_NODE_FIELD(pExpr);
X
Xiaoyu Wang 已提交
170 171 172
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
173 174
static SNode* groupingSetNodeCopy(const SGroupingSetNode* pSrc, SGroupingSetNode* pDst) {
  COPY_SCALAR_FIELD(groupingSetType);
175 176 177 178
  CLONE_NODE_LIST_FIELD(pParameterList);
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
179 180 181 182 183 184
static SNode* orderByExprNodeCopy(const SOrderByExprNode* pSrc, SOrderByExprNode* pDst) {
  COPY_ALL_SCALAR_FIELDS;
  CLONE_NODE_FIELD(pExpr);
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
185 186 187 188 189 190
static SNode* nodeListNodeCopy(const SNodeListNode* pSrc, SNodeListNode* pDst) {
  COPY_ALL_SCALAR_FIELDS;
  CLONE_NODE_LIST_FIELD(pNodeList);
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
191 192 193 194 195 196
static SNode* fillNodeCopy(const SFillNode* pSrc, SFillNode* pDst) {
  COPY_SCALAR_FIELD(mode);
  CLONE_NODE_FIELD(pValues);
  return (SNode*)pDst;
}

197 198 199 200 201 202 203 204
static SNode* logicNodeCopy(const SLogicNode* pSrc, SLogicNode* pDst) {
  CLONE_NODE_LIST_FIELD(pTargets);
  CLONE_NODE_FIELD(pConditions);
  CLONE_NODE_LIST_FIELD(pChildren);
  return (SNode*)pDst;
}

static STableMeta* tableMetaClone(const STableMeta* pSrc) {
X
Xiaoyu Wang 已提交
205
  int32_t     len = TABLE_META_SIZE(pSrc);
wafwerar's avatar
wafwerar 已提交
206
  STableMeta* pDst = taosMemoryMalloc(len);
207 208 209 210 211 212 213 214
  if (NULL == pDst) {
    return NULL;
  }
  memcpy(pDst, pSrc, len);
  return pDst;
}

static SVgroupsInfo* vgroupsInfoClone(const SVgroupsInfo* pSrc) {
X
Xiaoyu Wang 已提交
215
  int32_t       len = VGROUPS_INFO_SIZE(pSrc);
wafwerar's avatar
wafwerar 已提交
216
  SVgroupsInfo* pDst = taosMemoryMalloc(len);
217 218 219 220 221 222 223 224
  if (NULL == pDst) {
    return NULL;
  }
  memcpy(pDst, pSrc, len);
  return pDst;
}

static SNode* logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) {
225
  COPY_ALL_SCALAR_FIELDS;
226 227
  COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
  CLONE_NODE_LIST_FIELD(pScanCols);
228
  CLONE_NODE_LIST_FIELD(pScanPseudoCols);
229 230
  CLONE_OBJECT_FIELD(pMeta, tableMetaClone);
  CLONE_OBJECT_FIELD(pVgroupList, vgroupsInfoClone);
231 232 233 234 235 236 237 238
  CLONE_NODE_LIST_FIELD(pDynamicScanFuncs);
  return (SNode*)pDst;
}

static SNode* logicJoinCopy(const SJoinLogicNode* pSrc, SJoinLogicNode* pDst) {
  COPY_ALL_SCALAR_FIELDS;
  COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
  CLONE_NODE_FIELD(pOnConditions);
239 240 241 242 243 244 245 246 247 248 249
  return (SNode*)pDst;
}

static SNode* logicAggCopy(const SAggLogicNode* pSrc, SAggLogicNode* pDst) {
  COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
  CLONE_NODE_LIST_FIELD(pGroupKeys);
  CLONE_NODE_LIST_FIELD(pAggFuncs);
  return (SNode*)pDst;
}

static SNode* logicProjectCopy(const SProjectLogicNode* pSrc, SProjectLogicNode* pDst) {
250
  COPY_ALL_SCALAR_FIELDS;
251 252
  COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
  CLONE_NODE_LIST_FIELD(pProjections);
X
Xiaoyu Wang 已提交
253 254 255
  return (SNode*)pDst;
}

256
static SNode* logicVnodeModifCopy(const SVnodeModifLogicNode* pSrc, SVnodeModifLogicNode* pDst) {
X
Xiaoyu Wang 已提交
257
  COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
258
  COPY_SCALAR_FIELD(msgType);
X
Xiaoyu Wang 已提交
259 260 261
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
262 263 264 265 266 267
static SNode* logicExchangeCopy(const SExchangeLogicNode* pSrc, SExchangeLogicNode* pDst) {
  COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
  COPY_SCALAR_FIELD(srcGroupId);
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
268
static SNode* logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* pDst) {
X
bugfix  
Xiaoyu Wang 已提交
269
  COPY_ALL_SCALAR_FIELDS;
X
Xiaoyu Wang 已提交
270 271 272
  COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
  CLONE_NODE_LIST_FIELD(pFuncs);
  CLONE_NODE_FIELD(pFill);
X
bugfix  
Xiaoyu Wang 已提交
273
  CLONE_NODE_FIELD(pTspk);
X
Xiaoyu Wang 已提交
274 275 276
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
277 278 279 280 281 282
static SNode* logicSortCopy(const SSortLogicNode* pSrc, SSortLogicNode* pDst) {
  COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
  CLONE_NODE_LIST_FIELD(pSortKeys);
  return (SNode*)pDst;
}

283 284 285 286 287 288
static SNode* logicPartitionCopy(const SPartitionLogicNode* pSrc, SPartitionLogicNode* pDst) {
  COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
  CLONE_NODE_LIST_FIELD(pPartitionKeys);
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
289
static SNode* logicSubplanCopy(const SLogicSubplan* pSrc, SLogicSubplan* pDst) {
290
  CLONE_NODE_FIELD(pNode);
291 292 293 294
  COPY_SCALAR_FIELD(subplanType);
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
295
static SNode* dataBlockDescCopy(const SDataBlockDescNode* pSrc, SDataBlockDescNode* pDst) {
296
  COPY_ALL_SCALAR_FIELDS;
297
  CLONE_NODE_LIST_FIELD(pSlots);
X
Xiaoyu Wang 已提交
298 299 300 301 302 303 304 305 306 307 308 309
  return (SNode*)pDst;
}

static SNode* slotDescCopy(const SSlotDescNode* pSrc, SSlotDescNode* pDst) {
  COPY_SCALAR_FIELD(slotId);
  dataTypeCopy(&pSrc->dataType, &pDst->dataType);
  COPY_SCALAR_FIELD(reserve);
  COPY_SCALAR_FIELD(output);
  COPY_SCALAR_FIELD(tag);
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
310 311 312 313 314 315 316
static SNode* downstreamSourceCopy(const SDownstreamSourceNode* pSrc, SDownstreamSourceNode* pDst) {
  COPY_SCALAR_FIELD(addr);
  COPY_SCALAR_FIELD(taskId);
  COPY_SCALAR_FIELD(schedId);
  return (SNode*)pDst;
}

X
Xiaoyu Wang 已提交
317
SNodeptr nodesCloneNode(const SNodeptr pNode) {
X
Xiaoyu Wang 已提交
318 319 320 321 322
  if (NULL == pNode) {
    return NULL;
  }
  SNode* pDst = nodesMakeNode(nodeType(pNode));
  if (NULL == pDst) {
X
Xiaoyu Wang 已提交
323
    terrno = TSDB_CODE_OUT_OF_MEMORY;
X
Xiaoyu Wang 已提交
324 325 326 327 328 329 330 331 332 333 334 335 336
    return NULL;
  }
  switch (nodeType(pNode)) {
    case QUERY_NODE_COLUMN:
      return columnNodeCopy((const SColumnNode*)pNode, (SColumnNode*)pDst);
    case QUERY_NODE_VALUE:
      return valueNodeCopy((const SValueNode*)pNode, (SValueNode*)pDst);
    case QUERY_NODE_OPERATOR:
      return operatorNodeCopy((const SOperatorNode*)pNode, (SOperatorNode*)pDst);
    case QUERY_NODE_LOGIC_CONDITION:
      return logicConditionNodeCopy((const SLogicConditionNode*)pNode, (SLogicConditionNode*)pDst);
    case QUERY_NODE_FUNCTION:
      return functionNodeCopy((const SFunctionNode*)pNode, (SFunctionNode*)pDst);
X
Xiaoyu Wang 已提交
337 338
    case QUERY_NODE_TARGET:
      return targetNodeCopy((const STargetNode*)pNode, (STargetNode*)pDst);
X
Xiaoyu Wang 已提交
339 340 341
    case QUERY_NODE_REAL_TABLE:
    case QUERY_NODE_TEMP_TABLE:
    case QUERY_NODE_JOIN_TABLE:
X
Xiaoyu Wang 已提交
342
      break;
X
Xiaoyu Wang 已提交
343
    case QUERY_NODE_GROUPING_SET:
X
Xiaoyu Wang 已提交
344
      return groupingSetNodeCopy((const SGroupingSetNode*)pNode, (SGroupingSetNode*)pDst);
X
Xiaoyu Wang 已提交
345
    case QUERY_NODE_ORDER_BY_EXPR:
X
Xiaoyu Wang 已提交
346
      return orderByExprNodeCopy((const SOrderByExprNode*)pNode, (SOrderByExprNode*)pDst);
X
Xiaoyu Wang 已提交
347
    case QUERY_NODE_LIMIT:
348
      break;
X
Xiaoyu Wang 已提交
349 350
    case QUERY_NODE_NODE_LIST:
      return nodeListNodeCopy((const SNodeListNode*)pNode, (SNodeListNode*)pDst);
X
Xiaoyu Wang 已提交
351 352
    case QUERY_NODE_FILL:
      return fillNodeCopy((const SFillNode*)pNode, (SFillNode*)pDst);
X
Xiaoyu Wang 已提交
353 354 355 356
    case QUERY_NODE_DATABLOCK_DESC:
      return dataBlockDescCopy((const SDataBlockDescNode*)pNode, (SDataBlockDescNode*)pDst);
    case QUERY_NODE_SLOT_DESC:
      return slotDescCopy((const SSlotDescNode*)pNode, (SSlotDescNode*)pDst);
X
Xiaoyu Wang 已提交
357 358
    case QUERY_NODE_DOWNSTREAM_SOURCE:
      return downstreamSourceCopy((const SDownstreamSourceNode*)pNode, (SDownstreamSourceNode*)pDst);
359 360
    case QUERY_NODE_LOGIC_PLAN_SCAN:
      return logicScanCopy((const SScanLogicNode*)pNode, (SScanLogicNode*)pDst);
361 362
    case QUERY_NODE_LOGIC_PLAN_JOIN:
      return logicJoinCopy((const SJoinLogicNode*)pNode, (SJoinLogicNode*)pDst);
363 364 365 366 367 368
    case QUERY_NODE_LOGIC_PLAN_AGG:
      return logicAggCopy((const SAggLogicNode*)pNode, (SAggLogicNode*)pDst);
    case QUERY_NODE_LOGIC_PLAN_PROJECT:
      return logicProjectCopy((const SProjectLogicNode*)pNode, (SProjectLogicNode*)pDst);
    case QUERY_NODE_LOGIC_PLAN_VNODE_MODIF:
      return logicVnodeModifCopy((const SVnodeModifLogicNode*)pNode, (SVnodeModifLogicNode*)pDst);
X
Xiaoyu Wang 已提交
369 370
    case QUERY_NODE_LOGIC_PLAN_EXCHANGE:
      return logicExchangeCopy((const SExchangeLogicNode*)pNode, (SExchangeLogicNode*)pDst);
X
Xiaoyu Wang 已提交
371 372
    case QUERY_NODE_LOGIC_PLAN_WINDOW:
      return logicWindowCopy((const SWindowLogicNode*)pNode, (SWindowLogicNode*)pDst);
X
Xiaoyu Wang 已提交
373 374
    case QUERY_NODE_LOGIC_PLAN_SORT:
      return logicSortCopy((const SSortLogicNode*)pNode, (SSortLogicNode*)pDst);
375 376
    case QUERY_NODE_LOGIC_PLAN_PARTITION:
      return logicPartitionCopy((const SPartitionLogicNode*)pNode, (SPartitionLogicNode*)pDst);
377
    case QUERY_NODE_LOGIC_SUBPLAN:
X
Xiaoyu Wang 已提交
378
      return logicSubplanCopy((const SLogicSubplan*)pNode, (SLogicSubplan*)pDst);
X
Xiaoyu Wang 已提交
379 380 381
    default:
      break;
  }
382 383 384
  nodesDestroyNode(pDst);
  nodesError("nodesCloneNode unknown node = %s", nodesNodeName(nodeType(pNode)));
  return NULL;
X
Xiaoyu Wang 已提交
385 386 387
}

SNodeList* nodesCloneList(const SNodeList* pList) {
X
Xiaoyu Wang 已提交
388 389 390 391
  if (NULL == pList) {
    return NULL;
  }

X
Xiaoyu Wang 已提交
392 393
  SNodeList* pDst = nodesMakeList();
  if (NULL == pDst) {
X
Xiaoyu Wang 已提交
394
    terrno = TSDB_CODE_OUT_OF_MEMORY;
X
Xiaoyu Wang 已提交
395 396 397 398 399 400 401 402 403 404 405 406
    return NULL;
  }
  SNode* pNode;
  FOREACH(pNode, pList) {
    SNode* pNewNode = nodesCloneNode(pNode);
    if (NULL == pNewNode) {
      nodesDestroyList(pDst);
      return NULL;
    }
    nodesListAppend(pDst, pNewNode);
  }
  return pDst;
407
}