fix crash

This commit is contained in:
Ganlin Zhao 2022-07-01 16:34:07 +08:00
parent a239337f5a
commit 55b8271554
1 changed files with 9 additions and 7 deletions

View File

@ -1579,13 +1579,15 @@ static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t le
//add database precision as param //add database precision as param
uint8_t dbPrec = pFunc->node.resType.precision; uint8_t dbPrec = pFunc->node.resType.precision;
int32_t ret = validateTimeUnitParam(dbPrec, (SValueNode *)nodesListGetNode(pFunc->pParameterList, 2)); if (3 == numOfParams) {
if (ret == TIME_UNIT_TOO_SMALL) { int32_t ret = validateTimeUnitParam(dbPrec, (SValueNode *)nodesListGetNode(pFunc->pParameterList, 2));
return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, if (ret == TIME_UNIT_TOO_SMALL) {
"TIMEDIFF function time unit parameter should be greater than db precision"); return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR,
} else if (ret == TIME_UNIT_INVALID) { "TIMEDIFF function time unit parameter should be greater than db precision");
return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, } else if (ret == TIME_UNIT_INVALID) {
"TIMEDIFF function time unit parameter should be one of the following: [1u, 1a, 1s, 1m, 1h, 1d, 1w]"); return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR,
"TIMEDIFF function time unit parameter should be one of the following: [1u, 1a, 1s, 1m, 1h, 1d, 1w]");
}
} }
addDbPrecisonParam(&pFunc->pParameterList, dbPrec); addDbPrecisonParam(&pFunc->pParameterList, dbPrec);