From 16804ed71175a4a2fdfe57fd02a00f09eeb3bd8d Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Sat, 8 Oct 2022 18:48:49 +0800 Subject: [PATCH] fix(query): fix inconsistent max value caused by data conversion when reading from sma. --- source/libs/function/src/builtinsimpl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 42512d3a11..d91423ab5c 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -1251,12 +1251,12 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) { } } } else if (type == TSDB_DATA_TYPE_FLOAT) { - double prev = 0; - GET_TYPED_DATA(prev, double, type, &pBuf->v); + float prev = 0; + GET_TYPED_DATA(prev, float, type, &pBuf->v); - double val = GET_DOUBLE_VAL(tval); + float val = GET_DOUBLE_VAL(tval); if ((prev < val) ^ isMinFunc) { - *(double*)&pBuf->v = val; + *(float*)&pBuf->v = val; } if (pCtx->subsidiaries.num > 0) {