fix: set parent of new logic node to null

This commit is contained in:
shenglian zhou 2022-06-18 16:24:29 +08:00
parent a215003146
commit 683cf87676
2 changed files with 3 additions and 0 deletions

View File

@ -107,6 +107,7 @@ int32_t createColumnByRewriteExpr(SNode* pExpr, SNodeList** pList) {
int32_t replaceLogicNode(SLogicSubplan* pSubplan, SLogicNode* pOld, SLogicNode* pNew) { int32_t replaceLogicNode(SLogicSubplan* pSubplan, SLogicNode* pOld, SLogicNode* pNew) {
if (NULL == pOld->pParent) { if (NULL == pOld->pParent) {
pSubplan->pNode = (SLogicNode*)pNew; pSubplan->pNode = (SLogicNode*)pNew;
pNew->pParent = NULL;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -57,4 +57,6 @@ TEST_F(PlanOptimizeTest, eliminateProjection) {
useDb("root", "test"); useDb("root", "test");
run("SELECT c1, sum(c3) FROM t1 GROUP BY c1"); run("SELECT c1, sum(c3) FROM t1 GROUP BY c1");
run("SELECT c1 FROM t1");
run("SELECT * FROM st1");
} }