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

   I believe this is not the root cause of the incorrect query results. It's 
related to https://github.com/apache/calcite/pull/4375. 
   
   The issue occurs in the Decorrelator. PR-4375 appears to have missed some 
cases where parentPropagatesNullValues should be set to false when Correlate's 
joinType is not Left. 
   
   I'm confident the following modification can fix all tests in this PR.
   ```
   diff --git 
a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java 
b/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
   index b5500c871..e150079c7 100644
   --- a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
   +++ b/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
   @@ -1629,7 +1629,8 @@ private static boolean isWidening(RelDataType type, 
RelDataType type1) {
        }
    
        frameStack.push(Pair.of(rel.getCorrelationId(), leftFrame));
   -    final Frame rightFrame = getInvoke(oldRight, true, rel, 
parentPropagatesNullValues);
   +    final Frame rightFrame = getInvoke(oldRight, true, rel,
   +        parentPropagatesNullValues && rel.getJoinType() == 
JoinRelType.LEFT);
        frameStack.pop();
   ```


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