ygerzhedovich commented on a change in pull request #411:
URL: https://github.com/apache/ignite-3/pull/411#discussion_r741715819



##########
File path: 
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteMergeJoin.java
##########
@@ -166,30 +168,39 @@ else if (isPrefix(rightCollation.getKeys(), 
joinInfo.rightKeys))// preserve righ
 
         int rightOff = this.left.getRowType().getFieldCount();
 
-        Map<Integer, Integer> rightToLeft = joinInfo.pairs().stream()
-            .collect(Collectors.toMap(p -> p.target, p -> p.source));
+        List<IntPair> pairs = joinInfo.pairs();
+
+        Int2IntOpenHashMap rightToLeft = new Int2IntOpenHashMap(pairs.size());
+
+        for (IntPair pair : pairs)
+            rightToLeft.put(pair.target, pair.source);
 
         List<Integer> collationLeftPrj = new ArrayList<>();
 
-        for (Integer c : collation.getKeys()) {
+        for (RelFieldCollation fieldCollation : 
collation.getFieldCollations()) {
+            int c = fieldCollation.getFieldIndex();
             collationLeftPrj.add(
-                c >= rightOff ? rightToLeft.get(c - rightOff) : c
+                    c >= rightOff ? rightToLeft.get(c - rightOff) : c
             );
         }
 
         boolean preserveNodeCollation = false;
 
         List<Integer> newLeftCollation, newRightCollation;
 
-        Map<Integer, Integer> leftToRight = joinInfo.pairs().stream()
-            .collect(Collectors.toMap(p -> p.source, p -> p.target));
+        Int2IntOpenHashMap leftToRight = new Int2IntOpenHashMap(pairs.size());
+
+        for (IntPair pair : pairs)
+            leftToRight.put(pair.source, pair.target);
 
         if (isPrefix(collationLeftPrj, joinInfo.leftKeys)) { // preserve 
collation

Review comment:
       I am sure that should be done as a separate task - replace for Set and 
List

##########
File path: 
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteMergeJoin.java
##########
@@ -166,30 +168,39 @@ else if (isPrefix(rightCollation.getKeys(), 
joinInfo.rightKeys))// preserve righ
 
         int rightOff = this.left.getRowType().getFieldCount();
 
-        Map<Integer, Integer> rightToLeft = joinInfo.pairs().stream()
-            .collect(Collectors.toMap(p -> p.target, p -> p.source));
+        List<IntPair> pairs = joinInfo.pairs();
+
+        Int2IntOpenHashMap rightToLeft = new Int2IntOpenHashMap(pairs.size());
+
+        for (IntPair pair : pairs)
+            rightToLeft.put(pair.target, pair.source);
 
         List<Integer> collationLeftPrj = new ArrayList<>();
 
-        for (Integer c : collation.getKeys()) {
+        for (RelFieldCollation fieldCollation : 
collation.getFieldCollations()) {
+            int c = fieldCollation.getFieldIndex();
             collationLeftPrj.add(
-                c >= rightOff ? rightToLeft.get(c - rightOff) : c
+                    c >= rightOff ? rightToLeft.get(c - rightOff) : c
             );
         }
 
         boolean preserveNodeCollation = false;
 
         List<Integer> newLeftCollation, newRightCollation;
 
-        Map<Integer, Integer> leftToRight = joinInfo.pairs().stream()
-            .collect(Collectors.toMap(p -> p.source, p -> p.target));
+        Int2IntOpenHashMap leftToRight = new Int2IntOpenHashMap(pairs.size());
+
+        for (IntPair pair : pairs)
+            leftToRight.put(pair.source, pair.target);
 
         if (isPrefix(collationLeftPrj, joinInfo.leftKeys)) { // preserve 
collation
             newLeftCollation = new ArrayList<>();
             newRightCollation = new ArrayList<>();

Review comment:
       Let's skip it for current PR




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