enh: command/explain

This commit is contained in:
factosea 2024-11-12 15:03:48 +08:00
parent 8f5dc8a4ca
commit 0bb872c1d9
2 changed files with 6 additions and 1 deletions

View File

@ -56,6 +56,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe
int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeBufSize, numOfCols); int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, dataEncodeBufSize, numOfCols);
if(len < 0) { if(len < 0) {
taosMemoryFree(*pRsp); taosMemoryFree(*pRsp);
*pRsp = NULL;
return terrno; return terrno;
} }
SET_PAYLOAD_LEN((*pRsp)->data, len, len); SET_PAYLOAD_LEN((*pRsp)->data, len, len);
@ -957,8 +958,8 @@ static int32_t buildLocalVariablesResultDataBlock(SSDataBlock** pOutput) {
_exit: _exit:
if (terrno != TSDB_CODE_SUCCESS) { if (terrno != TSDB_CODE_SUCCESS) {
taosMemoryFree(pBlock);
taosArrayDestroy(pBlock->pDataBlock); taosArrayDestroy(pBlock->pDataBlock);
taosMemoryFree(pBlock);
} }
return terrno; return terrno;
} }

View File

@ -2112,6 +2112,7 @@ static int32_t qExplainGenerateRsp(SExplainCtx *pCtx, SRetrieveTableRsp **pRsp)
} }
int32_t qExplainUpdateExecInfo(SExplainCtx *pCtx, SExplainRsp *pRspMsg, int32_t groupId, SRetrieveTableRsp **pRsp) { int32_t qExplainUpdateExecInfo(SExplainCtx *pCtx, SExplainRsp *pRspMsg, int32_t groupId, SRetrieveTableRsp **pRsp) {
if(!pCtx || !pRspMsg || !pRsp) return TSDB_CODE_INVALID_PARA;
SExplainResNode *node = NULL; SExplainResNode *node = NULL;
int32_t code = 0; int32_t code = 0;
bool groupDone = false; bool groupDone = false;
@ -2176,6 +2177,7 @@ _exit:
} }
int32_t qExecStaticExplain(SQueryPlan *pDag, SRetrieveTableRsp **pRsp) { int32_t qExecStaticExplain(SQueryPlan *pDag, SRetrieveTableRsp **pRsp) {
if (!pDag || !pRsp) return TSDB_CODE_INVALID_PARA;
int32_t code = 0; int32_t code = 0;
SExplainCtx *pCtx = NULL; SExplainCtx *pCtx = NULL;
@ -2188,6 +2190,7 @@ _return:
} }
int32_t qExecExplainBegin(SQueryPlan *pDag, SExplainCtx **pCtx, int64_t startTs) { int32_t qExecExplainBegin(SQueryPlan *pDag, SExplainCtx **pCtx, int64_t startTs) {
if(!pDag || !pCtx) return TSDB_CODE_INVALID_PARA;
QRY_ERR_RET(qExplainPrepareCtx(pDag, pCtx)); QRY_ERR_RET(qExplainPrepareCtx(pDag, pCtx));
(*pCtx)->reqStartTs = startTs; (*pCtx)->reqStartTs = startTs;
@ -2197,6 +2200,7 @@ int32_t qExecExplainBegin(SQueryPlan *pDag, SExplainCtx **pCtx, int64_t startTs)
} }
int32_t qExecExplainEnd(SExplainCtx *pCtx, SRetrieveTableRsp **pRsp) { int32_t qExecExplainEnd(SExplainCtx *pCtx, SRetrieveTableRsp **pRsp) {
if(!pCtx || !pRsp) return TSDB_CODE_INVALID_PARA;
int32_t code = 0; int32_t code = 0;
pCtx->jobDoneTs = taosGetTimestampUs(); pCtx->jobDoneTs = taosGetTimestampUs();