Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions source/libs/function/inc/builtins.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ typedef int32_t (*FCreateMergeFuncParameters)(SNodeList* pRawParameters, SNode*
typedef EFuncDataRequired (*FFuncDynDataRequired)(void* pRes, SDataBlockInfo* pBlocInfo);
typedef EFuncReturnRows (*FEstimateReturnRows)(SFunctionNode* pFunc);

#define MAX_FUNC_PARA_NUM 16
#define MAX_FUNC_PARA_FIXED_VALUE_NUM 16
#define MAX_FUNC_PARA_PATTERN_NUM 2
#define MAX_FUNC_INPUT_PARA_NUM 8
#define MAX_FUNC_PARA_FIXED_VALUE_NUM 8
Comment on lines +33 to +35
Comment on lines +33 to +35
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These new macros act as magic numbers. To improve maintainability, please add comments explaining why these specific values were chosen. This context will be valuable for anyone modifying this code in the future.

Suggested change
#define MAX_FUNC_PARA_PATTERN_NUM 2
#define MAX_FUNC_INPUT_PARA_NUM 8
#define MAX_FUNC_PARA_FIXED_VALUE_NUM 8
#define MAX_FUNC_PARA_PATTERN_NUM 2 // Max parameter patterns per function. Currently 1 is used, 2 allows for future extension.
#define MAX_FUNC_INPUT_PARA_NUM 8 // Max parameter descriptors per pattern. `_irate_partial` uses 4.
#define MAX_FUNC_PARA_FIXED_VALUE_NUM 8 // Max fixed values for a parameter. `week` function uses 8.



typedef struct SParamRange {
Expand All @@ -57,7 +58,7 @@ typedef struct SFunctionParaInfo {
int8_t minParamNum;
int8_t maxParamNum;
uint8_t paramInfoPattern;
SParamInfo inputParaInfo[MAX_FUNC_PARA_NUM][MAX_FUNC_PARA_NUM];
SParamInfo inputParaInfo[MAX_FUNC_PARA_PATTERN_NUM][MAX_FUNC_INPUT_PARA_NUM];
SParamInfo outputParaInfo;
} SFunctionParaInfo;

Expand Down
Loading