未验证 提交 178d2cac 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #20156 from taosdata/fix/TD-22520

fix(query): fix apply limit error for doMultiwayMerge operator if datablocks belongs to the same group
...@@ -672,7 +672,9 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData ...@@ -672,7 +672,9 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
} }
bool limitReached = applyLimitOffset(&pInfo->limitInfo, p, pTaskInfo); bool limitReached = applyLimitOffset(&pInfo->limitInfo, p, pTaskInfo);
if (limitReached) { // if limit is reached within a group, do not clear limiInfo otherwise the next block
// will be processed.
if (newgroup && limitReached) {
resetLimitInfoForNextGroup(&pInfo->limitInfo); resetLimitInfoForNextGroup(&pInfo->limitInfo);
} }
......
...@@ -124,6 +124,18 @@ class TDTestCase: ...@@ -124,6 +124,18 @@ class TDTestCase:
sql2 = "select count(t1) from (select * from %s.meters)" %dbname sql2 = "select count(t1) from (select * from %s.meters)" %dbname
self.sql_base_check(sql1,sql2) self.sql_base_check(sql1,sql2)
# TD-22520
tdSql.query("select tbname, ts from %s.meters where ts < '2017-07-14 10:40:00' order by ts asc limit 150;" %dbname)
tdSql.checkRows(150)
tdSql.query("select tbname, ts from %s.meters where ts < '2017-07-14 10:40:00' order by ts asc limit 300;" %dbname)
tdSql.checkRows(300)
tdSql.query("select tbname, ts from %s.meters where ts < '2017-07-14 10:40:00' order by ts desc limit 150;" %dbname)
tdSql.checkRows(150)
tdSql.query("select tbname, ts from %s.meters where ts < '2017-07-14 10:40:00' order by ts desc limit 300;" %dbname)
tdSql.checkRows(300)
def sql_base_check(self,sql1,sql2): def sql_base_check(self,sql1,sql2):
tdSql.query(sql1) tdSql.query(sql1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册