From 9d0563df3e06d69546ed0d41e497207405f45e7f Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 11 Jul 2022 12:54:44 +0000 Subject: [PATCH] more row refact --- include/common/tdataformat.h | 4 ---- source/libs/function/src/builtinsimpl.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index 87b0cae175..1f45f30820 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -259,10 +259,6 @@ void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version) int32_t tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int8_t flags, col_id_t colId, col_bytes_t bytes); STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder); -// ----------------- Semantic timestamp key definition -#define MIN_TS_KEY ((TSKEY)0x8000000000000001) -#define MAX_TS_KEY ((TSKEY)0x7fffffffffffffff) - #endif #ifdef __cplusplus diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 932bfb8793..4bf49a05f9 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1082,9 +1082,9 @@ static void copyTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBl static int32_t findRowIndex(int32_t start, int32_t num, SColumnInfoData* pCol, const char* tval) { // the data is loaded, not only the block SMA value - for(int32_t i = start; i < num + start; ++i) { + for (int32_t i = start; i < num + start; ++i) { char* p = colDataGetData(pCol, i); - if (memcpy((void*)tval, p, pCol->info.bytes) == 0) { + if (memcpy((void*)tval, p, pCol->info.bytes) == 0) { return i; } } @@ -1092,7 +1092,6 @@ static int32_t findRowIndex(int32_t start, int32_t num, SColumnInfoData* pCol, c ASSERT(0); } - int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { int32_t numOfElems = 0; @@ -1872,7 +1871,7 @@ int32_t stddevFunctionMerge(SqlFunctionCtx* pCtx) { SStddevRes* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); - for(int32_t i = pInput->startRowIndex; i < pInput->startRowIndex + pInput->numOfRows; ++i) { + for (int32_t i = pInput->startRowIndex; i < pInput->startRowIndex + pInput->numOfRows; ++i) { char* data = colDataGetData(pCol, i); SStddevRes* pInputInfo = (SStddevRes*)varDataVal(data); stddevTransferInfo(pInputInfo, pInfo); @@ -3465,8 +3464,7 @@ void saveTupleData(SqlFunctionCtx* pCtx, int32_t rowIndex, const SSDataBlock* pS setBufPageDirty(pPage, true); releaseBufPage(pCtx->pBuf, pPage); #ifdef BUF_PAGE_DEBUG - qDebug("page_saveTuple pos:%p,pageId:%d, offset:%d\n", pPos, pPos->pageId, - pPos->offset); + qDebug("page_saveTuple pos:%p,pageId:%d, offset:%d\n", pPos, pPos->pageId, pPos->offset); #endif } @@ -3765,7 +3763,7 @@ bool elapsedFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInfo SElapsedInfo* pInfo = GET_ROWCELL_INTERBUF(pResultInfo); pInfo->result = 0; - pInfo->min = MAX_TS_KEY; + pInfo->min = TSKEY_MAX; pInfo->max = 0; if (pCtx->numOfParams > 1) { @@ -3792,7 +3790,7 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) { } if (pInput->colDataAggIsSet) { - if (pInfo->min == MAX_TS_KEY) { + if (pInfo->min == TSKEY_MAX) { pInfo->min = GET_INT64_VAL(&pAgg->min); pInfo->max = GET_INT64_VAL(&pAgg->max); } else { -- GitLab