Skip to content

Commit

Permalink
fix: fill operator with desc ts order returned 1 more rows
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjiaming0909 committed Aug 23, 2023
1 parent ec76144 commit a5c5afb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/libs/executor/src/filloperator.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock, i
int64_t ekey = pBlock->info.window.ekey;
if (ekey > pInfo->pFillInfo->start) {
ASSERT( taosFillNotStarted(pInfo->pFillInfo));
taosFillUpdateStartTimestampInfo(pInfo->pFillInfo, ekey);
} else if (ekey < pInfo->pFillInfo->start) {
int64_t t = ekey;
SInterval* pInterval = &pInfo->pFillInfo->interval;
Expand All @@ -177,8 +176,9 @@ static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock, i
}

// todo time window chosen problem: t or prev value?
taosFillUpdateStartTimestampInfo(pInfo->pFillInfo, t);
ekey = t;
}
taosFillUpdateStartTimestampInfo(pInfo->pFillInfo, ekey - pInfo->pFillInfo->interval.sliding);
}
}

Expand Down
9 changes: 9 additions & 0 deletions tests/system-test/2-query/fill_with_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,18 @@ def test_partition_by_with_interval_fill_prev_new_group_fill_error(self):
for j in range(0,60):
tdSql.checkData(i*1500+j, 1, None)

def test_fill_with_order_by(self):
sql = "select _wstart, _wend, count(ts), sum(c1) from meters where ts > '2018-11-25 00:00:00.000' and ts < '2018-11-26 00:00:00.00' interval(1d) fill(NULL) order by _wstart"
tdSql.query(sql)
tdSql.checkRows(1)
sql = "select _wstart, _wend, count(ts), sum(c1) from meters where ts > '2018-11-25 00:00:00.000' and ts < '2018-11-26 00:00:00.00' interval(1d) fill(NULL) order by _wstart desc"
tdSql.query(sql)
tdSql.checkRows(1)

def run(self):
self.prepareTestEnv()
self.test_partition_by_with_interval_fill_prev_new_group_fill_error()
self.test_fill_with_order_by()

def stop(self):
tdSql.close()
Expand Down

0 comments on commit a5c5afb

Please sign in to comment.