diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 47775e6530c5775535be26b6373a047e33c062cc..e5082d43232848deaa355c44ba91f74328e8418e 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 27b8e57f3375d8587687d6ef503ffc3fa6c75ee4..2a0d1a1d9acbbd9714b040499787fe127f29674a 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 92d6ffec04c65bd44491e4fd20bb6de443d48be8..ad5923cb3d3df8bfe2cd83bad67685678af03715 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 e7fea68c705cb5c0f028550a4fa45e6bdf3fe7c3..aa8f32c16e7dd74021478177bd57eef2dca4aac2 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 44039ab4281614d201c57e1894bccf81ed27bb74..ebf29e9bb8377fccffdb495db6646e78ab9c0db8 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;