chore: naming optimization
This commit is contained in:
parent
4ea44c429d
commit
ac72466429
|
@ -5069,11 +5069,11 @@ static bool validRollupFunc(const char* pFunc) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool caclRollupFunc(const char* pFunc) {
|
static bool aggrRollupFunc(const char* pFunc) {
|
||||||
static const char* calcRollupFuncs[] = {"avg", "sum"};
|
static const char* aggrRollupFuncs[] = {"avg", "sum"};
|
||||||
static const int32_t numOfCalcRollupFuncs = (sizeof(calcRollupFuncs) / sizeof(char*));
|
static const int32_t numOfAggrRollupFuncs = (sizeof(aggrRollupFuncs) / sizeof(char*));
|
||||||
for (int i = 0; i < numOfCalcRollupFuncs; ++i) {
|
for (int i = 0; i < numOfAggrRollupFuncs; ++i) {
|
||||||
if (0 == strcmp(calcRollupFuncs[i], pFunc)) {
|
if (0 == strcmp(aggrRollupFuncs[i], pFunc)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5153,7 +5153,8 @@ static int32_t checkTableTagsSchema(STranslateContext* pCxt, SHashObj* pHash, SN
|
||||||
return code;
|
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);
|
int32_t ncols = LIST_LENGTH(pCols);
|
||||||
if (ncols < TSDB_MIN_COLUMNS) {
|
if (ncols < TSDB_MIN_COLUMNS) {
|
||||||
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMNS_NUM);
|
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;
|
int32_t rowSize = 0;
|
||||||
SNode* pNode = NULL;
|
SNode* pNode = NULL;
|
||||||
char* pFunc = NULL;
|
char* pFunc = NULL;
|
||||||
bool isCalcRollup = false;
|
bool isAggrRollup = false;
|
||||||
|
|
||||||
if (pRollupFuncs) {
|
if (pRollupFuncs) {
|
||||||
pFunc = ((SFunctionNode*)nodesListGetNode(pRollupFuncs, 0))->functionName;
|
pFunc = ((SFunctionNode*)nodesListGetNode(pRollupFuncs, 0))->functionName;
|
||||||
isCalcRollup = caclRollupFunc(pFunc);
|
isAggrRollup = aggrRollupFunc(pFunc);
|
||||||
}
|
}
|
||||||
FOREACH(pNode, pCols) {
|
FOREACH(pNode, pCols) {
|
||||||
SColumnDefNode* pCol = (SColumnDefNode*)pNode;
|
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) {
|
if (pCol->dataType.type != TSDB_DATA_TYPE_FLOAT && pCol->dataType.type != TSDB_DATA_TYPE_DOUBLE) {
|
||||||
code =
|
code =
|
||||||
generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN,
|
generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COLUMN,
|
||||||
|
|
Loading…
Reference in New Issue