zstan commented on a change in pull request #9720:
URL: https://github.com/apache/ignite/pull/9720#discussion_r787623666



##########
File path: 
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgnitePlanner.java
##########
@@ -338,6 +350,132 @@ public RelRoot trimUnusedFields(RelRoot root) {
         return root.withRel(converter.trimUnusedFields(dml || ordered, 
root.rel));
     }
 
+    /**
+     * When rewriting sub-queries to {@code LogicalCorrelate} instances, 
correlate nodes with the same correlation ids
+     * can be created (if there was more then one sub-query using the same 
correlate table). It's not a problem, when
+     * rows are processed one by one (like in the enumerable convension), but 
Ignite execution nodes process batches
+     * of rows, and execution nodes in some cases can get unexpected values 
for correlated variables.
+     *
+     * This method replaces collisions by variables in correlates. For the 
left hand of LogicalCorrelate duplicated
+     * correlated variable and it's usages repleced to the new one. For 
example:

Review comment:
       ```suggestion
        * correlated variable and it's usages replaced with the new one. For 
example:
   ```




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