From 90ad66d5494585b16cb4d7ad5cc112f4544e0cd4 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 10 Mar 2021 16:07:26 +0800 Subject: [PATCH] fix compiler error --- src/client/src/tscLocalMerge.c | 2 +- src/client/src/tscSQLParser.c | 2 +- src/query/inc/qUtil.h | 2 +- src/query/src/qExecutor.c | 27 ++++++++++++++------------- src/query/src/qFill.c | 2 +- src/query/src/qUtil.c | 10 +++++----- src/tsdb/src/tsdbRead.c | 6 +++--- 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/client/src/tscLocalMerge.c b/src/client/src/tscLocalMerge.c index 55b89b2786..a44b0c46ba 100644 --- a/src/client/src/tscLocalMerge.c +++ b/src/client/src/tscLocalMerge.c @@ -970,7 +970,7 @@ static void doFillResult(SSqlObj *pSql, SLocalMerger *pLocalMerge, bool doneOutp if (pQueryInfo->limit.offset > 0) { for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) { TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, i); - memmove(pResPages[i], pResPages[i] + pField->bytes * pQueryInfo->limit.offset, + memmove(pResPages[i], ((char*)pResPages[i]) + pField->bytes * pQueryInfo->limit.offset, (size_t)(newRows * pField->bytes)); } } diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 37fae6b7f5..5744d2e3f9 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2408,7 +2408,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col getResultDataInfo(TSDB_DATA_TYPE_INT, 4, TSDB_FUNC_BLKINFO, 0, &resType, &bytes, &inter, 0, 0); s.bytes = bytes; - s.type = resType; + s.type = (uint8_t)resType; SSqlExpr* pExpr = tscAddFuncInSelectClause(pQueryInfo, 0, TSDB_FUNC_BLKINFO, &index, &s, TSDB_COL_TAG); pExpr->numOfParams = 1; pExpr->param[0].i64 = pTableMetaInfo->pTableMeta->tableInfo.rowSize; diff --git a/src/query/inc/qUtil.h b/src/query/inc/qUtil.h index 4083cbec62..31dfc350a3 100644 --- a/src/query/inc/qUtil.h +++ b/src/query/inc/qUtil.h @@ -54,7 +54,7 @@ static FORCE_INLINE SResultRow *getResultRow(SResultRowInfo *pResultRowInfo, int static FORCE_INLINE char *getPosInResultPage(SQuery *pQuery, tFilePage* page, int32_t rowOffset, int16_t offset) { assert(rowOffset >= 0 && pQuery != NULL); - int32_t numOfRows = GET_ROW_PARAM_FOR_MULTIOUTPUT(pQuery, pQuery->topBotQuery, pQuery->stableQuery); + int32_t numOfRows = (int32_t)GET_ROW_PARAM_FOR_MULTIOUTPUT(pQuery, pQuery->topBotQuery, pQuery->stableQuery); return ((char *)page->data) + rowOffset + offset * numOfRows; } diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index aee2bf980b..a120124aea 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -232,11 +232,11 @@ static void* destroyOutputBuf(SSDataBlock* pBlock) { return NULL; } -int64_t getNumOfResult(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx* pCtx, int32_t numOfOutput) { +int32_t getNumOfResult(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx* pCtx, int32_t numOfOutput) { SQuery *pQuery = pRuntimeEnv->pQuery; bool hasMainFunction = hasMainOutput(pQuery); - int64_t maxOutput = 0; + int32_t maxOutput = 0; for (int32_t j = 0; j < numOfOutput; ++j) { int32_t id = pCtx[j].functionId; @@ -1390,6 +1390,7 @@ static int32_t getGroupbyColumnIndex(SSqlGroupbyExpr *pGroupbyExpr, SSDataBlock* } assert(0); + return -1; } static bool functionNeedToExecute(SQueryRuntimeEnv *pRuntimeEnv, SQLFunctionCtx *pCtx, int32_t functionId) { @@ -1584,8 +1585,8 @@ static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExpr } for(int32_t i = 1; i < numOfOutput; ++i) { - (*rowCellInfoOffset)[i] = (*rowCellInfoOffset)[i - 1] + sizeof(SResultRowCellInfo) + - pExpr[i - 1].interBytes * GET_ROW_PARAM_FOR_MULTIOUTPUT(pQuery, pQuery->topBotQuery, pQuery->stableQuery); + (*rowCellInfoOffset)[i] = (int32_t)((*rowCellInfoOffset)[i - 1] + sizeof(SResultRowCellInfo) + + pExpr[i - 1].interBytes * GET_ROW_PARAM_FOR_MULTIOUTPUT(pQuery, pQuery->topBotQuery, pQuery->stableQuery)); } setCtxTagColumnInfo(pFuncCtx, numOfOutput); @@ -3803,7 +3804,7 @@ static void doDestroyTableQueryInfo(STableGroupInfo* pTableqinfoGroupInfo); static UNUSED_FUNC void setTableQueryHandle(SQueryRuntimeEnv* pRuntimeEnv, int32_t tableIndex) { SQuery* pQuery = pRuntimeEnv->pQuery; - int32_t numOfGroup = GET_NUM_OF_TABLEGROUP(pRuntimeEnv); + int32_t numOfGroup = (int32_t) GET_NUM_OF_TABLEGROUP(pRuntimeEnv); STableQueryInfo* pCheckInfo = NULL; if (numOfGroup == 1) { @@ -3951,7 +3952,7 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, SArray* prevResult, void *ts pQuery->stableQuery = isSTableQuery; pQuery->groupbyColumn = isGroupbyColumn(pQuery->pGroupbyExpr); - pRuntimeEnv->groupResInfo.totalGroup = isSTableQuery? GET_NUM_OF_TABLEGROUP(pRuntimeEnv):0; + pRuntimeEnv->groupResInfo.totalGroup = (int32_t) (isSTableQuery? GET_NUM_OF_TABLEGROUP(pRuntimeEnv):0); pRuntimeEnv->pQuery = pQuery; pRuntimeEnv->pTsBuf = pTsBuf; @@ -3986,7 +3987,7 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, SArray* prevResult, void *ts } // create runtime environment - int32_t numOfTables = pQuery->tableGroupInfo.numOfTables; + int32_t numOfTables = (int32_t)pQuery->tableGroupInfo.numOfTables; pQInfo->summary.tableInfoSize += (numOfTables * sizeof(STableQueryInfo)); code = setupQueryRuntimeEnv(pRuntimeEnv, (int32_t) pQuery->tableGroupInfo.numOfTables); if (code != TSDB_CODE_SUCCESS) { @@ -4183,11 +4184,11 @@ static SSDataBlock* doBlockInfoScan(void* param) { STableScanInfo *pTableScanInfo = pOperator->info; STableBlockDist tableBlockDist = {0}; - tableBlockDist.numOfTables = pOperator->pRuntimeEnv->tableqinfoGroupInfo.numOfTables; + tableBlockDist.numOfTables = (int32_t)pOperator->pRuntimeEnv->tableqinfoGroupInfo.numOfTables; tableBlockDist.dataBlockInfos = taosArrayInit(512, sizeof(SFileBlockInfo)); tsdbGetFileBlocksDistInfo(pTableScanInfo->pQueryHandle, &tableBlockDist); - tableBlockDist.numOfRowsInMemTable = tsdbGetNumOfRowsInMemTable(pTableScanInfo->pQueryHandle); + tableBlockDist.numOfRowsInMemTable = (int32_t) tsdbGetNumOfRowsInMemTable(pTableScanInfo->pQueryHandle); SSDataBlock* pBlock = &pTableScanInfo->block; pBlock->info.rows = 1; @@ -4508,7 +4509,7 @@ static SSDataBlock* doLimit(void* param) { } if (pInfo->total + pBlock->info.rows >= pInfo->limit) { - pBlock->info.rows = (pInfo->limit - pInfo->total); + pBlock->info.rows = (int32_t) (pInfo->limit - pInfo->total); pInfo->total = pInfo->limit; @@ -4543,7 +4544,7 @@ static SSDataBlock* doOffset(void* param) { } else if (pRuntimeEnv->currentOffset > pBlock->info.rows) { pRuntimeEnv->currentOffset -= pBlock->info.rows; } else { - int32_t remain = pBlock->info.rows - pRuntimeEnv->currentOffset; + int32_t remain = (int32_t)(pBlock->info.rows - pRuntimeEnv->currentOffset); pBlock->info.rows = remain; for (int32_t i = 0; i < pBlock->info.numOfCols; ++i) { @@ -4733,7 +4734,7 @@ static SSDataBlock* doFill(void* param) { SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv; if (taosFillHasMoreResults(pInfo->pFillInfo)) { - doFillTimeIntervalGapsInResults(pInfo->pFillInfo, pInfo->pRes, pRuntimeEnv->resultInfo.capacity); + doFillTimeIntervalGapsInResults(pInfo->pFillInfo, pInfo->pRes, (int32_t)pRuntimeEnv->resultInfo.capacity); return pInfo->pRes; } @@ -4860,7 +4861,7 @@ SOperatorInfo* createMultiTableAggOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SO pInfo->binfo.pRes = createOutputBuf(pExpr, numOfOutput, (int32_t) tableGroup); pInfo->binfo.pCtx = createSQLFunctionCtx(pRuntimeEnv, pExpr, numOfOutput, &pInfo->binfo.rowCellInfoOffset); - initResultRowInfo(&pInfo->binfo.resultRowInfo, tableGroup, TSDB_DATA_TYPE_INT); + initResultRowInfo(&pInfo->binfo.resultRowInfo, (int32_t)tableGroup, TSDB_DATA_TYPE_INT); SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); pOperator->name = "MultiTableAggregate"; diff --git a/src/query/src/qFill.c b/src/query/src/qFill.c index 17bd7f6b55..ef4176471b 100644 --- a/src/query/src/qFill.c +++ b/src/query/src/qFill.c @@ -451,7 +451,7 @@ void taosFillCopyInputDataFromOneFilePage(SFillInfo* pFillInfo, const tFilePage* assert(t != NULL); pFillInfo->pData[i] = t; - pFillInfo->alloc = pInput->num; + pFillInfo->alloc = (int32_t)pInput->num; } memcpy(pFillInfo->pData[i], data, pCol->col.bytes * pInput->num); diff --git a/src/query/src/qUtil.c b/src/query/src/qUtil.c index a282041766..29ccdc89c5 100644 --- a/src/query/src/qUtil.c +++ b/src/query/src/qUtil.c @@ -140,7 +140,7 @@ void clearResultRow(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pResultRow, int16 for (int32_t i = 0; i < pRuntimeEnv->pQuery->numOfOutput; ++i) { SResultRowCellInfo *pResultInfo = &pResultRow->pCellInfo[i]; - size_t size = pRuntimeEnv->pQuery->pExpr1[i].bytes; + int16_t size = pRuntimeEnv->pQuery->pExpr1[i].bytes; char * s = getPosInResultPage(pRuntimeEnv->pQuery, page, pResultRow->offset, offset); memset(s, 0, size); @@ -596,10 +596,10 @@ void blockDistInfoToBinary(STableBlockDist* pDist, struct SBufferWriter* bw) { char* tmp = malloc(x + 2); bool comp = false; - int32_t len = tsCompressString(p, x, 1, tmp, x, ONE_STAGE_COMP, NULL, 0); + int32_t len = tsCompressString(p, (int32_t)x, 1, tmp, (int32_t)x, ONE_STAGE_COMP, NULL, 0); if (len == -1 || len >= x) { // compress failed, do not compress this binary data comp = false; - len = x; + len = (int32_t)x; } else { comp = true; } @@ -621,7 +621,7 @@ void blockDistInfoFromBinary(const char* data, int32_t len, STableBlockDist* pDi pDist->numOfFiles = tbufReadUint16(&br); pDist->totalSize = tbufReadUint64(&br); pDist->numOfRowsInMemTable = tbufReadUint32(&br); - int32_t numOfBlocks = tbufReadUint64(&br); + int64_t numOfBlocks = tbufReadUint64(&br); bool comp = tbufReadUint8(&br); uint32_t compLen = tbufReadUint32(&br); @@ -636,7 +636,7 @@ void blockDistInfoFromBinary(const char* data, int32_t len, STableBlockDist* pDi const char* compStr = tbufReadBinary(&br, &actualLen); int32_t orignalLen = tsDecompressString(compStr, compLen, 1, outputBuf, - originalLen , ONE_STAGE_COMP, NULL, 0); + (int32_t)originalLen , ONE_STAGE_COMP, NULL, 0); assert(orignalLen == numOfBlocks*sizeof(SFileBlockInfo)); } else { outputBuf = (char*) tbufReadBinary(&br, &originalLen); diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index d6d3a3c285..0bf533d027 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -3201,7 +3201,7 @@ int32_t tsdbQuerySTableByTagCond(STsdbRepo* tsdb, uint64_t uid, TSKEY skey, cons goto _error; } - pGroupInfo->numOfTables = taosArrayGetSize(res); + pGroupInfo->numOfTables = (uint32_t) taosArrayGetSize(res); pGroupInfo->pGroupList = createTableGroup(res, pTagSchema, pColIndex, numOfCols, skey); tsdbDebug("%p no table name/tag condition, all tables belong to one group, numOfTables:%u", tsdb, pGroupInfo->numOfTables); @@ -3246,7 +3246,7 @@ int32_t tsdbQuerySTableByTagCond(STsdbRepo* tsdb, uint64_t uid, TSKEY skey, cons } END_TRY doQueryTableList(pTable, res, expr); - pGroupInfo->numOfTables = taosArrayGetSize(res); + pGroupInfo->numOfTables = (uint32_t)taosArrayGetSize(res); pGroupInfo->pGroupList = createTableGroup(res, pTagSchema, pColIndex, numOfCols, skey); tsdbDebug("%p stable tid:%d, uid:%"PRIu64" query, numOfTables:%u, belong to %" PRIzu " groups", tsdb, pTable->tableId.tid, @@ -3326,7 +3326,7 @@ int32_t tsdbGetTableGroupFromIdList(STsdbRepo* tsdb, SArray* pTableIdList, STabl return terrno; } - pGroupInfo->numOfTables = taosArrayGetSize(group); + pGroupInfo->numOfTables = (uint32_t) taosArrayGetSize(group); if (pGroupInfo->numOfTables > 0) { taosArrayPush(pGroupInfo->pGroupList, &group); } else { -- GitLab