mohanakatari119-bit opened a new pull request, #20084:
URL: https://github.com/apache/datafusion/pull/20084

   ## Root Cause
   
   For LeftMark/RightMark joins:
   - The output schema is `[left columns, mark column]` (for LeftMark) or 
`[right columns, mark column]` (for RightMark)
   - The mark column is synthetic, added by the join itself
   - The previous implementation treated LeftMark/RightMark like regular joins
   - When `split_join_requirements` split indices at `left_len`, it incorrectly 
tried to route the mark column requirement to the right child
   - This caused a schema mismatch because the mark column doesn't exist in 
either child
   
   ## Solution
   
   Modified `split_join_requirements` to handle LeftMark and RightMark joins 
specially:
   - For LeftMark: Route indices before `left_len` to left child, discard mark 
column requirement
   - For RightMark: Route indices before `left_len` to right child, discard 
mark column requirement
   
   ## Test Plan
   
   Added test `exists_or_exists_with_join` that:
   1. Creates a query with `EXISTS(subquery_a) OR EXISTS(subquery_b)` filter
   2. Follows it with a LEFT JOIN
   3. Runs through full optimizer pipeline
   4. Verifies no schema mismatch error occurs
   
   Fixes #20083


-- 
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]

Reply via email to