fix(query): twa function output NULL if input has overlap timestamps
TD-18224
This commit is contained in:
parent
566af3ea92
commit
0d7e1eb4e0
|
@ -5398,8 +5398,8 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
|
|
||||||
int32_t i = pInput->startRowIndex;
|
int32_t i = pInput->startRowIndex;
|
||||||
if (pCtx->start.key != INT64_MIN) {
|
if (pCtx->start.key != INT64_MIN) {
|
||||||
ASSERT((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) ||
|
//ASSERT((pCtx->start.key < tsList[i] && pCtx->order == TSDB_ORDER_ASC) ||
|
||||||
(pCtx->start.key > tsList[i] && pCtx->order == TSDB_ORDER_DESC));
|
// (pCtx->start.key > tsList[i] && pCtx->order == TSDB_ORDER_DESC));
|
||||||
|
|
||||||
ASSERT(last->key == INT64_MIN);
|
ASSERT(last->key == INT64_MIN);
|
||||||
for (; i < pInput->numOfRows + pInput->startRowIndex; ++i) {
|
for (; i < pInput->numOfRows + pInput->startRowIndex; ++i) {
|
||||||
|
@ -5446,6 +5446,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
numOfElems++;
|
numOfElems++;
|
||||||
|
|
||||||
|
if (pInfo->p.key == st.key) {
|
||||||
|
numOfElems = 0;
|
||||||
|
goto _twa_over;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_INTP_POINT(st, tsList[i], val[i]);
|
INIT_INTP_POINT(st, tsList[i], val[i]);
|
||||||
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
||||||
pInfo->p = st;
|
pInfo->p = st;
|
||||||
|
@ -5461,6 +5466,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
numOfElems++;
|
numOfElems++;
|
||||||
|
|
||||||
|
if (pInfo->p.key == st.key) {
|
||||||
|
numOfElems = 0;
|
||||||
|
goto _twa_over;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_INTP_POINT(st, tsList[i], val[i]);
|
INIT_INTP_POINT(st, tsList[i], val[i]);
|
||||||
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
||||||
pInfo->p = st;
|
pInfo->p = st;
|
||||||
|
@ -5475,6 +5485,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
numOfElems++;
|
numOfElems++;
|
||||||
|
|
||||||
|
if (pInfo->p.key == st.key) {
|
||||||
|
numOfElems = 0;
|
||||||
|
goto _twa_over;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_INTP_POINT(st, tsList[i], val[i]);
|
INIT_INTP_POINT(st, tsList[i], val[i]);
|
||||||
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
||||||
pInfo->p = st;
|
pInfo->p = st;
|
||||||
|
@ -5489,6 +5504,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
numOfElems++;
|
numOfElems++;
|
||||||
|
|
||||||
|
if (pInfo->p.key == st.key) {
|
||||||
|
numOfElems = 0;
|
||||||
|
goto _twa_over;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_INTP_POINT(st, tsList[i], val[i]);
|
INIT_INTP_POINT(st, tsList[i], val[i]);
|
||||||
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
||||||
pInfo->p = st;
|
pInfo->p = st;
|
||||||
|
@ -5503,6 +5523,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
numOfElems++;
|
numOfElems++;
|
||||||
|
|
||||||
|
if (pInfo->p.key == st.key) {
|
||||||
|
numOfElems = 0;
|
||||||
|
goto _twa_over;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_INTP_POINT(st, tsList[i], val[i]);
|
INIT_INTP_POINT(st, tsList[i], val[i]);
|
||||||
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
||||||
pInfo->p = st;
|
pInfo->p = st;
|
||||||
|
@ -5517,6 +5542,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
numOfElems++;
|
numOfElems++;
|
||||||
|
|
||||||
|
if (pInfo->p.key == st.key) {
|
||||||
|
numOfElems = 0;
|
||||||
|
goto _twa_over;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_INTP_POINT(st, tsList[i], val[i]);
|
INIT_INTP_POINT(st, tsList[i], val[i]);
|
||||||
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
||||||
pInfo->p = st;
|
pInfo->p = st;
|
||||||
|
@ -5531,6 +5561,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
numOfElems++;
|
numOfElems++;
|
||||||
|
|
||||||
|
if (pInfo->p.key == st.key) {
|
||||||
|
numOfElems = 0;
|
||||||
|
goto _twa_over;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_INTP_POINT(st, tsList[i], val[i]);
|
INIT_INTP_POINT(st, tsList[i], val[i]);
|
||||||
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
||||||
pInfo->p = st;
|
pInfo->p = st;
|
||||||
|
@ -5545,6 +5580,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
numOfElems++;
|
numOfElems++;
|
||||||
|
|
||||||
|
if (pInfo->p.key == st.key) {
|
||||||
|
numOfElems = 0;
|
||||||
|
goto _twa_over;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_INTP_POINT(st, tsList[i], val[i]);
|
INIT_INTP_POINT(st, tsList[i], val[i]);
|
||||||
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
||||||
pInfo->p = st;
|
pInfo->p = st;
|
||||||
|
@ -5559,6 +5599,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
numOfElems++;
|
numOfElems++;
|
||||||
|
|
||||||
|
if (pInfo->p.key == st.key) {
|
||||||
|
numOfElems = 0;
|
||||||
|
goto _twa_over;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_INTP_POINT(st, tsList[i], val[i]);
|
INIT_INTP_POINT(st, tsList[i], val[i]);
|
||||||
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
||||||
pInfo->p = st;
|
pInfo->p = st;
|
||||||
|
@ -5573,6 +5618,11 @@ int32_t twaFunction(SqlFunctionCtx* pCtx) {
|
||||||
}
|
}
|
||||||
numOfElems++;
|
numOfElems++;
|
||||||
|
|
||||||
|
if (pInfo->p.key == st.key) {
|
||||||
|
numOfElems = 0;
|
||||||
|
goto _twa_over;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_INTP_POINT(st, tsList[i], val[i]);
|
INIT_INTP_POINT(st, tsList[i], val[i]);
|
||||||
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
pInfo->dOutput += twa_get_area(pInfo->p, st);
|
||||||
pInfo->p = st;
|
pInfo->p = st;
|
||||||
|
|
Loading…
Reference in New Issue