From c6e93b27878aeb1c02836dadd520efd803ff7841 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Tue, 24 May 2022 22:41:24 +0800 Subject: [PATCH] V24 deal with clauseLimit to solve --- src/client/src/tscSQLParser.c | 1 - src/client/src/tscServer.c | 8 +++----- src/client/src/tscUtil.c | 2 -- src/query/inc/qTableMeta.h | 2 -- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 7897fd2739..53faf455ee 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -7547,7 +7547,6 @@ int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlN pQueryInfo->vgroupLimit = pQueryInfo->limit.limit + pQueryInfo->limit.offset; pQueryInfo->limit.limit += pQueryInfo->limit.offset; } - pQueryInfo->offsetAdd = pQueryInfo->limit.offset; pQueryInfo->limit.offset = 0; } } else { diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 64b0b92987..317b179ea4 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1871,11 +1871,9 @@ int tscProcessRetrieveGlobalMergeRsp(SSqlObj *pSql) { // global aggregation may be the upstream for parent query SQueryInfo *pQueryInfo = tscGetQueryInfo(pCmd); // reset stable limit - if (pQueryInfo->offsetAdd > 0){ - ASSERT(pQueryInfo->limit.limit > pQueryInfo->offsetAdd); - pQueryInfo->limit.limit -= pQueryInfo->offsetAdd; - pQueryInfo->limit.offset = pQueryInfo->offsetAdd; - pQueryInfo->offsetAdd = 0; + if (tscOrderedProjectionQueryOnSTable(pQueryInfo, 0)) { + pQueryInfo->limit.limit = pQueryInfo->clauseLimit; + pQueryInfo->limit.offset = pQueryInfo->prjOffset; } if (pQueryInfo->pQInfo == NULL) { diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index dc5663f9e8..ec4f2c1daf 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -3371,7 +3371,6 @@ void tscInitQueryInfo(SQueryInfo* pQueryInfo) { pQueryInfo->slimit.limit = -1; pQueryInfo->slimit.offset = 0; - pQueryInfo->offsetAdd = 0; pQueryInfo->pUpstream = taosArrayInit(4, POINTER_BYTES); pQueryInfo->window = TSWINDOW_INITIALIZER; pQueryInfo->multigroupResult = true; @@ -3862,7 +3861,6 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t pNewQueryInfo->window = pQueryInfo->window; pNewQueryInfo->range = pQueryInfo->range; pNewQueryInfo->limit = pQueryInfo->limit; - pNewQueryInfo->offsetAdd = pQueryInfo->offsetAdd; pNewQueryInfo->slimit = pQueryInfo->slimit; pNewQueryInfo->order = pQueryInfo->order; pNewQueryInfo->tsBuf = NULL; diff --git a/src/query/inc/qTableMeta.h b/src/query/inc/qTableMeta.h index 883e0b457c..d47189691e 100644 --- a/src/query/inc/qTableMeta.h +++ b/src/query/inc/qTableMeta.h @@ -167,8 +167,6 @@ typedef struct SQueryInfo { bool globalMerge; bool multigroupResult; bool isStddev; - - int64_t offsetAdd; // addition add offset } SQueryInfo; /** -- GitLab