You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by al...@apache.org on 2025/03/28 19:07:36 UTC

(ignite) branch master updated: IGNITE-24753 SQL Calcite: Fix freeze in MergeJoin right/full execution nodes - Fixes #11955.

This is an automated email from the ASF dual-hosted git repository.

alexpl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new 1bf7fdb1239 IGNITE-24753 SQL Calcite: Fix freeze in MergeJoin right/full execution nodes - Fixes #11955.
1bf7fdb1239 is described below

commit 1bf7fdb1239d40ebb2cf68f88959fae2637ffef0
Author: Aleksey Plekhanov <pl...@gmail.com>
AuthorDate: Fri Mar 28 22:06:08 2025 +0300

    IGNITE-24753 SQL Calcite: Fix freeze in MergeJoin right/full execution nodes - Fixes #11955.
    
    Signed-off-by: Aleksey Plekhanov <pl...@gmail.com>
---
 .../query/calcite/exec/rel/MergeJoinNode.java      | 14 +++++---
 .../calcite/exec/rel/MergeJoinExecutionTest.java   |  7 ++--
 .../tpch/{TpchQ20Test.java => TpchTest.java}       | 41 +++++++++++++++++-----
 .../ignite/testsuites/IntegrationTestSuite.java    |  4 +--
 4 files changed, 50 insertions(+), 16 deletions(-)

diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinNode.java
index 35f31e8b931..94648e323ef 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinNode.java
@@ -733,10 +733,13 @@ public abstract class MergeJoinNode<Row> extends AbstractNode<Row> {
                     }
                     else {
                         if (left == null) {
-                            if (waitingLeft == NOT_WAITING)
+                            if (waitingLeft == NOT_WAITING) {
+                                rightIdx = 0;
                                 rightMaterialization = null;
+                                drainMaterialization = false;
+                            }
 
-                            break;
+                            continue;
                         }
 
                         if (rightIdx >= rightMaterialization.size()) {
@@ -962,10 +965,13 @@ public abstract class MergeJoinNode<Row> extends AbstractNode<Row> {
                     }
                     else {
                         if (left == null) {
-                            if (waitingLeft == NOT_WAITING)
+                            if (waitingLeft == NOT_WAITING) {
+                                rightIdx = 0;
                                 rightMaterialization = null;
+                                drainMaterialization = false;
+                            }
 
-                            break;
+                            continue;
                         }
 
                         if (rightIdx >= rightMaterialization.size()) {
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinExecutionTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinExecutionTest.java
index c7304838909..c54b1225474 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinExecutionTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinExecutionTest.java
@@ -256,6 +256,7 @@ public class MergeJoinExecutionTest extends AbstractExecutionTest {
             {3, "Arch"},
             {4, "QA"},
             {4, "OLD_QA"},
+            {5, "Tx&PME"},
         };
 
         verifyJoin(left, right, INNER, new Object[][] {
@@ -291,7 +292,8 @@ public class MergeJoinExecutionTest extends AbstractExecutionTest {
             {5, "Ivan", "QA"},
             {5, "Ivan", "OLD_QA"},
             {6, "Andrey", "QA"},
-            {6, "Andrey", "OLD_QA"}
+            {6, "Andrey", "OLD_QA"},
+            {null, null, "Tx&PME"}
         });
         verifyJoin(left, right, FULL, new Object[][] {
             {1, "Roman", null},
@@ -304,7 +306,8 @@ public class MergeJoinExecutionTest extends AbstractExecutionTest {
             {5, "Ivan", "QA"},
             {5, "Ivan", "OLD_QA"},
             {6, "Andrey", "QA"},
-            {6, "Andrey", "OLD_QA"}
+            {6, "Andrey", "OLD_QA"},
+            {null, null, "Tx&PME"}
         });
         verifyJoin(left, right, SEMI, new Object[][] {
             {2, "Igor"},
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchQ20Test.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchTest.java
similarity index 56%
rename from modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchQ20Test.java
rename to modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchTest.java
index 5c134cd12fa..54251de8783 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchQ20Test.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/TpchTest.java
@@ -17,22 +17,47 @@
 
 package org.apache.ignite.internal.processors.query.calcite.integration.tpch;
 
+import java.util.Collection;
 import org.apache.ignite.internal.processors.query.calcite.integration.AbstractBasicIntegrationTest;
+import org.apache.ignite.internal.util.typedef.F;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 
 /** */
-public class TpchQ20Test extends AbstractBasicIntegrationTest {
-    /**
-     * Test the Q20 TPC-H query can be planned and executed.
-     */
-    @Test
-    public void testQ20() throws Exception {
+@RunWith(Parameterized.class)
+public class TpchTest extends AbstractBasicIntegrationTest {
+    /** Query ID. */
+    @Parameterized.Parameter
+    public int qryId;
+
+    /** */
+    @Parameterized.Parameters(name = "queryId={0}")
+    public static Collection<Object> params() {
+        return F.asList(16, 20);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTestsStarted() throws Exception {
+        super.beforeTestsStarted();
+
         TpchHelper.createTables(client);
 
-        TpchHelper.fillTables(client, 0.01);
+        TpchHelper.fillTables(client, 0.1);
 
         TpchHelper.collectSqlStatistics(client);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean destroyCachesAfterTest() {
+        return false;
+    }
 
-        sql(TpchHelper.getQuery(20));
+    /**
+     * Test the TPC-H query can be planned and executed.
+     */
+    @Test
+    public void test() {
+        sql(TpchHelper.getQuery(qryId));
     }
 }
diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java
index f2d96693a8a..f7b3744b789 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java
@@ -76,7 +76,7 @@ import org.apache.ignite.internal.processors.query.calcite.integration.UserDdlIn
 import org.apache.ignite.internal.processors.query.calcite.integration.UserDefinedFunctionsIntegrationTest;
 import org.apache.ignite.internal.processors.query.calcite.integration.UserDefinedFunctionsIntegrationTransactionalTest;
 import org.apache.ignite.internal.processors.query.calcite.integration.ViewsIntegrationTest;
-import org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchQ20Test;
+import org.apache.ignite.internal.processors.query.calcite.integration.tpch.TpchTest;
 import org.apache.ignite.internal.processors.query.calcite.jdbc.JdbcCrossEngineTest;
 import org.apache.ignite.internal.processors.query.calcite.jdbc.JdbcQueryTest;
 import org.apache.ignite.internal.processors.query.calcite.rules.JoinCommuteRulesTest;
@@ -156,7 +156,7 @@ import org.junit.runners.Suite;
     SqlPlanHistoryIntegrationTest.class,
     QueryBlockingTaskExecutorIntegrationTest.class,
     ScalarInIntegrationTest.class,
-    TpchQ20Test.class,
+    TpchTest.class,
 })
 public class IntegrationTestSuite {
 }