From 1c6991d4d9c1a3e9cf6b12e94a5e5a9f66b708bc Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Mon, 29 Mar 2021 17:55:52 +0800 Subject: [PATCH] fix windows compile error --- src/client/src/tscSQLParser.c | 4 ++-- src/client/src/tscServer.c | 2 +- src/mnode/src/mnodeFunc.c | 4 ++-- src/query/inc/qUdf.h | 2 +- src/query/src/qExecutor.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 47775e6530..e5082d4323 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1757,7 +1757,7 @@ void genUdfList(SArray* pUdfInfo, tSqlExpr *pNode) { if (pNode->functionId < 0) { // extract all possible user defined function struct SUdfInfo info = {0}; info.name = strndup(pNode->operand.z, pNode->operand.n); - int32_t functionId = taosArrayGetSize(pUdfInfo) * (-1) - 1; + int32_t functionId = (int32_t)taosArrayGetSize(pUdfInfo) * (-1) - 1; info.functionId = functionId; taosArrayPush(pUdfInfo, &info); @@ -3212,7 +3212,7 @@ static bool functionCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, bool } } - aggNum = size - prjNum - aggUdf - scalarUdf; + aggNum = (int32_t)size - prjNum - aggUdf - scalarUdf; assert(aggNum >= 0); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 27b8e57f33..2a0d1a1d9a 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1867,7 +1867,7 @@ int tscBuildRetrieveFuncMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SSqlCmd *pCmd = &pSql->cmd; char *pMsg = pCmd->payload; - int32_t numOfFuncs = taosArrayGetSize(pCmd->pUdfInfo); + int32_t numOfFuncs = (int32_t)taosArrayGetSize(pCmd->pUdfInfo); SRetrieveFuncMsg *pRetrieveFuncMsg = (SRetrieveFuncMsg *)pMsg; pRetrieveFuncMsg->num = htonl(numOfFuncs); diff --git a/src/mnode/src/mnodeFunc.c b/src/mnode/src/mnodeFunc.c index 92d6ffec04..ad5923cb3d 100644 --- a/src/mnode/src/mnodeFunc.c +++ b/src/mnode/src/mnodeFunc.c @@ -459,10 +459,10 @@ static int32_t mnodeProcessRetrieveFuncImplMsg(SMnodeMsg *pMsg) { pFuncInfo->resBytes = htons(pFuncObj->resBytes); pOutput += sizeof(SFunctionInfoMsg) + pFuncObj->contLen; - name =(void *)name + sizeof(*name) + htons(name->len); + name =(tstr *)((char *)name + sizeof(*name) + htons(name->len)); } pMsg->rpcRsp.rsp = pFuncMsg; - pMsg->rpcRsp.len = (pOutput - (char*)pFuncMsg); + pMsg->rpcRsp.len = (int32_t)(pOutput - (char*)pFuncMsg); return TSDB_CODE_SUCCESS; } diff --git a/src/query/inc/qUdf.h b/src/query/inc/qUdf.h index e7fea68c70..aa8f32c16e 100644 --- a/src/query/inc/qUdf.h +++ b/src/query/inc/qUdf.h @@ -45,7 +45,7 @@ typedef struct SUdfInfo { }; } SUdfInfo; -typedef void (*udfNormalFunc)(char* data, int8_t type, int32_t numOfRows, int64_t* ts, char* dataOutput, char* tsOutput, +typedef void (*udfNormalFunc)(char* data, int16_t type, int32_t numOfRows, int64_t* ts, char* dataOutput, char* tsOutput, int32_t* numOfOutput, SUdfInit* buf); typedef int32_t (*udfInitFunc)(SUdfInit* data); typedef void (*udfFinalizeFunc)(char* dataOutput, int32_t* numOfOutput, SUdfInit* buf); diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 44039ab428..ebf29e9bb8 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -779,8 +779,8 @@ static void doInvokeUdf(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx *pCtx, int if (pUdfInfo && pUdfInfo->funcs[TSDB_UDF_FUNC_NORMAL]) { qDebug("invoke udf function:%s,%p", pUdfInfo->name, pUdfInfo->funcs[TSDB_UDF_FUNC_NORMAL]); - (*(udfNormalFunc)pUdfInfo->funcs[TSDB_UDF_FUNC_NORMAL])(pCtx->pInput + idx * pCtx->inputType, pCtx->inputType, pCtx->size, pCtx->ptsList, pCtx->pOutput, - pCtx->ptsOutputBuf, &output, &pUdfInfo->init); + (*(udfNormalFunc)pUdfInfo->funcs[TSDB_UDF_FUNC_NORMAL])((char *)pCtx->pInput + idx * pCtx->inputType, pCtx->inputType, pCtx->size, pCtx->ptsList, pCtx->pOutput, + (char *)pCtx->ptsOutputBuf, &output, &pUdfInfo->init); // set the output value exist pCtx->resultInfo->numOfRes += output; -- GitLab