From 76e0ed8966a9d46807cb518c8673adb8263a4d50 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 11 Jul 2022 21:01:43 +0800 Subject: [PATCH] fix(query): add parameter check. --- source/libs/function/src/builtins.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index fc87ba964a..b4e0e82ac6 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -1427,9 +1427,12 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) } static int32_t translateFirstLast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) { - // first(col_list) will be rewritten as first(col) - if (1 != LIST_LENGTH(pFunc->pParameterList)) { - return TSDB_CODE_SUCCESS; + int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList); + for (int32_t i = 0; i < numOfParams; ++i) { + SNode* pParamNode = nodesListGetNode(pFunc->pParameterList, i); + if (QUERY_NODE_VALUE == nodeType(pParamNode)) { + return invaildFuncParaValueErrMsg(pErrBuf, len, pFunc->functionName); + } } pFunc->node.resType = ((SExprNode*)nodesListGetNode(pFunc->pParameterList, 0))->resType; -- GitLab