From 96d1232315d4667353d1effb25a50701372089c2 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Thu, 18 Nov 2021 11:11:34 +0800 Subject: [PATCH] change numOfInputs of function node from uint8_t to int32_t --- src/client/src/tscSQLParser.c | 2 +- src/common/inc/texpr.h | 4 ++-- src/common/src/texpr.c | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 13f2eb161e..693a1e6f3f 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -9590,7 +9590,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS SArray* paramList = pSqlExpr->Expr.paramList; size_t paramSize = paramList ? taosArrayGetSize(paramList) : 0; if (paramSize > 0) { - (*pExpr)->_func.numChildren = (uint8_t)paramSize; + (*pExpr)->_func.numChildren = (int32_t)paramSize; (*pExpr)->_func.pChildren = (tExprNode**)calloc(paramSize, sizeof(tExprNode*)); } for (int32_t i = 0; i < paramSize; ++i) { diff --git a/src/common/inc/texpr.h b/src/common/inc/texpr.h index d7debbeecd..0375e01384 100644 --- a/src/common/inc/texpr.h +++ b/src/common/inc/texpr.h @@ -73,7 +73,7 @@ typedef struct { char* data; } tExprOperandInfo; -typedef void (*_expr_scalar_function_t)(int16_t functionId, tExprOperandInfo* pInputs, uint8_t numInputs, tExprOperandInfo* pOutput, int32_t order); +typedef void (*_expr_scalar_function_t)(int16_t functionId, tExprOperandInfo* pInputs, int32_t numInputs, tExprOperandInfo* pOutput, int32_t order); _expr_scalar_function_t getExprScalarFunction(uint16_t scalar); @@ -126,7 +126,7 @@ typedef struct tExprNode { struct { int16_t functionId; - uint8_t numChildren; + int32_t numChildren; struct tExprNode **pChildren; } _func; }; diff --git a/src/common/src/texpr.c b/src/common/src/texpr.c index 5a301dbbea..24ed08efda 100644 --- a/src/common/src/texpr.c +++ b/src/common/src/texpr.c @@ -321,7 +321,7 @@ void exprTreeInternalNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOper void exprTreeFunctionNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOperandInfo *output, void *param, int32_t order, char *(*getSourceDataBlock)(void *, const char*, int32_t)) { - uint8_t numChildren = pExpr->_func.numChildren; + int32_t numChildren = pExpr->_func.numChildren; if (numChildren == 0) { _expr_scalar_function_t scalarFn = getExprScalarFunction(pExpr->_func.functionId); output->type = pExpr->resultType; @@ -526,7 +526,7 @@ static void exprTreeToBinaryImpl(SBufferWriter* bw, tExprNode* expr) { exprTreeToBinaryImpl(bw, expr->_node.pRight); } else if (expr->nodeType == TSQL_NODE_FUNC) { tbufWriteInt16(bw, expr->_func.functionId); - tbufWriteUint8(bw, expr->_func.numChildren); + tbufWriteInt32(bw, expr->_func.numChildren); for (int i = 0; i < expr->_func.numChildren; ++i) { exprTreeToBinaryImpl(bw, expr->_func.pChildren[i]); } @@ -599,7 +599,7 @@ static tExprNode* exprTreeFromBinaryImpl(SBufferReader* br) { assert(pExpr->_node.pLeft != NULL && pExpr->_node.pRight != NULL); } else if (pExpr->nodeType == TSQL_NODE_FUNC) { pExpr->_func.functionId = tbufReadInt16(br); - pExpr->_func.numChildren = tbufReadUint8(br); + pExpr->_func.numChildren = tbufReadInt32(br); pExpr->_func.pChildren = (tExprNode**)calloc(pExpr->_func.numChildren, sizeof(tExprNode*)); for (int i = 0; i < pExpr->_func.numChildren; ++i) { pExpr->_func.pChildren[i] = exprTreeFromBinaryImpl(br); @@ -1040,7 +1040,7 @@ int32_t exprValidateMathNode(tExprNode *pExpr) { return TSDB_CODE_SUCCESS; } -void vectorConcat(int16_t functionId, tExprOperandInfo* pInputs, uint8_t numInputs, tExprOperandInfo* pOutput, int32_t order) { +void vectorConcat(int16_t functionId, tExprOperandInfo* pInputs, int32_t numInputs, tExprOperandInfo* pOutput, int32_t order) { assert(functionId == TSDB_FUNC_SCALAR_CONCAT && numInputs >=2 && order == TSDB_ORDER_ASC); for (int i = 0; i < numInputs; ++i) { assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows); @@ -1080,7 +1080,7 @@ void vectorConcat(int16_t functionId, tExprOperandInfo* pInputs, uint8_t numInpu free(inputData); } -void vectorLength(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numInputs, tExprOperandInfo* pOutput, int32_t order) { +void vectorLength(int16_t functionId, tExprOperandInfo *pInputs, int32_t numInputs, tExprOperandInfo* pOutput, int32_t order) { assert(functionId == TSDB_FUNC_SCALAR_LENGTH && numInputs == 1 && order == TSDB_ORDER_ASC); char* data0 = NULL; @@ -1102,7 +1102,7 @@ void vectorLength(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numInpu } } -void vectorMathFunc(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numInputs, tExprOperandInfo* pOutput, int32_t order) { +void vectorMathFunc(int16_t functionId, tExprOperandInfo *pInputs, int32_t numInputs, tExprOperandInfo* pOutput, int32_t order) { for (int i = 0; i < numInputs; ++i) { assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows); -- GitLab