提交 96d12323 编写于 作者: S shenglian zhou

change numOfInputs of function node from uint8_t to int32_t

上级 0f78b09f
...@@ -9590,7 +9590,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS ...@@ -9590,7 +9590,7 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSqlExpr* pS
SArray* paramList = pSqlExpr->Expr.paramList; SArray* paramList = pSqlExpr->Expr.paramList;
size_t paramSize = paramList ? taosArrayGetSize(paramList) : 0; size_t paramSize = paramList ? taosArrayGetSize(paramList) : 0;
if (paramSize > 0) { if (paramSize > 0) {
(*pExpr)->_func.numChildren = (uint8_t)paramSize; (*pExpr)->_func.numChildren = (int32_t)paramSize;
(*pExpr)->_func.pChildren = (tExprNode**)calloc(paramSize, sizeof(tExprNode*)); (*pExpr)->_func.pChildren = (tExprNode**)calloc(paramSize, sizeof(tExprNode*));
} }
for (int32_t i = 0; i < paramSize; ++i) { for (int32_t i = 0; i < paramSize; ++i) {
......
...@@ -73,7 +73,7 @@ typedef struct { ...@@ -73,7 +73,7 @@ typedef struct {
char* data; char* data;
} tExprOperandInfo; } 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); _expr_scalar_function_t getExprScalarFunction(uint16_t scalar);
...@@ -126,7 +126,7 @@ typedef struct tExprNode { ...@@ -126,7 +126,7 @@ typedef struct tExprNode {
struct { struct {
int16_t functionId; int16_t functionId;
uint8_t numChildren; int32_t numChildren;
struct tExprNode **pChildren; struct tExprNode **pChildren;
} _func; } _func;
}; };
......
...@@ -321,7 +321,7 @@ void exprTreeInternalNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOper ...@@ -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, void exprTreeFunctionNodeTraverse(tExprNode *pExpr, int32_t numOfRows, tExprOperandInfo *output, void *param, int32_t order,
char *(*getSourceDataBlock)(void *, const char*, int32_t)) { char *(*getSourceDataBlock)(void *, const char*, int32_t)) {
uint8_t numChildren = pExpr->_func.numChildren; int32_t numChildren = pExpr->_func.numChildren;
if (numChildren == 0) { if (numChildren == 0) {
_expr_scalar_function_t scalarFn = getExprScalarFunction(pExpr->_func.functionId); _expr_scalar_function_t scalarFn = getExprScalarFunction(pExpr->_func.functionId);
output->type = pExpr->resultType; output->type = pExpr->resultType;
...@@ -526,7 +526,7 @@ static void exprTreeToBinaryImpl(SBufferWriter* bw, tExprNode* expr) { ...@@ -526,7 +526,7 @@ static void exprTreeToBinaryImpl(SBufferWriter* bw, tExprNode* expr) {
exprTreeToBinaryImpl(bw, expr->_node.pRight); exprTreeToBinaryImpl(bw, expr->_node.pRight);
} else if (expr->nodeType == TSQL_NODE_FUNC) { } else if (expr->nodeType == TSQL_NODE_FUNC) {
tbufWriteInt16(bw, expr->_func.functionId); tbufWriteInt16(bw, expr->_func.functionId);
tbufWriteUint8(bw, expr->_func.numChildren); tbufWriteInt32(bw, expr->_func.numChildren);
for (int i = 0; i < expr->_func.numChildren; ++i) { for (int i = 0; i < expr->_func.numChildren; ++i) {
exprTreeToBinaryImpl(bw, expr->_func.pChildren[i]); exprTreeToBinaryImpl(bw, expr->_func.pChildren[i]);
} }
...@@ -599,7 +599,7 @@ static tExprNode* exprTreeFromBinaryImpl(SBufferReader* br) { ...@@ -599,7 +599,7 @@ static tExprNode* exprTreeFromBinaryImpl(SBufferReader* br) {
assert(pExpr->_node.pLeft != NULL && pExpr->_node.pRight != NULL); assert(pExpr->_node.pLeft != NULL && pExpr->_node.pRight != NULL);
} else if (pExpr->nodeType == TSQL_NODE_FUNC) { } else if (pExpr->nodeType == TSQL_NODE_FUNC) {
pExpr->_func.functionId = tbufReadInt16(br); 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*)); pExpr->_func.pChildren = (tExprNode**)calloc(pExpr->_func.numChildren, sizeof(tExprNode*));
for (int i = 0; i < pExpr->_func.numChildren; ++i) { for (int i = 0; i < pExpr->_func.numChildren; ++i) {
pExpr->_func.pChildren[i] = exprTreeFromBinaryImpl(br); pExpr->_func.pChildren[i] = exprTreeFromBinaryImpl(br);
...@@ -1040,7 +1040,7 @@ int32_t exprValidateMathNode(tExprNode *pExpr) { ...@@ -1040,7 +1040,7 @@ int32_t exprValidateMathNode(tExprNode *pExpr) {
return TSDB_CODE_SUCCESS; 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); assert(functionId == TSDB_FUNC_SCALAR_CONCAT && numInputs >=2 && order == TSDB_ORDER_ASC);
for (int i = 0; i < numInputs; ++i) { for (int i = 0; i < numInputs; ++i) {
assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows); assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows);
...@@ -1080,7 +1080,7 @@ void vectorConcat(int16_t functionId, tExprOperandInfo* pInputs, uint8_t numInpu ...@@ -1080,7 +1080,7 @@ void vectorConcat(int16_t functionId, tExprOperandInfo* pInputs, uint8_t numInpu
free(inputData); 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); assert(functionId == TSDB_FUNC_SCALAR_LENGTH && numInputs == 1 && order == TSDB_ORDER_ASC);
char* data0 = NULL; char* data0 = NULL;
...@@ -1102,7 +1102,7 @@ void vectorLength(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numInpu ...@@ -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) { for (int i = 0; i < numInputs; ++i) {
assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows); assert(pInputs[i].numOfRows == 1 || pInputs[i].numOfRows == pOutput->numOfRows);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册