From 52aa6f280efe552eadc7270b32844da635f67972 Mon Sep 17 00:00:00 2001 From: factosea <285808407@qq.com> Date: Mon, 15 Jan 2024 15:51:18 +0800 Subject: [PATCH] fix: skip empty result optimization when partition --- source/libs/parser/src/parTranslater.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index e407cc1e81..f254d87487 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -4405,7 +4405,8 @@ static int32_t translateWhere(STranslateContext* pCxt, SSelectStmt* pSelect) { if (TSDB_CODE_SUCCESS == code) { code = getQueryTimeRange(pCxt, pSelect->pWhere, &pSelect->timeRange); } - if (TSDB_CODE_SUCCESS == code && pSelect->timeRange.skey > pSelect->timeRange.ekey) { + if (TSDB_CODE_SUCCESS == code && pSelect->timeRange.skey > pSelect->timeRange.ekey + && (pSelect->pGroupByList == NULL || pSelect->pGroupByList->length == 0)) { pSelect->isEmptyResult = true; } if (pSelect->pWhere != NULL) {