zstan commented on code in PR #4328:
URL: https://github.com/apache/calcite/pull/4328#discussion_r2060104783


##########
core/src/main/java/org/apache/calcite/rel/rules/SubQueryRemoveRule.java:
##########
@@ -910,6 +911,13 @@ private static void matchJoin(SubQueryRemoveRule rule, 
RelOptRuleCall call) {
     int nFieldsLeft = join.getLeft().getRowType().getFieldCount();
     int nFieldsRight = join.getRight().getRowType().getFieldCount();
 
+    // Correlation columns are also should be considered.
+    final Set<CorrelationId> variablesSet = RelOptUtil.getVariablesUsed(e.rel);
+    if (!variablesSet.isEmpty()) {
+      final CorrelationId id = Iterables.getOnlyElement(variablesSet);

Review Comment:
   Probably you are right but seems we still have no appropriate tests with 
nested sub queries, but i fix it, thanks



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