fix(query): enable the limitation on the number of query results within each group.
This commit is contained in:
parent
3db512e08f
commit
7c6bc10760
|
@ -358,8 +358,16 @@ SRequestObj* launchQuery(STscObj* pTscObj, const char* sql, int sqlLen) {
|
||||||
SQuery* pQuery = NULL;
|
SQuery* pQuery = NULL;
|
||||||
|
|
||||||
int32_t code = buildRequest(pTscObj, sql, sqlLen, &pRequest);
|
int32_t code = buildRequest(pTscObj, sql, sqlLen, &pRequest);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
code = parseSql(pRequest, false, &pQuery, NULL);
|
terrno = code;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
code = parseSql(pRequest, false, &pQuery, NULL);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
destroyRequest(pRequest);
|
||||||
|
terrno = code;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return launchQueryImpl(pRequest, pQuery, code, false);
|
return launchQueryImpl(pRequest, pQuery, code, false);
|
||||||
|
|
|
@ -4994,13 +4994,12 @@ static int32_t handleLimitOffset(SOperatorInfo* pOperator, SSDataBlock* pBlock)
|
||||||
pProjectInfo->curOffset = 0;
|
pProjectInfo->curOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check for the limitation in each group
|
||||||
|
if (pProjectInfo->limit.limit > 0 && pProjectInfo->curOutput + pRes->info.rows >= pProjectInfo->limit.limit) {
|
||||||
|
pRes->info.rows = (int32_t)(pProjectInfo->limit.limit - pProjectInfo->curOutput);
|
||||||
|
}
|
||||||
|
|
||||||
if (pRes->info.rows >= pOperator->resultInfo.threshold) {
|
if (pRes->info.rows >= pOperator->resultInfo.threshold) {
|
||||||
|
|
||||||
// check for the limitation in each group
|
|
||||||
if (pProjectInfo->limit.limit > 0 && pProjectInfo->curOutput + pRes->info.rows >= pProjectInfo->limit.limit) {
|
|
||||||
pRes->info.rows = (int32_t)(pProjectInfo->limit.limit - pProjectInfo->curOutput);
|
|
||||||
}
|
|
||||||
|
|
||||||
return PROJECT_RETRIEVE_DONE;
|
return PROJECT_RETRIEVE_DONE;
|
||||||
} else { // not full enough, continue to accumulate the output data in the buffer.
|
} else { // not full enough, continue to accumulate the output data in the buffer.
|
||||||
return PROJECT_RETRIEVE_CONTINUE;
|
return PROJECT_RETRIEVE_CONTINUE;
|
||||||
|
|
|
@ -1069,7 +1069,6 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
|
||||||
|
|
||||||
if (TSDB_QUERY_HAS_TYPE(pCxt->pOutput->insertType, TSDB_QUERY_TYPE_STMT_INSERT) && tbNum > 0) {
|
if (TSDB_QUERY_HAS_TYPE(pCxt->pOutput->insertType, TSDB_QUERY_TYPE_STMT_INSERT) && tbNum > 0) {
|
||||||
return buildInvalidOperationMsg(&pCxt->msg, "single table allowed in one stmt");
|
return buildInvalidOperationMsg(&pCxt->msg, "single table allowed in one stmt");
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
destroyInsertParseContextForTable(pCxt);
|
destroyInsertParseContextForTable(pCxt);
|
||||||
|
|
Loading…
Reference in New Issue