Merge pull request #6747 from taosdata/hotfix/TD-5051

[TD-5051]add interval value check
This commit is contained in:
Haojun Liao 2021-07-05 22:56:47 +08:00 committed by GitHub
commit d63df5673a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -916,7 +916,8 @@ static int32_t checkInvalidExprForTimeWindow(SSqlCmd* pCmd, SQueryInfo* pQueryIn
int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pSqlNode) {
const char* msg1 = "sliding cannot be used without interval";
const char* msg2 = "interval cannot be less than 10 ms";
const char* msg2 = "interval cannot be less than 1 us";
const char* msg3 = "interval value is too small";
SSqlCmd* pCmd = &pSql->cmd;
@ -943,6 +944,10 @@ int32_t validateIntervalNode(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNode* pS
return TSDB_CODE_TSC_INVALID_OPERATION;
}
if (pQueryInfo->interval.interval <= 0) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
}
if (pQueryInfo->interval.intervalUnit != 'n' && pQueryInfo->interval.intervalUnit != 'y') {
// interval cannot be less than 10 milliseconds