korlov42 commented on code in PR #5454:
URL: https://github.com/apache/ignite-3/pull/5454#discussion_r2010403614


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/LogicalRelImplementor.java:
##########
@@ -422,6 +429,7 @@ public RexNode visitInputRef(RexInputRef ref) {
         return node;
     }
 
+

Review Comment:
   extra line



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/LogicalRelImplementor.java:
##########
@@ -377,37 +384,37 @@ public Node<RowT> visit(IgniteMergeJoin rel) {
 
         SqlJoinProjection<RowT> joinProjection = createJoinProjection(rel, 
rel.getRowType(), leftType.getFieldCount());
 
-        int pairsCnt = rel.analyzeCondition().pairs().size();
+        ImmutableBitSet nullCompAsEqual = nullComparisonStrategyVector(rel, 
rel.analyzeCondition().leftSet());
 
-        ImmutableBitSet leftKeys = rel.analyzeCondition().leftSet();
+        ImmutableIntList leftKeys = rel.leftCollation().getKeys();
+        ImmutableIntList rightKeys = rel.rightCollation().getKeys();
 
-        List<RexNode> conjunctions = 
RelOptUtil.conjunctions(rel.getCondition());
+        // Convert conditions to using collation indexes instead of field 
indexes.
+        List<IntPair> condIndexes = rel.analyzeCondition().pairs().stream()

Review Comment:
   I think stream + linear scan of keys may introduced performance penalty. Can 
we introduce benchmark to measure this? Perhaps, scenario should be like this: 
single merge join of two tables with single row in each; the size of join pairs 
is configurable



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/LogicalRelImplementor.java:
##########
@@ -377,37 +384,37 @@ public Node<RowT> visit(IgniteMergeJoin rel) {
 
         SqlJoinProjection<RowT> joinProjection = createJoinProjection(rel, 
rel.getRowType(), leftType.getFieldCount());
 
-        int pairsCnt = rel.analyzeCondition().pairs().size();
+        ImmutableBitSet nullCompAsEqual = nullComparisonStrategyVector(rel, 
rel.analyzeCondition().leftSet());
 
-        ImmutableBitSet leftKeys = rel.analyzeCondition().leftSet();
+        ImmutableIntList leftKeys = rel.leftCollation().getKeys();
+        ImmutableIntList rightKeys = rel.rightCollation().getKeys();
 
-        List<RexNode> conjunctions = 
RelOptUtil.conjunctions(rel.getCondition());
+        // Convert conditions to using collation indexes instead of field 
indexes.

Review Comment:
   ```suggestion
           // Convert conditions to use collation indexes instead of field 
indexes.
   ```



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rel/IgniteMergeJoin.java:
##########
@@ -352,4 +357,42 @@ private static RelCollation extendCollation(RelCollation 
collation, List<Integer
 
         return RelCollations.of(fieldsForNewCollation);
     }
+
+    /**
+     * The function builds desired collation for another join branch regarding 
provided join conditions information.
+     * It builds valid right collation for the given left collation and vice 
versa.
+     * Note: the function support complex many-to-many conditions, where a 
source matches multiple targets and vice versa.

Review Comment:
   ```suggestion
        * The function builds desired collation for another join branch 
regarding provided join conditions information.
        * 
        * <p>It builds valid right collation for the given left collation and 
vice versa.
        * 
        * <p>Note: the function support complex many-to-many conditions, where 
a source matches multiple targets and vice versa.
   ```



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