diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 7897fd2739deb20fb1c2fb7ac004957df3e5c234..53faf455ee749967d8442f5069419ae788d90f63 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 64b0b92987272a9f9e1aba3f824fddce13d67bb9..317b179ea43c933d9a4d2e7f73a91d6ea1a51c87 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 dc5663f9e8b818a1b7f47b0b6c3d4c8d84fc7b97..ec4f2c1daf4cd35a984f7e2f2cf4dab8f47659f8 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 883e0b457cc4fa62c6420cbb84b22b51ae0bb7d3..d47189691ebbe2c4ec3ad55dd72306686586a56e 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; /**