提交 6dfa2836 编写于 作者: S shenglian zhou

fix: use the pre agg value as double when generate block sma for float column and double column

上级 a34d0590
...@@ -1520,22 +1520,22 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) { ...@@ -1520,22 +1520,22 @@ void tsdbCalcColDataSMA(SColData *pColData, SColumnDataAgg *pColAgg) {
break; break;
} }
case TSDB_DATA_TYPE_FLOAT: { case TSDB_DATA_TYPE_FLOAT: {
pColAgg->sum += colVal.value.f; *(double*)(&pColAgg->sum) += colVal.value.f;
if (pColAgg->min > colVal.value.f) { if (*(double*)(&pColAgg->min) > colVal.value.f) {
pColAgg->min = colVal.value.f; *(double*)(&pColAgg->min) = colVal.value.f;
} }
if (pColAgg->max < colVal.value.f) { if (*(double*)(&pColAgg->max) < colVal.value.f) {
pColAgg->max = colVal.value.f; *(double*)(&pColAgg->max) = colVal.value.f;
} }
break; break;
} }
case TSDB_DATA_TYPE_DOUBLE: { case TSDB_DATA_TYPE_DOUBLE: {
pColAgg->sum += colVal.value.d; *(double*)(&pColAgg->sum) += colVal.value.d;
if (pColAgg->min > colVal.value.d) { if (*(double*)(&pColAgg->min) > colVal.value.d) {
pColAgg->min = colVal.value.d; *(double*)(&pColAgg->min) = colVal.value.d;
} }
if (pColAgg->max < colVal.value.d) { if (*(double*)(&pColAgg->max) < colVal.value.d) {
pColAgg->max = colVal.value.d; *(double*)(&pColAgg->max) = colVal.value.d;
} }
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册