rubenada commented on code in PR #3277:
URL: https://github.com/apache/calcite/pull/3277#discussion_r1242360002


##########
core/src/main/java/org/apache/calcite/rel/rules/SubQueryRemoveRule.java:
##########
@@ -865,6 +866,9 @@ private static void matchFilter(SubQueryRemoveRule rule,
           LogicVisitor.find(RelOptUtil.Logic.TRUE, ImmutableList.of(c), e);
       final Set<CorrelationId>  variablesSet =
           RelOptUtil.getVariablesUsed(e.rel);
+      if (!filterVariablesSet.isEmpty()) {
+        variablesSet.retainAll(filterVariablesSet);

Review Comment:
   Thanks @libenchao .
   I just saw on [PR#3193](https://github.com/apache/calcite/pull/3193)  that 
@HanumathRao is off traveling these days, so I propose to do the other way 
around: I integrated in the current PR the changes from PR#3193 (including your 
review from 
[here](https://github.com/libenchao/calcite/commits/5683-nested-correlated-sub-query-throws-2)),
 tagging @HanumathRao as co-author. We can merge all changes for both tickets 
([CALCITE-5789](https://issues.apache.org/jira/browse/CALCITE-5789) & 
[CALCITE-5683](https://issues.apache.org/jira/browse/CALCITE-5683)) under the 
current PR, we close PR#3193 (superseded by this one), and I'll reopen 
[CALCITE-5716](https://issues.apache.org/jira/browse/CALCITE-5716) which will 
remain a pending issue.
   
   If you agree, I'll squash commits and proceed to merge



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