add interval value check

This commit is contained in:
wpan 2021-07-05 18:18:24 +08:00
parent d441dee5e0
commit 752db3477a
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