From 3d3d15b7656736ebd0d361549a07c5b09cef68bb Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 10 Feb 2023 10:45:52 +0800 Subject: [PATCH] fix(query): fix max/min result inconsistent using with first or last plus interval time window query --- source/libs/function/src/detail/tminmax.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/libs/function/src/detail/tminmax.c b/source/libs/function/src/detail/tminmax.c index a511ca97f1..b24172acc0 100644 --- a/source/libs/function/src/detail/tminmax.c +++ b/source/libs/function/src/detail/tminmax.c @@ -372,7 +372,7 @@ static void handleInt8Col(const void* data, int32_t start, int32_t numOfRows, SM pBuf->v = i8VectorCmpAVX2(data, numOfRows, isMinFunc, signVal); } else { if (!pBuf->assign) { - pBuf->v = ((int8_t*)data)[0]; + pBuf->v = ((int8_t*)data)[start]; } if (signVal) { @@ -406,7 +406,7 @@ static void handleInt16Col(const void* data, int32_t start, int32_t numOfRows, S pBuf->v = i16VectorCmpAVX2(data, numOfRows, isMinFunc, signVal); } else { if (!pBuf->assign) { - pBuf->v = ((int16_t*)data)[0]; + pBuf->v = ((int16_t*)data)[start]; } if (signVal) { @@ -440,7 +440,7 @@ static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, S pBuf->v = i32VectorCmpAVX2(data, numOfRows, isMinFunc, signVal); } else { if (!pBuf->assign) { - pBuf->v = ((int32_t*)data)[0]; + pBuf->v = ((int32_t*)data)[start]; } if (signVal) { @@ -470,7 +470,7 @@ static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, S static void handleInt64Col(const void* data, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc, bool signVal) { if (!pBuf->assign) { - pBuf->v = ((int64_t*)data)[0]; + pBuf->v = ((int64_t*)data)[start]; } if (signVal) { @@ -504,7 +504,7 @@ static void handleFloatCol(SColumnInfoData* pCol, int32_t start, int32_t numOfRo *val = floatVectorCmpAVX(pData, numOfRows, isMinFunc); } else { if (!pBuf->assign) { - *val = pData[0]; + *val = pData[start]; } if (isMinFunc) { // min @@ -535,7 +535,7 @@ static void handleDoubleCol(SColumnInfoData* pCol, int32_t start, int32_t numOfR *val = (double)doubleVectorCmpAVX(pData, numOfRows, isMinFunc); } else { if (!pBuf->assign) { - *val = pData[0]; + *val = pData[start]; } if (isMinFunc) { // min