提交 8b6a50d9 编写于 作者: X Xiaoyu Wang

feat: add explain test case

上级 571e936b
...@@ -562,6 +562,7 @@ typedef struct SQueryInserterNode { ...@@ -562,6 +562,7 @@ typedef struct SQueryInserterNode {
char tableName[TSDB_TABLE_NAME_LEN]; char tableName[TSDB_TABLE_NAME_LEN];
int32_t vgId; int32_t vgId;
SEpSet epSet; SEpSet epSet;
bool explain;
} SQueryInserterNode; } SQueryInserterNode;
typedef struct SDataDeleterNode { typedef struct SDataDeleterNode {
......
...@@ -46,6 +46,7 @@ typedef struct SDataInserterHandle { ...@@ -46,6 +46,7 @@ typedef struct SDataInserterHandle {
uint64_t cachedSize; uint64_t cachedSize;
TdThreadMutex mutex; TdThreadMutex mutex;
tsem_t ready; tsem_t ready;
bool explain;
} SDataInserterHandle; } SDataInserterHandle;
typedef struct SSubmitRspParam { typedef struct SSubmitRspParam {
...@@ -333,6 +334,7 @@ int32_t dataBlocksToSubmitReq(SDataInserterHandle* pInserter, void** pMsg, int32 ...@@ -333,6 +334,7 @@ int32_t dataBlocksToSubmitReq(SDataInserterHandle* pInserter, void** pMsg, int32
static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue) { static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue) {
SDataInserterHandle* pInserter = (SDataInserterHandle*)pHandle; SDataInserterHandle* pInserter = (SDataInserterHandle*)pHandle;
if (!pInserter->explain) {
taosArrayPush(pInserter->pDataBlocks, &pInput->pData); taosArrayPush(pInserter->pDataBlocks, &pInput->pData);
void* pMsg = NULL; void* pMsg = NULL;
int32_t msgLen = 0; int32_t msgLen = 0;
...@@ -354,6 +356,7 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput, ...@@ -354,6 +356,7 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput,
if (pInserter->submitRes.code) { if (pInserter->submitRes.code) {
return pInserter->submitRes.code; return pInserter->submitRes.code;
} }
}
*pContinue = true; *pContinue = true;
...@@ -412,6 +415,7 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat ...@@ -412,6 +415,7 @@ int32_t createDataInserter(SDataSinkManager* pManager, const SDataSinkNode* pDat
inserter->pParam = pParam; inserter->pParam = pParam;
inserter->status = DS_BUF_EMPTY; inserter->status = DS_BUF_EMPTY;
inserter->queryEnd = false; inserter->queryEnd = false;
inserter->explain = pInserterNode->explain;
int64_t suid = 0; int64_t suid = 0;
int32_t code = int32_t code =
......
...@@ -2595,6 +2595,7 @@ static const char* jkQueryInsertPhysiPlanTableType = "TableType"; ...@@ -2595,6 +2595,7 @@ static const char* jkQueryInsertPhysiPlanTableType = "TableType";
static const char* jkQueryInsertPhysiPlanTableFName = "TableFName"; static const char* jkQueryInsertPhysiPlanTableFName = "TableFName";
static const char* jkQueryInsertPhysiPlanVgId = "VgId"; static const char* jkQueryInsertPhysiPlanVgId = "VgId";
static const char* jkQueryInsertPhysiPlanEpSet = "EpSet"; static const char* jkQueryInsertPhysiPlanEpSet = "EpSet";
static const char* jkQueryInsertPhysiPlanExplain = "Explain";
static int32_t physiQueryInsertNodeToJson(const void* pObj, SJson* pJson) { static int32_t physiQueryInsertNodeToJson(const void* pObj, SJson* pJson) {
const SQueryInserterNode* pNode = (const SQueryInserterNode*)pObj; const SQueryInserterNode* pNode = (const SQueryInserterNode*)pObj;
...@@ -2621,6 +2622,9 @@ static int32_t physiQueryInsertNodeToJson(const void* pObj, SJson* pJson) { ...@@ -2621,6 +2622,9 @@ static int32_t physiQueryInsertNodeToJson(const void* pObj, SJson* pJson) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddObject(pJson, jkQueryInsertPhysiPlanEpSet, epSetToJson, &pNode->epSet); code = tjsonAddObject(pJson, jkQueryInsertPhysiPlanEpSet, epSetToJson, &pNode->epSet);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonAddBoolToObject(pJson, jkQueryInsertPhysiPlanExplain, pNode->explain);
}
return code; return code;
} }
...@@ -2650,6 +2654,9 @@ static int32_t jsonToPhysiQueryInsertNode(const SJson* pJson, void* pObj) { ...@@ -2650,6 +2654,9 @@ static int32_t jsonToPhysiQueryInsertNode(const SJson* pJson, void* pObj) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tjsonToObject(pJson, jkQueryInsertPhysiPlanEpSet, jsonToEpSet, &pNode->epSet); code = tjsonToObject(pJson, jkQueryInsertPhysiPlanEpSet, jsonToEpSet, &pNode->epSet);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tjsonGetBoolValue(pJson, jkQueryInsertPhysiPlanExplain, &pNode->explain);
}
return code; return code;
} }
......
...@@ -3244,7 +3244,8 @@ enum { ...@@ -3244,7 +3244,8 @@ enum {
PHY_QUERY_INSERT_CODE_TABLE_TYPE, PHY_QUERY_INSERT_CODE_TABLE_TYPE,
PHY_QUERY_INSERT_CODE_TABLE_NAME, PHY_QUERY_INSERT_CODE_TABLE_NAME,
PHY_QUERY_INSERT_CODE_VG_ID, PHY_QUERY_INSERT_CODE_VG_ID,
PHY_QUERY_INSERT_CODE_EP_SET PHY_QUERY_INSERT_CODE_EP_SET,
PHY_QUERY_INSERT_CODE_EXPLAIN
}; };
static int32_t physiQueryInsertNodeToMsg(const void* pObj, STlvEncoder* pEncoder) { static int32_t physiQueryInsertNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
...@@ -3272,6 +3273,9 @@ static int32_t physiQueryInsertNodeToMsg(const void* pObj, STlvEncoder* pEncoder ...@@ -3272,6 +3273,9 @@ static int32_t physiQueryInsertNodeToMsg(const void* pObj, STlvEncoder* pEncoder
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeObj(pEncoder, PHY_QUERY_INSERT_CODE_EP_SET, epSetToMsg, &pNode->epSet); code = tlvEncodeObj(pEncoder, PHY_QUERY_INSERT_CODE_EP_SET, epSetToMsg, &pNode->epSet);
} }
if (TSDB_CODE_SUCCESS == code) {
code = tlvEncodeBool(pEncoder, PHY_QUERY_INSERT_CODE_EXPLAIN, pNode->explain);
}
return code; return code;
} }
...@@ -3307,6 +3311,9 @@ static int32_t msgToPhysiQueryInsertNode(STlvDecoder* pDecoder, void* pObj) { ...@@ -3307,6 +3311,9 @@ static int32_t msgToPhysiQueryInsertNode(STlvDecoder* pDecoder, void* pObj) {
case PHY_QUERY_INSERT_CODE_EP_SET: case PHY_QUERY_INSERT_CODE_EP_SET:
code = tlvDecodeObjFromTlv(pTlv, msgToEpSet, &pNode->epSet); code = tlvDecodeObjFromTlv(pTlv, msgToEpSet, &pNode->epSet);
break; break;
case PHY_QUERY_INSERT_CODE_EXPLAIN:
code = tlvDecodeBool(pTlv, &pNode->explain);
break;
default: default:
break; break;
} }
......
...@@ -1718,6 +1718,7 @@ static int32_t createQueryInserter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNod ...@@ -1718,6 +1718,7 @@ static int32_t createQueryInserter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNod
strcpy(pInserter->tableName, pModify->tableName); strcpy(pInserter->tableName, pModify->tableName);
pInserter->vgId = pModify->pVgroupList->vgroups[0].vgId; pInserter->vgId = pModify->pVgroupList->vgroups[0].vgId;
pInserter->epSet = pModify->pVgroupList->vgroups[0].epSet; pInserter->epSet = pModify->pVgroupList->vgroups[0].epSet;
pInserter->explain = (QUERY_NODE_EXPLAIN_STMT == nodeType(pCxt->pPlanCxt->pAstRoot) ? true : false);
vgroupInfoToNodeAddr(pModify->pVgroupList->vgroups, &pSubplan->execNode); vgroupInfoToNodeAddr(pModify->pVgroupList->vgroups, &pSubplan->execNode);
int32_t code = setListSlotId(pCxt, pSubplan->pNode->pOutputDataBlockDesc->dataBlockId, -1, pModify->pInsertCols, int32_t code = setListSlotId(pCxt, pSubplan->pNode->pOutputDataBlockDesc->dataBlockId, -1, pModify->pInsertCols,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册