fix(query): fix the timewindow calculate error.
This commit is contained in:
parent
a0428f5685
commit
dc92b27913
|
@ -842,30 +842,10 @@ static void getInitialStartTimeWindow(SInterval* pInterval, TSKEY ts, STimeWindo
|
||||||
}
|
}
|
||||||
|
|
||||||
static STimeWindow doCalculateTimeWindow(int64_t ts, SInterval* pInterval) {
|
static STimeWindow doCalculateTimeWindow(int64_t ts, SInterval* pInterval) {
|
||||||
STimeWindow w = {0};
|
STimeWindow w = {0};
|
||||||
|
|
||||||
if (pInterval->intervalUnit == 'n' || pInterval->intervalUnit == 'y') {
|
|
||||||
w.skey = taosTimeTruncate(ts, pInterval, pInterval->precision);
|
|
||||||
w.ekey = taosTimeAdd(w.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1;
|
|
||||||
} else {
|
|
||||||
int64_t st = w.skey;
|
|
||||||
if (pInterval->offset > 0) {
|
|
||||||
st = taosTimeAdd(st, pInterval->offset, pInterval->offsetUnit, pInterval->precision);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (st > ts) {
|
|
||||||
st -= ((st - ts + pInterval->sliding - 1) / pInterval->sliding) * pInterval->sliding;
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t et = st + pInterval->interval - 1;
|
|
||||||
if (et < ts) {
|
|
||||||
st += ((ts - et + pInterval->sliding - 1) / pInterval->sliding) * pInterval->sliding;
|
|
||||||
}
|
|
||||||
|
|
||||||
w.skey = st;
|
|
||||||
w.ekey = taosTimeAdd(w.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
w.skey = taosTimeTruncate(ts, pInterval, pInterval->precision);
|
||||||
|
w.ekey = taosTimeAdd(w.skey, pInterval->interval, pInterval->intervalUnit, pInterval->precision) - 1;
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -544,8 +544,9 @@ bool taosFillHasMoreResults(SFillInfo* pFillInfo) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pFillInfo->numOfTotal > 0 && (((pFillInfo->end > pFillInfo->start) && FILL_IS_ASC_FILL(pFillInfo)) ||
|
bool ascFill = FILL_IS_ASC_FILL(pFillInfo);
|
||||||
(pFillInfo->end < pFillInfo->start && !FILL_IS_ASC_FILL(pFillInfo)))) {
|
if (pFillInfo->numOfTotal > 0 &&
|
||||||
|
(((pFillInfo->end > pFillInfo->start) && ascFill) || (pFillInfo->end < pFillInfo->start && !ascFill))) {
|
||||||
return getNumOfResultsAfterFillGap(pFillInfo, pFillInfo->end, 4096) > 0;
|
return getNumOfResultsAfterFillGap(pFillInfo, pFillInfo->end, 4096) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue