Merge pull request #30087 from taosdata/fix/TS-6080/conditionPushdown
fix: condition shouldn't pushdown as subquery has limit clause
This commit is contained in:
commit
4c446ee2f3
|
@ -2112,12 +2112,15 @@ static int32_t pdcDealProject(SOptimizeContext* pCxt, SProjectLogicNode* pProjec
|
||||||
if (NULL != pProject->node.pLimit || NULL != pProject->node.pSlimit) {
|
if (NULL != pProject->node.pLimit || NULL != pProject->node.pSlimit) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProject->node.pChildren, 0);
|
||||||
|
if(pChild->pLimit != NULL) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SNode* pProjCond = NULL;
|
SNode* pProjCond = NULL;
|
||||||
code = rewriteProjectCondForPushDown(pCxt, pProject, &pProjCond);
|
code = rewriteProjectCondForPushDown(pCxt, pProject, &pProjCond);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pProject->node.pChildren, 0);
|
|
||||||
code = pdcPushDownCondToChild(pCxt, pChild, &pProjCond);
|
code = pdcPushDownCondToChild(pCxt, pChild, &pProjCond);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -360,6 +360,18 @@ class TDTestCase:
|
||||||
tdSql.checkRows(0)
|
tdSql.checkRows(0)
|
||||||
tdLog.info("check db1 vgroups 1 limit 1 offset 100 successfully!")
|
tdLog.info("check db1 vgroups 1 limit 1 offset 100 successfully!")
|
||||||
|
|
||||||
|
def ts6080(self):
|
||||||
|
tdLog.printNoPrefix("======== test case 6080: ")
|
||||||
|
tdSql.execute("create database db6080 vgroups 1;")
|
||||||
|
tdSql.execute("use db6080;")
|
||||||
|
tdSql.execute("create table db6080.st(ts timestamp, age int) tags(area int);")
|
||||||
|
tdSql.execute("create table db6080.t1 using db6080.st tags(1);")
|
||||||
|
|
||||||
|
tdSql.Execute("insert into db6080.t1 values(1537146000000, 1);")
|
||||||
|
tdSql.Execute("insert into db6080.t1 values(1537146000001, 2);")
|
||||||
|
|
||||||
|
tdSql.query("select ts, age from (select ts, age from db6080.t1 order by ts limit 1) where ts > 1537146000000;")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# tdSql.prepare()
|
# tdSql.prepare()
|
||||||
|
@ -370,6 +382,7 @@ class TDTestCase:
|
||||||
self.checkVGroups()
|
self.checkVGroups()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success(f"{__file__} successfully executed")
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
Loading…
Reference in New Issue