Asthenia0412 opened a new pull request, #67976: URL: https://github.com/apache/doris/pull/67976
### What problem does this PR solve? Issue Number: close #67676 Problem Summary: For a query like `SELECT p.id, CASE WHEN EXISTS (SELECT 1 FROM c WHERE c.parent_id = p.id) THEN ... END FROM p WHERE p.id = 'P1'`, the EXISTS subquery in the SELECT list is converted into a mark join by the Nereids optimizer. InferPredicates skipped mark joins entirely, so the constant 'P1' derived from the outer query was never combined with the correlation predicate and pushed into the subquery scan, resulting in a less efficient plan. A mark join keeps all left rows and only appends the mark column, so an inferred predicate may only be pushed into the right side: pushing it into the left side would drop rows and change the query result. This PR enables predicate inference for mark joins, pushing the inferred predicate into the right side only. ### Release note None ### Check List (For Author) - Test: Unit Test - Behavior changed: No - Does this need documentation: No -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
