diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 2a9dd28819..dd2dccc02d 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -174,7 +174,7 @@ bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_ int32_t queryCreateTableMetaFromMsg(STableMetaRsp* msg, bool isSuperTable, STableMeta** pMeta); char *jobTaskStatusStr(int32_t status); -int32_t qAppendTaskExplainResRows(void **pRowCtx, struct SSubplan *plan, void *pExecTree, int32_t level); +int32_t qAppendTaskExplainResRows(void **pRowCtx, void *plan, void *pExecTree, int32_t level); int32_t qGetExplainRspFromRowCtx(void *ctx, SRetrieveTableRsp **pRsp); void qFreeExplainRowCtx(void *ctx); diff --git a/source/libs/qcom/src/queryExplain.c b/source/libs/qcom/src/queryExplain.c index d352a29e3c..e1bdf96331 100644 --- a/source/libs/qcom/src/queryExplain.c +++ b/source/libs/qcom/src/queryExplain.c @@ -478,11 +478,13 @@ _return: QRY_RET(code); } -int32_t qAppendTaskExplainResRows(void **pRowCtx, struct SSubplan *plan, void *pExecTree, int32_t level) { +int32_t qAppendTaskExplainResRows(void **pRowCtx, void *plan, void *pExecTree, int32_t level) { SExplainResNode *node = NULL; int32_t code = 0; + struct SSubplan *pPlan = (struct SSubplan *)plan; + SExplainRowCtx *ctx = (SExplainRowCtx *)*pRowCtx; - QRY_ERR_RET(qGenerateExplainResNodeTree(plan, pExecTree, &node)); + QRY_ERR_RET(qGenerateExplainResNodeTree(pPlan, pExecTree, &node)); if (NULL == *pRowCtx) { *pRowCtx = taosMemoryCalloc(1, sizeof(SExplainRowCtx)); @@ -491,24 +493,25 @@ int32_t qAppendTaskExplainResRows(void **pRowCtx, struct SSubplan *plan, void *p QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } + ctx = (SExplainRowCtx *)*pRowCtx; + SArray *rows = taosArrayInit(10, sizeof(SQueryExplainRowInfo)); if (NULL == rows) { qError("taosArrayInit SQueryExplainRowInfo failed"); QRY_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - (*pRowCtx)->rows = rows; + ctx->rows = rows; } - - QRY_ERR_JRET(qGenerateExplainResRowsFromNode(node, *pRowCtx, level)); + + QRY_ERR_JRET(qGenerateExplainResRowsFromNode(node, ctx, level)); _return: qFreeExplainResTree(node); if (code) { - taosArrayDestroy((*pRowCtx)->rows); - taosMemoryFree(*pRowCtx); + qFreeExplainRowCtx(*pRowCtx); *pRowCtx = NULL; } diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 376febcdf3..d11dafb19b 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -527,7 +527,7 @@ int32_t schValidateAndBuildJobExplain(SQueryPlan *pDag, SSchJob *pJob) { SSchExplainGroup group = {.nodeNum = 1, .plan = plan}; if (0 != taosHashPut(groupHash, &plan->id.groupId, sizeof(plan->id.groupId), &group, sizeof(group))) { - SCH_TASK_ELOG("taosHashPut to explainGroupHash failed, taskIdx:%d", n); + SCH_JOB_ELOG("taosHashPut to explainGroupHash failed, taskIdx:%d", n); SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } }