提交 295b222b 编写于 作者: A Alex Duan

[TS-575]<bug>(query): support limit + offset combine query

上级 40cc93b0
......@@ -7509,7 +7509,7 @@ int32_t validateLimitNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSqlN
*/
if (pQueryInfo->limit.limit > 0) {
pQueryInfo->vgroupLimit = pQueryInfo->limit.limit + pQueryInfo->limit.offset;
//pQueryInfo->limit.limit = -1;
pQueryInfo->limit.limit += pQueryInfo->limit.offset;
}
pQueryInfo->limit.offset = 0;
......
......@@ -3177,6 +3177,9 @@ static SSqlObj *tscCreateSTableSubquery(SSqlObj *pSql, SRetrieveSupport *trsuppo
// clear the limit/offset info, since it should not be sent to vnode to be executed.
// pQueryInfo->limit.limit = -1; // alexduan subquery limit is same with parent is ok
if (pQueryInfo->limit.offset > 0) {
pQueryInfo->limit.limit += pQueryInfo->limit.offset;
}
pQueryInfo->limit.offset = 0;
assert(trsupport->subqueryIndex < pSql->subState.numOfSub);
......
......@@ -205,7 +205,7 @@ class TDTestCase:
tdSql.checkData(19, 1, 6)
sql = "select * from st order by ts desc limit 20"
tdSql.waitedQuery(sql, 20, WAITS)
tdSql.checkData(18, 1, 2999980)
tdSql.checkData(19, 1, 2999980)
sql = "select * from st where ts>='2017-07-14 10:40:10' and ts<'2017-07-22 18:40:10' order by ts limit 16;"
tdSql.waitedQuery(sql, 16, WAITS)
tdSql.checkData(15, 1, 15)
......@@ -217,8 +217,7 @@ class TDTestCase:
tdSql.checkData(15, 1, 720004)
sql = "select * from st where ts>='2017-07-14 10:40:10' and ts<'2017-07-22 18:40:10' order by ts desc limit 16 offset 2;"
tdSql.waitedQuery(sql, 16, WAITS)
tdSql.checkData(0, 15, 720004)
tdSql.checkData(15, 1, 720004)
#
# add case with filename
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册