diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index f942713f5da5a9ce9db9088c178f11813d9be48c..6a6fd50f2a47656856e5fd5936e3eed01481503f 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -171,6 +171,7 @@ typedef struct SExchangeLogicNode { SLogicNode node; int32_t srcStartGroupId; int32_t srcEndGroupId; + bool seqRecvData; } SExchangeLogicNode; typedef struct SMergeLogicNode { @@ -416,6 +417,7 @@ typedef struct SExchangePhysiNode { int32_t srcEndGroupId; bool singleChannel; SNodeList* pSrcEndPoints; // element is SDownstreamSource, scheduler fill by calling qSetSuplanExecutionNode + bool seqRecvData; } SExchangePhysiNode; typedef struct SMergePhysiNode { diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c index 08fef721073e721d0d31e45d8eb36c55905c4a78..db053ca7b22adba6483db4dac713f80061abf8c7 100644 --- a/source/libs/executor/src/exchangeoperator.c +++ b/source/libs/executor/src/exchangeoperator.c @@ -299,7 +299,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode SExchangeOpStopInfo stopInfo = {QUERY_NODE_PHYSICAL_PLAN_EXCHANGE, pInfo->self}; qAppendTaskStopInfo(pTaskInfo, &stopInfo); - pInfo->seqLoadData = false; + pInfo->seqLoadData = true; pInfo->pTransporter = pTransporter; setOperatorInfo(pOperator, "ExchangeOperator", QUERY_NODE_PHYSICAL_PLAN_EXCHANGE, false, OP_NOT_OPENED, pInfo, pTaskInfo); diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index b9b365fb42c62ec9400b85450c3bca40ac920730..5b3e8ce5a9334e05fa184427469314482d960a74 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -434,6 +434,7 @@ static int32_t logicExchangeCopy(const SExchangeLogicNode* pSrc, SExchangeLogicN COPY_BASE_OBJECT_FIELD(node, logicNodeCopy); COPY_SCALAR_FIELD(srcStartGroupId); COPY_SCALAR_FIELD(srcEndGroupId); + COPY_SCALAR_FIELD(seqRecvData); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 172c7694334d9a5199716434d169724c449eb037..462ac513a513601e5fef22c9cd6b1224e90f4ab3 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1864,6 +1864,7 @@ static int32_t jsonToPhysiAggNode(const SJson* pJson, void* pObj) { static const char* jkExchangePhysiPlanSrcStartGroupId = "SrcStartGroupId"; static const char* jkExchangePhysiPlanSrcEndGroupId = "SrcEndGroupId"; static const char* jkExchangePhysiPlanSrcEndPoints = "SrcEndPoints"; +static const char* jkExchangePhysiPlanSeqRecvData = "SeqRecvData"; static int32_t physiExchangeNodeToJson(const void* pObj, SJson* pJson) { const SExchangePhysiNode* pNode = (const SExchangePhysiNode*)pObj; @@ -1878,6 +1879,9 @@ static int32_t physiExchangeNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = nodeListToJson(pJson, jkExchangePhysiPlanSrcEndPoints, pNode->pSrcEndPoints); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddBoolToObject(pJson, jkExchangePhysiPlanSeqRecvData, pNode->seqRecvData); + } return code; } @@ -1895,6 +1899,9 @@ static int32_t jsonToPhysiExchangeNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkExchangePhysiPlanSrcEndPoints, &pNode->pSrcEndPoints); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetBoolValue(pJson, jkExchangePhysiPlanSeqRecvData, &pNode->seqRecvData); + } return code; } diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c index 2879d55167f82821399b5296c16514af306d8dd6..1e8ff8da1a9d2484604199d91732ac2cf4ee141a 100644 --- a/source/libs/nodes/src/nodesMsgFuncs.c +++ b/source/libs/nodes/src/nodesMsgFuncs.c @@ -2428,7 +2428,8 @@ enum { PHY_EXCHANGE_CODE_SRC_START_GROUP_ID, PHY_EXCHANGE_CODE_SRC_END_GROUP_ID, PHY_EXCHANGE_CODE_SINGLE_CHANNEL, - PHY_EXCHANGE_CODE_SRC_ENDPOINTS + PHY_EXCHANGE_CODE_SRC_ENDPOINTS, + PHY_EXCHANGE_CODE_SEQ_RECV_DATA }; static int32_t physiExchangeNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { @@ -2447,6 +2448,9 @@ static int32_t physiExchangeNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { if (TSDB_CODE_SUCCESS == code) { code = tlvEncodeObj(pEncoder, PHY_EXCHANGE_CODE_SRC_ENDPOINTS, nodeListToMsg, pNode->pSrcEndPoints); } + if (TSDB_CODE_SUCCESS == code) { + code = tlvEncodeBool(pEncoder, PHY_EXCHANGE_CODE_SEQ_RECV_DATA, pNode->seqRecvData); + } return code; } @@ -2473,6 +2477,9 @@ static int32_t msgToPhysiExchangeNode(STlvDecoder* pDecoder, void* pObj) { case PHY_EXCHANGE_CODE_SRC_ENDPOINTS: code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pSrcEndPoints); break; + case PHY_EXCHANGE_CODE_SEQ_RECV_DATA: + code = tlvDecodeBool(pTlv, &pNode->seqRecvData); + break; default: break; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index bb4aa677673cf0ecf69b5723e6d76683302b8cea..0743b4066260c9dc517dc87131422134b9b12af8 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -3685,9 +3685,19 @@ static int32_t translateInsertProject(STranslateContext* pCxt, SInsertStmt* pIns return addOrderByPrimaryKeyToQuery(pCxt, pPrimaryKeyExpr, pInsert->pQuery); } +static int32_t translateInsertTable(STranslateContext* pCxt, SNode* pTable) { + int32_t code = translateFrom(pCxt, pTable); + if (TSDB_CODE_SUCCESS == code && TSDB_CHILD_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType && + TSDB_NORMAL_TABLE != ((SRealTableNode*)pTable)->pMeta->tableType) { + code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, + "insert data into super table is not supported"); + } + return code; +} + static int32_t translateInsert(STranslateContext* pCxt, SInsertStmt* pInsert) { pCxt->pCurrStmt = (SNode*)pInsert; - int32_t code = translateFrom(pCxt, pInsert->pTable); + int32_t code = translateInsertTable(pCxt, pInsert->pTable); if (TSDB_CODE_SUCCESS == code) { code = translateInsertCols(pCxt, pInsert); } diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 72f3d995bc9bf7edfd5cc9b585bd24f3069342c4..379bfe90c8c3e4a65beee8d1d66dce1aebcc325f 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -1064,6 +1064,7 @@ static int32_t doCreateExchangePhysiNode(SPhysiPlanContext* pCxt, SExchangeLogic pExchange->srcStartGroupId = pExchangeLogicNode->srcStartGroupId; pExchange->srcEndGroupId = pExchangeLogicNode->srcEndGroupId; + pExchange->seqRecvData = pExchangeLogicNode->seqRecvData; *pPhyNode = (SPhysiNode*)pExchange; return TSDB_CODE_SUCCESS; diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 0cbca8b03214eed4daf466159f166d4c4411d19d..bcf4b40e698ad8c6f9fde793af5eb538e44d9b6d 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -733,6 +733,17 @@ static int32_t stbSplSplitWindowForCrossTable(SSplitContext* pCxt, SStableSplitI return TSDB_CODE_PLAN_INTERNAL_ERROR; } +static bool stbSplNeedSeqRecvData(SLogicNode* pNode) { + if (NULL == pNode) { + return false; + } + + if (NULL != pNode->pLimit || NULL != pNode->pSlimit) { + return true; + } + return stbSplNeedSeqRecvData(pNode->pParent); +} + static int32_t stbSplSplitWindowForPartTable(SSplitContext* pCxt, SStableSplitInfo* pInfo) { if (pCxt->pPlanCxt->streamQuery) { SPLIT_FLAG_SET_MASK(pInfo->pSubplan->splitFlag, SPLIT_FLAG_STABLE_SPLIT); @@ -748,6 +759,7 @@ static int32_t stbSplSplitWindowForPartTable(SSplitContext* pCxt, SStableSplitIn code = replaceLogicNode(pInfo->pSubplan, pInfo->pSplitNode, (SLogicNode*)pExchange); } if (TSDB_CODE_SUCCESS == code) { + pExchange->seqRecvData = stbSplNeedSeqRecvData((SLogicNode*)pExchange); code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren, (SNode*)splCreateScanSubplan(pCxt, pInfo->pSplitNode, SPLIT_FLAG_STABLE_SPLIT)); }