diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 5c6209dc4d..068998e469 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -1528,7 +1528,15 @@ int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols, if (code != 0) { return code; } + SUdfcUvSession *session = handle; code = doCallUdfScalarFunc(handle, input, numOfCols, output); + if (session->outputType != output->columnData->info.type + || session->outputLen != output->columnData->info.bytes) { + fnError("udfc scalar function calculate error, session type: %d(%d), output type: %d(%d)", + session->outputType, session->outputLen, + output->columnData->info.type, output->columnData->info.bytes); + code = TSDB_CODE_UDF_INVALID_OUTPUT_TYPE; + } releaseUdfFuncHandle(udfName); return code; } diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index cbb2e7f362..006914bf65 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -139,7 +139,7 @@ void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) { SUdf* udf = msgInfo->param; udf->funcType = pFuncInfo->funcType; udf->scriptType = pFuncInfo->scriptType; - udf->outputType = pFuncInfo->funcType; + udf->outputType = pFuncInfo->outputType; udf->outputLen = pFuncInfo->outputLen; udf->bufSize = pFuncInfo->bufSize;