Merge pull request #16209 from taosdata/fix/TD-18453
fix(query): fix elapsed order by ts desc result inconsistency after flush to disk
This commit is contained in:
commit
b703380e51
|
@ -3970,16 +3970,16 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) {
|
||||||
TSKEY* ptsList = (int64_t*)colDataGetData(pCol, 0);
|
TSKEY* ptsList = (int64_t*)colDataGetData(pCol, 0);
|
||||||
if (pCtx->order == TSDB_ORDER_DESC) {
|
if (pCtx->order == TSDB_ORDER_DESC) {
|
||||||
if (pCtx->start.key == INT64_MIN) {
|
if (pCtx->start.key == INT64_MIN) {
|
||||||
pInfo->max =
|
pInfo->max = (pInfo->max < ptsList[start]) ? ptsList[start] : pInfo->max;
|
||||||
(pInfo->max < ptsList[start + pInput->numOfRows - 1]) ? ptsList[start + pInput->numOfRows - 1] : pInfo->max;
|
|
||||||
} else {
|
} else {
|
||||||
pInfo->max = pCtx->start.key + 1;
|
pInfo->max = pCtx->start.key + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pCtx->end.key != INT64_MIN) {
|
if (pCtx->end.key == INT64_MIN) {
|
||||||
pInfo->min = pCtx->end.key;
|
pInfo->min = (pInfo->min > ptsList[start + pInput->numOfRows - 1]) ?
|
||||||
|
ptsList[start + pInput->numOfRows - 1] : pInfo->min;
|
||||||
} else {
|
} else {
|
||||||
pInfo->min = ptsList[start];
|
pInfo->min = pCtx->end.key;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pCtx->start.key == INT64_MIN) {
|
if (pCtx->start.key == INT64_MIN) {
|
||||||
|
@ -3988,10 +3988,11 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) {
|
||||||
pInfo->min = pCtx->start.key;
|
pInfo->min = pCtx->start.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pCtx->end.key != INT64_MIN) {
|
if (pCtx->end.key == INT64_MIN) {
|
||||||
pInfo->max = pCtx->end.key + 1;
|
pInfo->max = (pInfo->max < ptsList[start + pInput->numOfRows - 1]) ?
|
||||||
|
ptsList[start + pInput->numOfRows - 1] : pInfo->max;
|
||||||
} else {
|
} else {
|
||||||
pInfo->max = ptsList[start + pInput->numOfRows - 1];
|
pInfo->max = pCtx->end.key + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue