lowka commented on code in PR #3608:
URL: https://github.com/apache/ignite-3/pull/3608#discussion_r1567463091


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/HashJoinPlannerTest.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.sql.engine.planner;
+
+import static 
org.apache.ignite.internal.sql.engine.planner.CorrelatedSubqueryPlannerTest.createTestTable;
+
+import java.util.stream.Stream;
+import org.apache.calcite.plan.RelOptPlanner.CannotPlanException;
+import org.apache.ignite.internal.sql.engine.rel.IgniteHashJoin;
+import org.apache.ignite.internal.sql.engine.schema.IgniteSchema;
+import org.apache.ignite.internal.sql.engine.schema.IgniteTable;
+import org.apache.ignite.internal.testframework.IgniteTestUtils;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+/** HashJoin planner test. */
+public class HashJoinPlannerTest extends AbstractPlannerTest {
+    private static final String[] disabledRules = {"NestedLoopJoinConverter", 
"CorrelatedNestedLoopJoin", "MergeJoinConverter"};
+
+    private static final String[] joinTypes = {"LEFT", "RIGHT", "INNER", "FULL 
OUTER"};
+
+    /** Check that only appropriate conditions are acceptable for hash join. */
+    @ParameterizedTest()
+    @MethodSource("joinConditions")
+    @SuppressWarnings("ThrowableNotThrown")
+    public void hashJoinAppliedConditions(String sql, boolean canBePlanned) 
throws Exception {
+        IgniteTable tbl = createTestTable("ID", "C1");
+
+        IgniteSchema schema = createSchema(tbl);
+
+        for (String type : joinTypes) {
+            String sql0 = String.format(sql, type);
+
+            if (canBePlanned) {
+                assertPlan(sql0, schema, 
nodeOrAnyChild(isInstanceOf(IgniteHashJoin.class)), disabledRules);
+            } else {
+                IgniteTestUtils.assertThrowsWithCause(() -> physicalPlan(sql0, 
schema, disabledRules),
+                        CannotPlanException.class,
+                        "There are not enough rules");
+            }
+        }
+    }
+
+    private static Stream<Arguments> joinConditions() {

Review Comment:
   Maybe we can have some tests that demonstrate behaviour of HashJoins 
different distributions, because in some cases there should be HashJoin 
.input[0] -> Exchange -> someInput, and HashJoin .input[0] -> someInput.
   
   Or trait propagation is addressed in the follow up tickets?
   



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