diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 0fbeac47e61a6e412acae6697bc2f55b6d85de1f..97a263f86fbaa5b1a11c064ac9453dadcbccdbc0 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -6384,7 +6384,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { break; case QUERY_NODE_INSERT_STMT: pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; - pQuery->msgType = TDMT_VND_SUBMIT; + pQuery->msgType = TDMT_SCH_QUERY; break; case QUERY_NODE_VNODE_MODIF_STMT: pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 0863b5f21f2a1236560ab91b49635bdf2576883d..1dfdaf5f214372414f038bb000451e2ffdcd9ab3 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -1219,14 +1219,27 @@ static int32_t insertSelectSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) { return TSDB_CODE_SUCCESS; } + SLogicSubplan* pNewSubplan = NULL; + SNodeList* pSubplanChildren = info.pSubplan->pChildren; int32_t code = splCreateExchangeNodeForSubplan(pCxt, info.pSubplan, info.pQueryRoot, info.pSubplan->subplanType); if (TSDB_CODE_SUCCESS == code) { - code = nodesListMakeStrictAppend(&info.pSubplan->pChildren, (SNode*)splCreateScanSubplan(pCxt, info.pQueryRoot, 0)); + pNewSubplan = splCreateScanSubplan(pCxt, info.pQueryRoot, 0); + if (NULL == pNewSubplan) { + code = TSDB_CODE_OUT_OF_MEMORY; + } + } + if (TSDB_CODE_SUCCESS == code) { + code = nodesListMakeStrictAppend(&info.pSubplan->pChildren, (SNode*)pNewSubplan); } + if (TSDB_CODE_SUCCESS == code) { + code = unionMountSubplan(pNewSubplan, pSubplanChildren); + } + if (TSDB_CODE_SUCCESS == code) { info.pSubplan->subplanType = SUBPLAN_TYPE_MODIFY; SPLIT_FLAG_SET_MASK(info.pSubplan->splitFlag, SPLIT_FLAG_INSERT_SPLIT); } + ++(pCxt->groupId); pCxt->split = true; return code;