diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 830caad486f58e75041fb4048a84ebe878769373..76237ebb9518eb4dc831f417b5ee2adf16d2a3b9 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -954,6 +954,20 @@ static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pPar SMergeCtx* tctx = &ctxlist[*tableMIdx]; tctx->compared = 1; } + + for (int32_t i = 0; i < tableNum; ++i) { + tableMIdx = taosArrayGet(tagCond, i); + SMergeCtx* tctx = &ctxlist[*tableMIdx]; + if (tctx->p->num <= 0 || tctx->p->pIdTagList == NULL) { + mergeDone = 1; + break; + } + } + + if (mergeDone) { + mergeDone = 0; + continue; + } tableMIdx = taosArrayGet(tagCond, slot);