From dd26ea2300511ab67c1c27a54ba85915b71ad7aa Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 10 Mar 2021 15:25:26 +0800 Subject: [PATCH] fix compiler error --- src/query/src/qAggMain.c | 14 +++++++------- src/query/src/qExecutor.c | 12 ++++++------ src/tsdb/src/tsdbRead.c | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index c82b36e1f0..f0f46b4bad 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -362,7 +362,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI // TODO use hash table int32_t isValidFunction(const char* name, int32_t len) { for(int32_t i = 0; i <= TSDB_FUNC_BLKINFO; ++i) { - int32_t nameLen = strlen(aAggs[i].name); + int32_t nameLen = (int32_t) strlen(aAggs[i].name); if (len != nameLen) { continue; } @@ -4282,7 +4282,7 @@ static void interp_function_impl(SQLFunctionCtx *pCtx) { if (type == TSDB_FILL_PREV) { assignVal(pCtx->pOutput, pCtx->pInput, pCtx->outputBytes, pCtx->inputType); } else if (type == TSDB_FILL_NEXT) { - char* val = pCtx->pInput + pCtx->inputBytes; + char* val = ((char*)pCtx->pInput) + pCtx->inputBytes; assignVal(pCtx->pOutput, val, pCtx->outputBytes, pCtx->inputType); } else if (type == TSDB_FILL_LINEAR) { char *start = GET_INPUT_DATA(pCtx, 0); @@ -4747,8 +4747,8 @@ void blockInfo_func(SQLFunctionCtx* pCtx) { STableBlockDist* pDist = (STableBlockDist*) GET_ROWCELL_INTERBUF(pResInfo); int32_t len = *(int32_t*) pCtx->pInput; - blockDistInfoFromBinary(pCtx->pInput + sizeof(int32_t), len, pDist); - pDist->rowSize = pCtx->param[0].i64; + blockDistInfoFromBinary((char*)pCtx->pInput + sizeof(int32_t), len, pDist); + pDist->rowSize = (int16_t) pCtx->param[0].i64; memcpy(pCtx->pOutput, pCtx->pInput, sizeof(int32_t) + len); @@ -4767,7 +4767,7 @@ static void mergeTableBlockDist(STableBlockDist* pDist, const STableBlockDist* p pDist->dataBlockInfos = taosArrayInit(4, sizeof(SFileBlockInfo)); } - taosArrayPushBatch(pDist->dataBlockInfos, pSrc->dataBlockInfos->pData, taosArrayGetSize(pSrc->dataBlockInfos)); + taosArrayPushBatch(pDist->dataBlockInfos, pSrc->dataBlockInfos->pData, (int32_t) taosArrayGetSize(pSrc->dataBlockInfos)); } void block_func_merge(SQLFunctionCtx* pCtx) { @@ -4777,7 +4777,7 @@ void block_func_merge(SQLFunctionCtx* pCtx) { STableBlockDist info = {0}; int32_t len = *(int32_t*) pCtx->pInput; - blockDistInfoFromBinary(pCtx->pInput + sizeof(int32_t), len, &info); + blockDistInfoFromBinary(((char*)pCtx->pInput) + sizeof(int32_t), len, &info); mergeTableBlockDist(pDist, &info); } @@ -4851,7 +4851,7 @@ void blockinfo_func_finalizer(SQLFunctionCtx* pCtx) { SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); STableBlockDist* pDist = (STableBlockDist*) GET_ROWCELL_INTERBUF(pResInfo); - pDist->rowSize = pCtx->param[0].i64; + pDist->rowSize = (int16_t)pCtx->param[0].i64; generateBlockDistResult(pDist, pCtx->pOutput); // cannot set the numOfIteratedElems again since it is set during previous iteration diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 2a8f55a81d..1b74f673ee 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -560,7 +560,7 @@ static int32_t addNewWindowResultBuf(SResultRow *pWindowRes, SDiskbasedResultBuf // set the number of rows in current disk page if (pWindowRes->pageId == -1) { // not allocated yet, allocate new buffer pWindowRes->pageId = pageId; - pWindowRes->offset = pData->num; + pWindowRes->offset = (int32_t)pData->num; pData->num += size; assert(pWindowRes->pageId >= 0); @@ -941,7 +941,7 @@ static void doSetInputDataBlockInfo(SOperatorInfo* pOperator, SQLFunctionCtx* pC for (int32_t i = 0; i < pOperator->numOfOutput; ++i) { pCtx[i].order = order; pCtx[i].size = pBlock->info.rows; - pCtx[i].currentStage = pOperator->pRuntimeEnv->scanFlag; + pCtx[i].currentStage = (uint8_t)pOperator->pRuntimeEnv->scanFlag; setBlockStatisInfo(&pCtx[i], pBlock, &pOperator->pExpr[i].base.colInfo); } @@ -968,7 +968,7 @@ static void doSetInputDataBlock(SOperatorInfo* pOperator, SQLFunctionCtx* pCtx, for (int32_t i = 0; i < pOperator->numOfOutput; ++i) { pCtx[i].order = order; pCtx[i].size = pBlock->info.rows; - pCtx[i].currentStage = pOperator->pRuntimeEnv->scanFlag; + pCtx[i].currentStage = (uint8_t)pOperator->pRuntimeEnv->scanFlag; setBlockStatisInfo(&pCtx[i], pBlock, &pOperator->pExpr[i].base.colInfo); @@ -1296,7 +1296,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn } for (int32_t j = 0; j < pSDataBlock->info.rows; ++j) { - char* val = pColInfoData->pData + bytes * j; + char* val = ((char*)pColInfoData->pData) + bytes * j; if (isNull(val, type)) { continue; } @@ -2351,7 +2351,7 @@ void filterRowsInDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SSingleColumnFilterInf SColumnInfoData *pColumnInfoData = taosArrayGet(pBlock->pDataBlock, i); int16_t bytes = pColumnInfoData->info.bytes; - memmove(pColumnInfoData->pData + start * bytes, pColumnInfoData->pData + cstart * bytes, len * bytes); + memmove(((char*)pColumnInfoData->pData) + start * bytes, pColumnInfoData->pData + cstart * bytes, len * bytes); } start += len; @@ -3446,7 +3446,7 @@ static void toSSDataBlock(SGroupResInfo *pGroupResInfo, SQueryRuntimeEnv* pRunti if (pInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) { STimeWindow* w = &pBlock->info.window; w->skey = *(int64_t*)pInfoData->pData; - w->ekey = *(int64_t*)(pInfoData->pData + TSDB_KEYSIZE * (pBlock->info.rows - 1)); + w->ekey = *(int64_t*)(((char*)pInfoData->pData) + TSDB_KEYSIZE * (pBlock->info.rows - 1)); } } diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 94b4584b4f..064ca0c38d 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -2644,7 +2644,7 @@ bool tsdbGetExternalRow(TsdbQueryHandleT pHandle) { return false; } - int32_t numOfCols = QH_GET_NUM_OF_COLS(pQueryHandle); + int32_t numOfCols = (int32_t) QH_GET_NUM_OF_COLS(pQueryHandle); for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pColInfoData = taosArrayGet(pQueryHandle->pColumns, i); SColumnInfoData* first = taosArrayGet(pQueryHandle->prev, i); @@ -2652,11 +2652,11 @@ bool tsdbGetExternalRow(TsdbQueryHandleT pHandle) { memcpy(pColInfoData->pData, first->pData, pColInfoData->info.bytes); SColumnInfoData* sec = taosArrayGet(pQueryHandle->next, i); - memcpy(pColInfoData->pData + pColInfoData->info.bytes, sec->pData, pColInfoData->info.bytes); + memcpy(((char*)pColInfoData->pData) + pColInfoData->info.bytes, sec->pData, pColInfoData->info.bytes); if (i == 0 && pColInfoData->info.type == TSDB_DATA_TYPE_TIMESTAMP) { cur->win.skey = *(TSKEY*)pColInfoData->pData; - cur->win.ekey = *(TSKEY*)(pColInfoData->pData + TSDB_KEYSIZE); + cur->win.ekey = *(TSKEY*)(((char*)pColInfoData->pData) + TSDB_KEYSIZE); } } -- GitLab