diff --git a/include/libs/scalar/scalar.h b/include/libs/scalar/scalar.h index 582fe5a09bedb38f0c5e57728db09a9536f85c09..5cbe380234de7c2dea9a7363c342926281750af0 100644 --- a/include/libs/scalar/scalar.h +++ b/include/libs/scalar/scalar.h @@ -109,6 +109,8 @@ int32_t apercentileScalarFunction(SScalarParam *pInput, int32_t inputNum, SScala int32_t spreadScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t derivativeScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); int32_t irateScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t twaScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); +int32_t mavgScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput); #ifdef __cplusplus } diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index b9e2b6feafac6763aabaa8949f66fb3fd126033d..31776610b65004a13d77ed94bc3c4e8e158739a8 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2320,6 +2320,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .getEnvFunc = getTwaFuncEnv, .initFunc = twaFunctionSetup, .processFunc = twaFunction, + .sprocessFunc = twaScalarFunction, .finalizeFunc = twaFinalize }, { @@ -2446,6 +2447,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .getEnvFunc = getMavgFuncEnv, .initFunc = mavgFunctionSetup, .processFunc = mavgFunction, + .sprocessFunc = mavgScalarFunction, .finalizeFunc = NULL }, { diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 13b29f8ae3c7c15616a6292e2c1d1da3db164a46..96875281363fb40b06f665d80071b394c1e124cc 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -2413,3 +2413,11 @@ int32_t derivativeScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalar int32_t irateScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { return nonCalcScalarFunction(pInput, inputNum, pOutput); } + +int32_t twaScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return avgScalarFunction(pInput, inputNum, pOutput); +} + +int32_t mavgScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { + return avgScalarFunction(pInput, inputNum, pOutput); +}