From fddf3f16cf93cced260c3adf74ad9797814b5204 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 22 Mar 2023 19:09:26 +0800 Subject: [PATCH] fix: udf error check --- source/libs/parser/src/parTranslater.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 11f0a5824a..5fef06fc38 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -6396,14 +6396,16 @@ static int32_t translateCreateFunction(STranslateContext* pCxt, SCreateFunctionS return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_FUNCTION_NAME); } - if (TSDB_DATA_TYPE_JSON == pStmt->outputDt.type || - TSDB_DATA_TYPE_VARBINARY == pStmt->outputDt.type || - TSDB_DATA_TYPE_DECIMAL == pStmt->outputDt.type || - TSDB_DATA_TYPE_BLOB == pStmt->outputDt.type || + if (TSDB_DATA_TYPE_JSON == pStmt->outputDt.type || TSDB_DATA_TYPE_VARBINARY == pStmt->outputDt.type || + TSDB_DATA_TYPE_DECIMAL == pStmt->outputDt.type || TSDB_DATA_TYPE_BLOB == pStmt->outputDt.type || TSDB_DATA_TYPE_MEDIUMBLOB == pStmt->outputDt.type) { return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "Unsupported output type for UDF"); } + if (!pStmt->isAgg && pStmt->bufSize > 0) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "BUFSIZE can only be used with UDAF"); + } + SCreateFuncReq req = {0}; strcpy(req.name, pStmt->funcName); req.igExists = pStmt->ignoreExists; -- GitLab