Merge pull request #22579 from taosdata/fix/TD-25959
fix: wrong start key for pFill when unit of sliding is y or n
This commit is contained in:
commit
85452548da
|
@ -166,18 +166,20 @@ static void revisedFillStartKey(SFillOperatorInfo* pInfo, SSDataBlock* pBlock, i
|
||||||
} else if (ekey < pInfo->pFillInfo->start) {
|
} else if (ekey < pInfo->pFillInfo->start) {
|
||||||
int64_t t = ekey;
|
int64_t t = ekey;
|
||||||
SInterval* pInterval = &pInfo->pFillInfo->interval;
|
SInterval* pInterval = &pInfo->pFillInfo->interval;
|
||||||
|
int64_t prev = t;
|
||||||
while(1) {
|
while(1) {
|
||||||
int64_t prev = taosTimeAdd(t, pInterval->sliding, pInterval->slidingUnit, pInterval->precision);
|
int64_t next = taosTimeAdd(t, pInterval->sliding, pInterval->slidingUnit, pInterval->precision);
|
||||||
if (prev >= pInfo->pFillInfo->start) {
|
if (next >= pInfo->pFillInfo->start) {
|
||||||
t = prev;
|
prev = t;
|
||||||
|
t = next;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
t = prev;
|
prev = t;
|
||||||
|
t = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo time window chosen problem: t or prev value?
|
// todo time window chosen problem: t or next value?
|
||||||
if (t > pInfo->pFillInfo->start) t -= pInterval->sliding;
|
if (t > pInfo->pFillInfo->start) t = prev;
|
||||||
taosFillUpdateStartTimestampInfo(pInfo->pFillInfo, t);
|
taosFillUpdateStartTimestampInfo(pInfo->pFillInfo, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,6 +206,19 @@ if $desc_rows != $asc_rows then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
print ================= step11
|
||||||
|
|
||||||
|
sql create database if not exists test0828
|
||||||
|
sql use test0828
|
||||||
|
sql create stable st (ts timestamp, c2 int) tags(tg int)
|
||||||
|
sql insert into ct1 using st tags(1) values('2021-08-01', 0)
|
||||||
|
sql insert into ct2 using st tags(2) values('2022-08-01', 1)
|
||||||
|
sql select _wstart, _wend, count(*) from st where ts>='2021-01-01' and ts < '2023-08-28' interval(1n) fill(value, 0) order by _wstart desc
|
||||||
|
print $rows
|
||||||
|
if $rows != 32 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql drop database test0828
|
||||||
print =============== clear
|
print =============== clear
|
||||||
#sql drop database $db
|
#sql drop database $db
|
||||||
#sql select * from information_schema.ins_databases
|
#sql select * from information_schema.ins_databases
|
||||||
|
|
Loading…
Reference in New Issue