TDengine/source/libs/function/inc/builtins.h
WANG Xu c52c68aa4f
sync: apply remaining build system changes from monorepo (main)
The following commits could not be applied individually due to context
differences between the monorepo and the public repo's build files.
They have been applied as a cumulative diff to ensure the final state
matches the monorepo exactly:

- chore: sync CI files with 3.0 branch to eliminate merge conflicts (rd-public/tsdb!271)
- revert(refactor): dynamically link taosd taosudf taosmqtt against libtaosnative.so to reduce binary size (revert #183) (rd-public/tsdb!282)
- fix(docs): autofix formatting issues across all doc files (rd-public/tsdb!296)
- feat: support -DBUILD_SANITIZER=true on windows for debug build (rd-public/tsdb!291)
- feat(build): build cache, mirror, and sccache optimizations (rd-public/tsdb!326)
- docs: update image for three replica (rd-public/tsdb!324)
- enh: shared storage on windows (rd-public/tsdb!333)
- fix(cmake): convert ext_libs3 from git clone to URL tarball download (rd-public/tsdb!360)
- feat: dual-source deps and comprehensive docs/packaging (cherry-pick to main) (rd-public/tsdb!352)
- fix(cmake): guard DOWNLOAD_EXTRACT_TIMESTAMP for CMake < 3.24 and fix duplicate Cargo.lock entry (rd-public/tsdb!369)
- fix: test case execution failure in pytest.sh (rd-public/tsdb!338)
- enh: built-in compilation support for Python UDF plugins use abi3 (rd-public/tsdb!325)
2026-05-23 14:11:50 +08:00

96 lines
3.2 KiB
C

/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_BUILDINS_H_
#define _TD_BUILDINS_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "functionMgtInt.h"
struct SFunctionParaInfo;
typedef int32_t (*FTranslateFunc)(SFunctionNode* pFunc, char* pErrBuf, int32_t len);
typedef EFuncDataRequired (*FFuncDataRequired)(SFunctionNode* pFunc, STimeWindow* pTimeWindow);
typedef int32_t (*FCreateMergeFuncParameters)(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters);
typedef EFuncDataRequired (*FFuncDynDataRequired)(void* pRes, SDataBlockInfo* pBlocInfo);
typedef EFuncReturnRows (*FEstimateReturnRows)(SFunctionNode* pFunc);
#define MAX_FUNC_PARA_PATTERN_NUM 2
#define MAX_FUNC_INPUT_PARA_NUM 8
#define MAX_FUNC_PARA_FIXED_VALUE_NUM 8
typedef struct SParamRange {
int64_t iMinVal;
int64_t iMaxVal;
} SParamRange;
typedef struct SParamInfo {
bool isLastParam;
int8_t startParam;
int8_t endParam;
uint64_t validDataType;
uint64_t validNodeType;
uint64_t paramAttribute;
uint8_t valueRangeFlag; // 0 for no range and no fixed value, 1 for value has range, 2 for fixed value
uint8_t fixedValueSize;
char* fixedStrValue[MAX_FUNC_PARA_FIXED_VALUE_NUM]; // used for input parameter
int64_t fixedNumValue[MAX_FUNC_PARA_FIXED_VALUE_NUM]; // used for input parameter
SParamRange range;
} SParamInfo;
typedef struct SFunctionParaInfo {
int8_t minParamNum;
int8_t maxParamNum;
uint8_t paramInfoPattern;
SParamInfo inputParaInfo[MAX_FUNC_PARA_PATTERN_NUM][MAX_FUNC_INPUT_PARA_NUM];
SParamInfo outputParaInfo;
} SFunctionParaInfo;
typedef struct SBuiltinFuncDefinition {
const char* name;
EFunctionType type;
uint64_t classification;
SFunctionParaInfo parameters;
FTranslateFunc translateFunc;
FFuncDataRequired dataRequiredFunc;
FFuncDynDataRequired dynDataRequiredFunc;
FExecGetEnv getEnvFunc;
FExecInit initFunc;
FExecProcess processFunc;
FScalarExecProcess sprocessFunc;
FExecFinalize finalizeFunc;
FExecCleanUp cleanupFunc;
FExecCombine combineFunc;
const char* pPartialFunc;
const char* pMiddleFunc;
const char* pMergeFunc;
const char* pStateFunc;
FCreateMergeFuncParameters createMergeParaFuc;
FEstimateReturnRows estimateReturnRowsFunc;
processFuncByRow processFuncByRow;
} SBuiltinFuncDefinition;
extern const SBuiltinFuncDefinition funcMgtBuiltins[];
extern const int32_t funcMgtBuiltinsNum;
#ifdef __cplusplus
}
#endif
#endif /*_TD_BUILDINS_H_*/