suibianwanwank commented on PR #4382:
URL: https://github.com/apache/calcite/pull/4382#issuecomment-2910233387

   Thank you all for your comments and reviews. I've refactored this PR to 
address more related issues here. Although they are not directly connected, 
they were all exposed and affecting each other within the same test. Given that 
the code changes required are minimal, I'm inclined to resolve them together in 
this PR.  
   
   For this SQL.
   
   ```
   SELECT e1.*, d.deptno
   FROM emp e1
   LEFT JOIN dept d
     ON e1.deptno = d.deptno
     AND d.deptno IN (
       SELECT e3.deptno
       FROM emp e3
       WHERE d.deptno > e3.comm
     );
   ```
   The current code has the following issues:  
   
      1. This PR addresses the problem described in the Jira ticket, where an 
outer join produces output even when there are no matching rows.  
      2. The previous handling of the right side of the join was incorrect—it 
requires not only `shiftFieldAccess` but also shifting 
`subQuery.getOperands()`.  
      3. In `rewriteIn`, if `variablesSet` is not empty, `builder.join` 
generates multiple `Correlate` nodes with the same `corId`, which leads to 
decorrelation failure (I believe this results in an invalid `RelNode`).


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

Reply via email to