From 4fef284cfe07d71afe4f088b0d7767f79f1ae636 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 30 Nov 2022 21:26:27 +0800 Subject: [PATCH] refactor: do some internal refactor. --- include/libs/function/function.h | 59 +++++++----------------- include/libs/function/tudf.h | 26 +++++++++++ source/dnode/mgmt/node_util/inc/dmUtil.h | 2 +- 3 files changed, 43 insertions(+), 44 deletions(-) diff --git a/include/libs/function/function.h b/include/libs/function/function.h index 240772bfc2..8fe9d98e57 100644 --- a/include/libs/function/function.h +++ b/include/libs/function/function.h @@ -137,22 +137,22 @@ typedef struct SqlFunctionCtx { int16_t functionId; // function id char *pOutput; // final result output buffer, point to sdata->data int32_t numOfParams; - SFunctParam *param; // input parameter, e.g., top(k, 20), the number of results for top query is kept in param - SColumnInfoData *pTsOutput; // corresponding output buffer for timestamp of each result, e.g., top/bottom*/ - int32_t offset; - struct SResultRowEntryInfo *resultInfo; - SSubsidiaryResInfo subsidiaries; - SPoint1 start; - SPoint1 end; - SFuncExecFuncs fpSet; - SScalarFuncExecFuncs sfp; - struct SExprInfo *pExpr; - struct SSDataBlock *pSrcBlock; - struct SSDataBlock *pDstBlock; // used by indefinite rows function to set selectivity - SSerializeDataHandle saveHandle; - bool isStream; - - char udfName[TSDB_FUNC_NAME_LEN]; + // input parameter, e.g., top(k, 20), the number of results of top query is kept in param + SFunctParam *param; + // corresponding output buffer for timestamp of each result, e.g., diff/csum + SColumnInfoData *pTsOutput; + int32_t offset; + SResultRowEntryInfo *resultInfo; + SSubsidiaryResInfo subsidiaries; + SPoint1 start; + SPoint1 end; + SFuncExecFuncs fpSet; + SScalarFuncExecFuncs sfp; + struct SExprInfo *pExpr; + struct SSDataBlock *pSrcBlock; + struct SSDataBlock *pDstBlock; // used by indefinite rows function to set selectivity + SSerializeDataHandle saveHandle; + char udfName[TSDB_FUNC_NAME_LEN]; } SqlFunctionCtx; typedef struct tExprNode { @@ -182,7 +182,6 @@ struct SScalarParam { }; void cleanupResultRowEntry(struct SResultRowEntryInfo *pCell); -//int32_t getNumOfResult(SqlFunctionCtx *pCtx, int32_t num, SSDataBlock *pResBlock); bool isRowEntryCompleted(struct SResultRowEntryInfo *pEntry); bool isRowEntryInitialized(struct SResultRowEntryInfo *pEntry); @@ -194,32 +193,6 @@ typedef struct SPoint { int32_t taosGetLinearInterpolationVal(SPoint *point, int32_t outputType, SPoint *point1, SPoint *point2, int32_t inputType); -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// udf api -/** - * create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf - * @return error code - */ -int32_t udfcOpen(); - -/** - * destroy udfd proxy - * @return error code - */ -int32_t udfcClose(); - -/** - * start udfd that serves udf function invocation under dnode startDnodeId - * @param startDnodeId - * @return - */ -int32_t udfStartUdfd(int32_t startDnodeId); -/** - * stop udfd - * @return - */ -int32_t udfStopUdfd(); - #ifdef __cplusplus } #endif diff --git a/include/libs/function/tudf.h b/include/libs/function/tudf.h index 31cc53bb9f..b71d50d43c 100644 --- a/include/libs/function/tudf.h +++ b/include/libs/function/tudf.h @@ -85,6 +85,32 @@ int32_t callUdfScalarFunc(char *udfName, SScalarParam *input, int32_t numOfCols, int32_t cleanUpUdfs(); +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// udf api +/** + * create udfd proxy, called once in process that call doSetupUdf/callUdfxxx/doTeardownUdf + * @return error code + */ +int32_t udfcOpen(); + +/** + * destroy udfd proxy + * @return error code + */ +int32_t udfcClose(); + +/** + * start udfd that serves udf function invocation under dnode startDnodeId + * @param startDnodeId + * @return + */ +int32_t udfStartUdfd(int32_t startDnodeId); +/** + * stop udfd + * @return + */ +int32_t udfStopUdfd(); + #ifdef __cplusplus } #endif diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h index 8719e988e7..2124b387ec 100644 --- a/source/dnode/mgmt/node_util/inc/dmUtil.h +++ b/source/dnode/mgmt/node_util/inc/dmUtil.h @@ -39,7 +39,7 @@ #include "sync.h" #include "wal.h" -#include "libs/function/function.h" +#include "libs/function/tudf.h" #ifdef __cplusplus extern "C" { #endif