提交 88ba66dd 编写于 作者: H Haojun Liao

[td-1290]

上级 fb1178c4
......@@ -105,7 +105,10 @@ int64_t taosGetIntervalStartTimestamp(int64_t startTime, int64_t slidingTime, in
return startTime;
}
int64_t start = ((startTime - intervalTime) / slidingTime + 1) * slidingTime;
int64_t delta = startTime - intervalTime;
int32_t factor = delta > 0? 1:-1;
int64_t start = (delta / slidingTime + factor) * slidingTime;
if (!(timeUnit == 'u' || timeUnit == 'a' || timeUnit == 'm' || timeUnit == 's' || timeUnit == 'h')) {
/*
* here we revised the start time of day according to the local time zone,
......
......@@ -1909,6 +1909,15 @@ static void changeExecuteScanOrder(SQInfo *pQInfo, bool stableQuery) {
return;
}
if (isGroupbyNormalCol(pQuery->pGroupbyExpr)) {
pQuery->order.order = TSDB_ORDER_ASC;
if (pQuery->window.skey > pQuery->window.ekey) {
SWAP(pQuery->window.skey, pQuery->window.ekey, TSKEY);
}
return;
}
if (isPointInterpoQuery(pQuery) && pQuery->intervalTime == 0) {
if (!QUERY_IS_ASC_QUERY(pQuery)) {
qDebug(msg, GET_QINFO_ADDR(pQuery), "interp", pQuery->order.order, TSDB_ORDER_ASC, pQuery->window.skey,
......@@ -4387,7 +4396,7 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, void *tsdb, int32_t vgId, bo
// NOTE: pTableCheckInfo need to update the query time range and the lastKey info
// TODO fixme
changeExecuteScanOrder(pQInfo, false);
changeExecuteScanOrder(pQInfo, isSTableQuery);
code = setupQueryHandle(tsdb, pQInfo, isSTableQuery);
if (code != TSDB_CODE_SUCCESS) {
......@@ -6095,6 +6104,9 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SArray* pTableIdList,
goto _cleanup;
}
// NOTE: pTableCheckInfo need to update the query time range and the lastKey info
changeExecuteScanOrder(pQInfo, isSTableQuery);
int32_t index = 0;
for(int32_t i = 0; i < numOfGroups; ++i) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册