yujun777 opened a new pull request, #50528: URL: https://github.com/apache/doris/pull/50528
### What problem does this PR solve? logical apply shouldnot include right child's data trait, it's use to desc the subquery, but the subquery's data trait may not keep in upper plans. This PR fix this. for example: for sql `select * from t1 where t1.x = 1 or exists(select * from t2 where t2.y = 10 and t1.y = t2.y and t1.z = t1.u);` the outer where will become a plan filter: LogicalFilter1(t1.x = 1 or ifnull(xx, false) | |-- LogicalProject2 | |-- LogicalApply | |-- LogicalOlapScan | |-- LogicalProject2 | |-- LogicalFitler2 (t2.y = 10 and t1.y = t2.y and t1.z = t1.u) LogicalApply's right child LoggicalProject2 will contains equal set: t1.z = t1.u, but LogicalApply should not include this equal set. If logical apply contains it, then logical apply's parent logical project2 will contains it, then logical filter1 will contains it later. But we known that, for logical filter 1, the EXISTS expression(exists(select * from t2 where t2.y = 10 and t1.y = t2.y and t1.z = t1.u)) maynot be true, so logical filter 1 must exclude equal set `t1.z = t1.u` ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: https://github.com/apache/doris-website/pull/1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org