refactor some codes
This commit is contained in:
parent
84a70d8a0e
commit
556fb54d8d
|
@ -4432,7 +4432,9 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
|
||||||
const char* msg1 = "slimit/soffset only available for STable query";
|
const char* msg1 = "slimit/soffset only available for STable query";
|
||||||
const char* msg2 = "function not supported on table";
|
const char* msg2 = "function not supported on table";
|
||||||
const char* msg3 = "slimit/soffset can not apply to projection query";
|
const char* msg3 = "slimit/soffset can not apply to projection query";
|
||||||
|
const char* msg4 = "projection on super table required limitation along with order clause";
|
||||||
|
const char* msg5 = "ordered projection result too large";
|
||||||
|
|
||||||
// handle the limit offset value, validate the limit
|
// handle the limit offset value, validate the limit
|
||||||
pQueryInfo->limit = pQuerySql->limit;
|
pQueryInfo->limit = pQuerySql->limit;
|
||||||
pQueryInfo->clauseLimit = pQueryInfo->limit.limit;
|
pQueryInfo->clauseLimit = pQueryInfo->limit.limit;
|
||||||
|
@ -4458,9 +4460,19 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
|
||||||
if (queryOnTags == true) { // local handle the metric tag query
|
if (queryOnTags == true) { // local handle the metric tag query
|
||||||
pQueryInfo->command = TSDB_SQL_RETRIEVE_TAGS;
|
pQueryInfo->command = TSDB_SQL_RETRIEVE_TAGS;
|
||||||
} else {
|
} else {
|
||||||
if (tscProjectionQueryOnSTable(pQueryInfo, 0) &&
|
if (tscProjectionQueryOnSTable(pQueryInfo, 0)) {
|
||||||
(pQueryInfo->slimit.limit > 0 || pQueryInfo->slimit.offset > 0)) {
|
if (pQueryInfo->order.orderColId != 0) {
|
||||||
return invalidSqlErrMsg(pQueryInfo->msg, msg3);
|
if (pQueryInfo->limit.limit == -1) {
|
||||||
|
return invalidSqlErrMsg(pQueryInfo->msg, msg4);
|
||||||
|
} else if (pQueryInfo->limit.limit > 100000) { // the result set can not be larger than 10000
|
||||||
|
//todo use global config parameter
|
||||||
|
return invalidSqlErrMsg(pQueryInfo->msg, msg5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pQueryInfo->slimit.limit > 0 || pQueryInfo->slimit.offset > 0) {
|
||||||
|
return invalidSqlErrMsg(pQueryInfo->msg, msg3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue