diff --git a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c index b3c85bff9d..b7fe92c2c5 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCacheRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbCacheRead.c @@ -24,7 +24,7 @@ #define HASTYPE(_type, _t) (((_type) & (_t)) == (_t)) static void setFirstLastResColToNull(SColumnInfoData* pCol, int32_t row) { - char *buf = taosMemoryCalloc(1, pCol->info.bytes); + char* buf = taosMemoryCalloc(1, pCol->info.bytes); SFirstLastRes* pRes = (SFirstLastRes*)((char*)buf + VARSTR_HEADER_SIZE); pRes->bytes = 0; pRes->hasResult = true; @@ -36,7 +36,7 @@ static void setFirstLastResColToNull(SColumnInfoData* pCol, int32_t row) { static void saveOneRowForLastRaw(SLastCol* pColVal, SCacheRowsReader* pReader, const int32_t slotId, SColumnInfoData* pColInfoData, int32_t numOfRows) { - SColVal* pVal = &pColVal->colVal; + SColVal* pVal = &pColVal->colVal; // allNullRow = false; if (IS_VAR_DATA_TYPE(pColVal->colVal.value.type)) { @@ -60,15 +60,14 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p // bool allNullRow = true; if (HASTYPE(pReader->type, CACHESCAN_RETRIEVE_LAST)) { - - uint64_t ts = TSKEY_MIN; + uint64_t ts = TSKEY_MIN; SFirstLastRes* p = NULL; - col_id_t colId = -1; + col_id_t colId = -1; SArray* funcTypeBlockArray = taosArrayInit(pReader->numOfCols, sizeof(int32_t)); for (int32_t i = 0; i < pReader->numOfCols; ++i) { SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotIds[i]); - int32_t funcType = FUNCTION_TYPE_CACHE_LAST; + int32_t funcType = FUNCTION_TYPE_CACHE_LAST; if (pReader->pFuncTypeList != NULL && taosArrayGetSize(pReader->pFuncTypeList) > i) { funcType = *(int32_t*)taosArrayGet(pReader->pFuncTypeList, i); } @@ -104,7 +103,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p memcpy(varDataVal(p->buf), pColVal->colVal.value.pData, pColVal->colVal.value.nData); p->bytes = pColVal->colVal.value.nData + VARSTR_HEADER_SIZE; // binary needs to plus the header size } else { - memcpy(p->buf, &pColVal->colVal.value, pReader->pSchema->columns[slotId].bytes); + memcpy(p->buf, &pColVal->colVal.value.val, pReader->pSchema->columns[slotId].bytes); p->bytes = pReader->pSchema->columns[slotId].bytes; } } @@ -117,7 +116,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p for (int32_t idx = 0; idx < taosArrayGetSize(pBlock->pDataBlock); ++idx) { SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, idx); if (idx < funcTypeBlockArray->size) { - int32_t funcType = *(int32_t*)taosArrayGet(funcTypeBlockArray, idx); + int32_t funcType = *(int32_t*)taosArrayGet(funcTypeBlockArray, idx); if (FUNCTION_TYPE_CACHE_LAST_ROW == funcType) { continue; } @@ -146,7 +145,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p for (int32_t i = 0; i < pReader->numOfCols; ++i) { SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, dstSlotIds[i]); - int32_t slotId = slotIds[i]; + int32_t slotId = slotIds[i]; if (slotId == -1) { colDataSetNULL(pColInfoData, numOfRows); continue; @@ -388,7 +387,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 } for (int32_t i = 0; i < pr->numOfCols; ++i) { - int32_t slotId = slotIds[i]; + int32_t slotId = slotIds[i]; if (slotId == -1) { SLastCol p = {.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL}; taosArrayPush(pLastCols, &p); @@ -427,7 +426,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32 if (!COL_VAL_IS_VALUE(&p->colVal)) { hasNotNullRow = false; } - // For all of cols is null, the last null col of last table will be save + // For all of cols is null, the last null col of last table will be save if (i != pr->numOfTables - 1 || k != pr->numOfCols - 1 || hasRes) { continue; }