fix: join condition push down issue

This commit is contained in:
dapan1121 2025-02-08 17:14:48 +08:00
parent db807020a0
commit 8ce9e6ee1d
2 changed files with 10 additions and 1 deletions

View File

@ -635,7 +635,9 @@ static EDealRes pdcJoinIsCrossTableCond(SNode* pNode, void* pContext) {
if (QUERY_NODE_COLUMN == nodeType(pNode)) { if (QUERY_NODE_COLUMN == nodeType(pNode)) {
if (pdcJoinColInTableList(pNode, pCxt->pLeftTbls)) { if (pdcJoinColInTableList(pNode, pCxt->pLeftTbls)) {
pCxt->havaLeftCol = true; pCxt->havaLeftCol = true;
} else if (pdcJoinColInTableList(pNode, pCxt->pRightTbls)) { }
if (pdcJoinColInTableList(pNode, pCxt->pRightTbls)) {
pCxt->haveRightCol = true; pCxt->haveRightCol = true;
} }
return pCxt->havaLeftCol && pCxt->haveRightCol ? DEAL_RES_END : DEAL_RES_CONTINUE; return pCxt->havaLeftCol && pCxt->haveRightCol ? DEAL_RES_END : DEAL_RES_CONTINUE;

View File

@ -32,6 +32,13 @@ sql select a.t1 from (select * from sta partition by tbname order by ts desc) a
if $rows != 12 then if $rows != 12 then
return -1 return -1
endi endi
sql select a.ts from (select last(tba1.ts) as ts from tba1, tba2 where tba1.ts = tba2.ts) as a join (select ts from tba2) as tba2 on a.ts = tba2.ts;
if $rows != 1 then
return -1
endi
if $data00 != @23-11-17 16:29:03.000@ then
return -1
endi
#left join + non join #left join + non join
sql_error select a.*,b.* from (select * from sta partition by tbname) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts; sql_error select a.*,b.* from (select * from sta partition by tbname) a left join (select * from sta partition by tbname order by ts) b on a.ts = b.ts;