From ac7246642972245f277ebea9a7acf89724e15628 Mon Sep 17 00:00:00 2001 From: kailixu Date: Fri, 27 Oct 2023 15:11:35 +0800 Subject: [PATCH] chore: naming optimization --- source/libs/parser/src/parTranslater.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 316f5c54d3..b8433a4472 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -5069,11 +5069,11 @@ static bool validRollupFunc(const char* pFunc) { return false; } -static bool caclRollupFunc(const char* pFunc) { - static const char* calcRollupFuncs[] = {"avg", "sum"}; - static const int32_t numOfCalcRollupFuncs = (sizeof(calcRollupFuncs) / sizeof(char*)); - for (int i = 0; i < numOfCalcRollupFuncs; ++i) { - if (0 == strcmp(calcRollupFuncs[i], pFunc)) { +static bool aggrRollupFunc(const char* pFunc) { + static const char* aggrRollupFuncs[] = {"avg", "sum"}; + static const int32_t numOfAggrRollupFuncs = (sizeof(aggrRollupFuncs) / sizeof(char*)); + for (int i = 0; i < numOfAggrRollupFuncs; ++i) { + if (0 == strcmp(aggrRollupFuncs[i], pFunc)) { return true; } } @@ -5153,7 +5153,8 @@ static int32_t checkTableTagsSchema(STranslateContext* pCxt, SHashObj* pHash, SN return code; } -static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, int32_t ntags, SNodeList* pCols, SNodeList* pRollupFuncs) { +static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, int32_t ntags, SNodeList* pCols, + SNodeList* pRollupFuncs) { int32_t ncols = LIST_LENGTH(pCols); if (ncols < TSDB_MIN_COLUMNS) { return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM); @@ -5167,11 +5168,11 @@ static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, in int32_t rowSize = 0; SNode* pNode = NULL; char* pFunc = NULL; - bool isCalcRollup = false; + bool isAggrRollup = false; if (pRollupFuncs) { pFunc = ((SFunctionNode*)nodesListGetNode(pRollupFuncs, 0))->functionName; - isCalcRollup = caclRollupFunc(pFunc); + isAggrRollup = aggrRollupFunc(pFunc); } FOREACH(pNode, pCols) { SColumnDefNode* pCol = (SColumnDefNode*)pNode; @@ -5196,7 +5197,7 @@ static int32_t checkTableColsSchema(STranslateContext* pCxt, SHashObj* pHash, in } } - if (TSDB_CODE_SUCCESS == code && isCalcRollup && 0 != colIndex) { + if (TSDB_CODE_SUCCESS == code && isAggrRollup && 0 != colIndex) { if (pCol->dataType.type != TSDB_DATA_TYPE_FLOAT && pCol->dataType.type != TSDB_DATA_TYPE_DOUBLE) { code = generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN,