From 08feade5fe3a9da96268008b9ef9a98a4e857d04 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Mon, 26 Sep 2022 14:24:35 +0800 Subject: [PATCH] more code --- source/dnode/vnode/src/tsdb/tsdbDiskData.c | 18 ++++++++---------- source/dnode/vnode/src/tsdb/tsdbUtil.c | 6 +++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbDiskData.c b/source/dnode/vnode/src/tsdb/tsdbDiskData.c index 11f5c398ba..bbf4e3337c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbDiskData.c +++ b/source/dnode/vnode/src/tsdb/tsdbDiskData.c @@ -129,15 +129,6 @@ static int32_t tGnrtDiskCol(SDiskColBuilder *pBuilder, SDiskCol *pDiskCol) { return code; } -extern void (*tSmaUpdateImpl[])(SColumnDataAgg *pColAgg, SColVal *pColVal, uint8_t *minSet, uint8_t *maxSet); -static FORCE_INLINE void tDiskColUpdateSma(SDiskColBuilder *pBuilder, SColVal *pColVal) { - if (!COL_VAL_IS_VALUE(pColVal)) { - pBuilder->sma.numOfNull++; - } else { - tSmaUpdateImpl[pBuilder->type](&pBuilder->sma, pColVal, &pBuilder->minSet, &pBuilder->maxSet); - } -} - static FORCE_INLINE int32_t tDiskColPutValue(SDiskColBuilder *pBuilder, SColVal *pColVal) { int32_t code = 0; @@ -422,10 +413,17 @@ static int32_t (*tDiskColAddValImpl[8][3])(SDiskColBuilder *pBuilder, SColVal *p {tDiskColAddVal60, tDiskColAddVal61, tDiskColAddVal62}, // HAS_VALUE|HAS_NULL {tDiskColAddVal70, tDiskColAddVal71, tDiskColAddVal72} // HAS_VALUE|HAS_NULL|HAS_NONE }; +extern void (*tSmaUpdateImpl[])(SColumnDataAgg *pColAgg, SColVal *pColVal, uint8_t *minSet, uint8_t *maxSet); static int32_t tDiskColAddVal(SDiskColBuilder *pBuilder, SColVal *pColVal) { int32_t code = 0; - if (pBuilder->calcSma) tDiskColUpdateSma(pBuilder, pColVal); + if (pBuilder->calcSma) { + if (COL_VAL_IS_VALUE(pColVal)) { + tSmaUpdateImpl[pBuilder->type](&pBuilder->sma, pColVal, &pBuilder->minSet, &pBuilder->maxSet); + } else { + pBuilder->sma.numOfNull++; + } + } if (tDiskColAddValImpl[pBuilder->type][pColVal->type]) { code = tDiskColAddValImpl[pBuilder->type][pColVal->type](pBuilder, pColVal); diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 1d7eff9a08..cae113dc4b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -1589,10 +1589,10 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { for (int32_t iVal = 0; iVal < pColData->nVal; iVal++) { tColDataGetValue(pColData, iVal, &cv); - if (!COL_VAL_IS_VALUE(&cv)) { - pColAgg->numOfNull++; - } else { + if (COL_VAL_IS_VALUE(&cv)) { tSmaUpdateImpl[pColData->type](pColAgg, &cv, &minSet, &maxSet); + } else { + pColAgg->numOfNull++; } } } -- GitLab