From ed6eae4d5894295ecded05b828c6fd729b0a8e13 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 26 May 2022 17:13:13 +0800 Subject: [PATCH] fix(query): fix elapsed function time_unit cannot be smaller than db precision TD-16018 --- source/libs/function/src/builtins.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 8914dca639..f5fa7b8855 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -318,6 +318,11 @@ static int32_t translateElapsed(SFunctionNode* pFunc, char* pErrBuf, int32_t len if (!IS_INTEGER_TYPE(paraType)) { return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } + + if (pValue->datum.i == 0) { + return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_ERROR, + "ELAPSED function time unit parameter should be greater than db precision"); + } } pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; -- GitLab