[td-225] fix bugs in diff and spread
This commit is contained in:
parent
be67158538
commit
c4fe461f72
|
@ -2912,10 +2912,6 @@ static void leastsquares_finalizer(SQLFunctionCtx *pCtx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void date_col_output_function(SQLFunctionCtx *pCtx) {
|
static void date_col_output_function(SQLFunctionCtx *pCtx) {
|
||||||
if (pCtx->scanFlag == REVERSE_SCAN) { // todo : remove it
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
SET_VAL(pCtx, pCtx->size, 1);
|
SET_VAL(pCtx, pCtx->size, 1);
|
||||||
*(int64_t *)(pCtx->aOutputBuf) = pCtx->nStartQueryTimestamp;
|
*(int64_t *)(pCtx->aOutputBuf) = pCtx->nStartQueryTimestamp;
|
||||||
}
|
}
|
||||||
|
@ -3080,7 +3076,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
pTimestamp += 1;
|
pTimestamp += 1;
|
||||||
} else {
|
} else {
|
||||||
*pOutput = pData[i] - pData[i - step];
|
*pOutput = pData[i] - pCtx->param[1].i64Key; // direct previous may be null
|
||||||
*pTimestamp = pCtx->ptsList[i];
|
*pTimestamp = pCtx->ptsList[i];
|
||||||
|
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
|
@ -3112,7 +3108,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
pTimestamp += 1;
|
pTimestamp += 1;
|
||||||
} else {
|
} else {
|
||||||
*pOutput = pData[i] - pData[i - step];
|
*pOutput = pData[i] - pCtx->param[1].i64Key;
|
||||||
*pTimestamp = pCtx->ptsList[i];
|
*pTimestamp = pCtx->ptsList[i];
|
||||||
|
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
|
@ -3143,7 +3139,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
pTimestamp += 1;
|
pTimestamp += 1;
|
||||||
} else {
|
} else {
|
||||||
*pOutput = pData[i] - pData[i - step];
|
*pOutput = pData[i] - pCtx->param[1].i64Key;
|
||||||
*pTimestamp = pCtx->ptsList[i];
|
*pTimestamp = pCtx->ptsList[i];
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
pTimestamp += 1;
|
pTimestamp += 1;
|
||||||
|
@ -3174,7 +3170,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
pTimestamp += 1;
|
pTimestamp += 1;
|
||||||
} else {
|
} else {
|
||||||
*pOutput = pData[i] - pData[i - step];
|
*pOutput = pData[i] - pCtx->param[1].i64Key;
|
||||||
*pTimestamp = pCtx->ptsList[i];
|
*pTimestamp = pCtx->ptsList[i];
|
||||||
|
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
|
@ -3206,7 +3202,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
pTimestamp += 1;
|
pTimestamp += 1;
|
||||||
} else {
|
} else {
|
||||||
*pOutput = pData[i] - pData[i - step];
|
*pOutput = pData[i] - pCtx->param[1].i64Key;
|
||||||
*pTimestamp = pCtx->ptsList[i];
|
*pTimestamp = pCtx->ptsList[i];
|
||||||
|
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
|
@ -3238,7 +3234,7 @@ static void diff_function(SQLFunctionCtx *pCtx) {
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
pTimestamp += 1;
|
pTimestamp += 1;
|
||||||
} else {
|
} else {
|
||||||
*pOutput = pData[i] - pData[i - step];
|
*pOutput = pData[i] - pCtx->param[1].i64Key;
|
||||||
*pTimestamp = pCtx->ptsList[i];
|
*pTimestamp = pCtx->ptsList[i];
|
||||||
|
|
||||||
pOutput += 1;
|
pOutput += 1;
|
||||||
|
@ -3445,14 +3441,8 @@ static void spread_function(SQLFunctionCtx *pCtx) {
|
||||||
pInfo->max = GET_DOUBLE_VAL(&(pCtx->preAggVals.statis.max));
|
pInfo->max = GET_DOUBLE_VAL(&(pCtx->preAggVals.statis.max));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// if (pInfo->min > pCtx->param[1].dKey) {
|
goto _spread_over;
|
||||||
// pInfo->min = pCtx->param[1].dKey;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (pInfo->max < pCtx->param[2].dKey) {
|
|
||||||
// pInfo->max = pCtx->param[2].dKey;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *pData = GET_INPUT_CHAR(pCtx);
|
void *pData = GET_INPUT_CHAR(pCtx);
|
||||||
|
|
Loading…
Reference in New Issue