TD-13747 New SQL model integration

This commit is contained in:
Xiaoyu Wang 2022-02-28 05:19:38 -05:00
parent 79e4cc0ea9
commit 649905f4ee
1 changed files with 17 additions and 8 deletions

View File

@ -101,20 +101,29 @@ SNode* nodesMakeNode(ENodeType type) {
return NULL; return NULL;
} }
static EDealRes destroyNode(SNode* pNode, void* pContext) { static EDealRes destroyNode(SNode** pNode, void* pContext) {
switch (nodeType(pNode)) { switch (nodeType(*pNode)) {
case QUERY_NODE_VALUE: case QUERY_NODE_VALUE:
tfree(((SValueNode*)pNode)->literal); tfree(((SValueNode*)(*pNode))->literal);
break;
case QUERY_NODE_LOGIC_CONDITION:
nodesDestroyList(((SLogicConditionNode*)(*pNode))->pParameterList);
break;
case QUERY_NODE_FUNCTION:
nodesDestroyList(((SFunctionNode*)(*pNode))->pParameterList);
break;
case QUERY_NODE_GROUPING_SET:
nodesDestroyList(((SGroupingSetNode*)(*pNode))->pParameterList);
break; break;
default: default:
break; break;
} }
tfree(pNode); tfree(*pNode);
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
void nodesDestroyNode(SNode* pNode) { void nodesDestroyNode(SNode* pNode) {
nodesWalkNodePostOrder(pNode, destroyNode, NULL); nodesRewriteNodePostOrder(&pNode, destroyNode, NULL);
} }
SNodeList* nodesMakeList() { SNodeList* nodesMakeList() {
@ -191,9 +200,9 @@ SNode* nodesListGetNode(SNodeList* pList, int32_t index) {
} }
void nodesDestroyList(SNodeList* pList) { void nodesDestroyList(SNodeList* pList) {
SNode* node; SListCell* pNext = pList->pHead;
FOREACH(node, pList) { while (NULL != pNext) {
nodesDestroyNode(node); pNext = nodesListErase(pList, pNext);
} }
tfree(pList); tfree(pList);
} }