fix: initialize errCode of SMergeProjectsContext
This commit is contained in:
parent
f80af20d3b
commit
4110c00497
|
@ -1405,19 +1405,19 @@ static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SLogicNode* pProjectNode) {
|
static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SLogicNode* pSelfNode) {
|
||||||
SProjectLogicNode* pProject = (SProjectLogicNode*)pProjectNode;
|
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSelfNode->pChildren, 0);
|
||||||
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProjectNode->pChildren, 0);
|
SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild, .errCode = TSDB_CODE_SUCCESS};
|
||||||
SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild};
|
|
||||||
|
|
||||||
nodesRewriteExprs(pProject->pProjections, mergeProjectionsExpr, &cxt);
|
nodesRewriteExprs(((SProjectLogicNode*)pSelfNode)->pProjections, mergeProjectionsExpr, &cxt);
|
||||||
int32_t code = cxt.errCode;
|
int32_t code = cxt.errCode;
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if (1 == LIST_LENGTH(pChild->pChildren)) {
|
if (1 == LIST_LENGTH(pChild->pChildren)) {
|
||||||
SLogicNode* pGrandChild = (SLogicNode*)nodesListGetNode(pChild->pChildren, 0);
|
SLogicNode* pGrandChild = (SLogicNode*)nodesListGetNode(pChild->pChildren, 0);
|
||||||
code = replaceLogicNode(pLogicSubplan, pChild, pGrandChild);
|
code = replaceLogicNode(pLogicSubplan, pChild, pGrandChild);
|
||||||
} else { // no grand child
|
} else { // no grand child
|
||||||
NODES_CLEAR_LIST(pProjectNode->pChildren);
|
NODES_CLEAR_LIST(pSelfNode->pChildren);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue