diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h index d7ded9d6f1..25894e9af7 100644 --- a/source/libs/command/inc/commandInt.h +++ b/source/libs/command/inc/commandInt.h @@ -69,6 +69,10 @@ extern "C" { #define EXPLAIN_EVENT_END_FORMAT "End Cond: " #define EXPLAIN_GROUP_CACHE_FORMAT "Group Cache" #define EXPLAIN_DYN_QRY_CTRL_FORMAT "Dynamic Query Control for %s" +#define EXPLAIN_COUNT_FORMAT "Count" +#define EXPLAIN_COUNT_INFO_FORMAT "Window Count Info" +#define EXPLAIN_COUNT_NUM_FORMAT "Window Count=%d" +#define EXPLAIN_COUNT_SLIDING_FORMAT "Window Sliding=%d" #define EXPLAIN_PLANNING_TIME_FORMAT "Planning Time: %.3f ms" #define EXPLAIN_EXEC_TIME_FORMAT "Execution Time: %.3f ms" diff --git a/source/libs/command/src/explain.c b/source/libs/command/src/explain.c index 66b50bcb47..ebe8543fae 100644 --- a/source/libs/command/src/explain.c +++ b/source/libs/command/src/explain.c @@ -1735,6 +1735,31 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i } break; } + case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT: { + SCountWinodwPhysiNode *pCountNode = (SCountWinodwPhysiNode *)pNode; + EXPLAIN_ROW_NEW(level, EXPLAIN_COUNT_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT); + if (pResNode->pExecInfo) { + QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen)); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + } + EXPLAIN_ROW_APPEND(EXPLAIN_FUNCTIONS_FORMAT, pCountNode->window.pFuncs->length); + EXPLAIN_ROW_APPEND(EXPLAIN_BLANK_FORMAT); + EXPLAIN_ROW_APPEND(EXPLAIN_WIDTH_FORMAT, pCountNode->window.node.pOutputDataBlockDesc->totalRowSize); + EXPLAIN_ROW_APPEND(EXPLAIN_RIGHT_PARENTHESIS_FORMAT); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level)); + + if (verbose) { + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_COUNT_NUM_FORMAT, pCountNode->windowCount); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + EXPLAIN_ROW_NEW(level + 1, EXPLAIN_COUNT_SLIDING_FORMAT, pCountNode->windowSliding); + EXPLAIN_ROW_END(); + QRY_ERR_RET(qExplainResAppendRow(ctx, tbuf, tlen, level + 1)); + } + break; + } default: qError("not supported physical node type %d", pNode->type); return TSDB_CODE_APP_ERROR;