提交 28c9e754 编写于 作者: A Alex Duan

fix(query): fill function with order by desc

[TD-14782]
上级 c0529691
......@@ -69,7 +69,7 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
// set the other values
if (pFillInfo->type == TSDB_FILL_PREV) {
char* p = FILL_IS_ASC_FILL(pFillInfo) ? prev : next;
char* p = prev;
if (p != NULL) {
for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) {
......@@ -85,7 +85,7 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
setNullValueForRow(pFillInfo, data, pFillInfo->numOfCols, index);
}
} else if (pFillInfo->type == TSDB_FILL_NEXT) {
char* p = FILL_IS_ASC_FILL(pFillInfo)? next : prev;
char* p = next;
if (p != NULL) {
for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) {
......@@ -178,8 +178,6 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, void** data, int32_t outputR
if (FILL_IS_ASC_FILL(pFillInfo)) {
assert(pFillInfo->currentKey >= pFillInfo->start);
} else {
assert(pFillInfo->currentKey <= pFillInfo->start);
}
while (pFillInfo->numOfCurrent < outputRows) {
......@@ -432,6 +430,8 @@ void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey)
pFillInfo->end = endKey;
if (!FILL_IS_ASC_FILL(pFillInfo)) {
pFillInfo->end = taosTimeTruncate(endKey, &pFillInfo->interval, pFillInfo->precision);
if (numOfRows > 0)
pFillInfo->currentKey = pFillInfo->end;
}
pFillInfo->index = 0;
......@@ -459,8 +459,7 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo) {
return true;
}
if (pFillInfo->numOfTotal > 0 && (((pFillInfo->end > pFillInfo->start) && FILL_IS_ASC_FILL(pFillInfo)) ||
(pFillInfo->end < pFillInfo->start && !FILL_IS_ASC_FILL(pFillInfo)))) {
if (pFillInfo->numOfTotal > 0 && pFillInfo->end > pFillInfo->start) {
return getNumOfResultsAfterFillGap(pFillInfo, pFillInfo->end, 4096) > 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册