diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 3849e90ce4526ea974792969217473eb8aef5925..317b179ea43c933d9a4d2e7f73a91d6ea1a51c87 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1870,6 +1870,12 @@ int tscProcessRetrieveGlobalMergeRsp(SSqlObj *pSql) { // global aggregation may be the upstream for parent query SQueryInfo *pQueryInfo = tscGetQueryInfo(pCmd); + // reset stable limit + if (tscOrderedProjectionQueryOnSTable(pQueryInfo, 0)) { + pQueryInfo->limit.limit = pQueryInfo->clauseLimit; + pQueryInfo->limit.offset = pQueryInfo->prjOffset; + } + if (pQueryInfo->pQInfo == NULL) { STableGroupInfo tableGroupInfo = {.numOfTables = 1, .pGroupList = taosArrayInit(1, POINTER_BYTES),}; tableGroupInfo.map = taosHashInit(1, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);