提交 bed28fca 编写于 作者: H Haojun Liao

[td-255] fix compiler error on windows.

上级 60f3f7ed
...@@ -152,7 +152,7 @@ typedef struct STSCompInfo { ...@@ -152,7 +152,7 @@ typedef struct STSCompInfo {
} STSCompInfo; } STSCompInfo;
typedef struct SRateInfo { typedef struct SRateInfo {
int64_t CorrectionValue; double correctionValue;
double firstValue; double firstValue;
TSKEY firstKey; TSKEY firstKey;
double lastValue; double lastValue;
...@@ -4493,7 +4493,7 @@ static double do_calc_rate(const SRateInfo* pRateInfo, int64_t tickPerSec) { ...@@ -4493,7 +4493,7 @@ static double do_calc_rate(const SRateInfo* pRateInfo, int64_t tickPerSec) {
diff -= pRateInfo->firstValue; diff -= pRateInfo->firstValue;
} }
} else { } else {
diff = pRateInfo->CorrectionValue + pRateInfo->lastValue - pRateInfo->firstValue; diff = pRateInfo->correctionValue + pRateInfo->lastValue - pRateInfo->firstValue;
if (diff <= 0) { if (diff <= 0) {
return 0; return 0;
} }
...@@ -4515,7 +4515,7 @@ static bool rate_function_setup(SQLFunctionCtx *pCtx) { ...@@ -4515,7 +4515,7 @@ static bool rate_function_setup(SQLFunctionCtx *pCtx) {
SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx); SResultRowCellInfo *pResInfo = GET_RES_INFO(pCtx);
SRateInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo); SRateInfo *pInfo = GET_ROWCELL_INTERBUF(pResInfo);
pInfo->CorrectionValue = 0; pInfo->correctionValue = 0;
pInfo->firstKey = INT64_MIN; pInfo->firstKey = INT64_MIN;
pInfo->lastKey = INT64_MIN; pInfo->lastKey = INT64_MIN;
pInfo->firstValue = INT64_MIN; pInfo->firstValue = INT64_MIN;
...@@ -4555,8 +4555,8 @@ static void rate_function(SQLFunctionCtx *pCtx) { ...@@ -4555,8 +4555,8 @@ static void rate_function(SQLFunctionCtx *pCtx) {
if (INT64_MIN == pRateInfo->lastValue) { if (INT64_MIN == pRateInfo->lastValue) {
pRateInfo->lastValue = v; pRateInfo->lastValue = v;
} else if (v < pRateInfo->lastValue) { } else if (v < pRateInfo->lastValue) {
pRateInfo->CorrectionValue += pRateInfo->lastValue; pRateInfo->correctionValue += pRateInfo->lastValue;
qDebug("CorrectionValue:%" PRId64, pRateInfo->CorrectionValue); qDebug("correctionValue:%" PRId64, pRateInfo->correctionValue);
} }
pRateInfo->lastValue = v; pRateInfo->lastValue = v;
...@@ -4602,7 +4602,7 @@ static void rate_function_f(SQLFunctionCtx *pCtx, int32_t index) { ...@@ -4602,7 +4602,7 @@ static void rate_function_f(SQLFunctionCtx *pCtx, int32_t index) {
if (INT64_MIN == pRateInfo->lastValue) { if (INT64_MIN == pRateInfo->lastValue) {
pRateInfo->lastValue = v; pRateInfo->lastValue = v;
} else if (v < pRateInfo->lastValue) { } else if (v < pRateInfo->lastValue) {
pRateInfo->CorrectionValue += pRateInfo->lastValue; pRateInfo->correctionValue += pRateInfo->lastValue;
} }
pRateInfo->lastValue = v; pRateInfo->lastValue = v;
...@@ -4637,7 +4637,7 @@ static void rate_finalizer(SQLFunctionCtx *pCtx) { ...@@ -4637,7 +4637,7 @@ static void rate_finalizer(SQLFunctionCtx *pCtx) {
return; return;
} }
*(double*) pCtx->pOutput = do_calc_rate(pRateInfo, TSDB_TICK_PER_SECOND(pCtx->param[0].i64)); *(double*) pCtx->pOutput = (double) do_calc_rate(pRateInfo, TSDB_TICK_PER_SECOND(pCtx->param[0].i64));
// cannot set the numOfIteratedElems again since it is set during previous iteration // cannot set the numOfIteratedElems again since it is set during previous iteration
pResInfo->numOfRes = 1; pResInfo->numOfRes = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册