From 844a0830330b8475e77efbc7d29f87843a65620b Mon Sep 17 00:00:00 2001 From: slzhou Date: Tue, 28 Feb 2023 20:25:23 +0800 Subject: [PATCH] fix: set udf column meta in udfd instead of udf --- source/libs/function/src/udfd.c | 5 ++++- source/libs/function/test/udf1.c | 5 ----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 4e16d5e708..0f761d3d7d 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -580,7 +580,10 @@ void udfdProcessCallRequest(SUvUdfWork *uvUdf, SUdfRequest *request) { switch (call->callType) { case TSDB_UDF_CALL_SCALA_PROC: { SUdfColumn output = {0}; - + output.colMeta.bytes = udf->outputLen; + output.colMeta.type = udf->outputType; + output.colMeta.precision = 0; + output.colMeta.scale = 0; SUdfDataBlock input = {0}; convertDataBlockToUdfDataBlock(&call->block, &input); code = udf->scriptPlugin->udfScalarProcFunc(&input, &output, udf->scriptUdfCtx); diff --git a/source/libs/function/test/udf1.c b/source/libs/function/test/udf1.c index 71d30b6755..a395fc99a9 100644 --- a/source/libs/function/test/udf1.c +++ b/source/libs/function/test/udf1.c @@ -14,11 +14,6 @@ DLL_EXPORT int32_t udf1_init() { return 0; } DLL_EXPORT int32_t udf1_destroy() { return 0; } DLL_EXPORT int32_t udf1(SUdfDataBlock *block, SUdfColumn *resultCol) { - SUdfColumnMeta *meta = &resultCol->colMeta; - meta->bytes = 4; - meta->type = TSDB_DATA_TYPE_INT; - meta->scale = 0; - meta->precision = 0; SUdfColumnData *resultData = &resultCol->colData; resultData->numOfRows = block->numOfRows; -- GitLab