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 54f3339b062 IGNITE-25209 SQL Calcite: Fix cursors cleanup in test 
framework - Fixes #12121.
54f3339b062 is described below

commit 54f3339b06299389c9fd69555b416c02413fab6e
Author: Vladimir Steshin <[email protected]>
AuthorDate: Tue Oct 28 17:57:26 2025 +0300

    IGNITE-25209 SQL Calcite: Fix cursors cleanup in test framework - Fixes 
#12121.
    
    Signed-off-by: Aleksey Plekhanov <[email protected]>
---
 .../integration/AbstractBasicIntegrationTest.java        | 16 +++++++++++++---
 .../query/calcite/integration/tpch/AbstractTpchTest.java |  2 +-
 .../processors/query/calcite/integration/tpch/ddl.sql    | 12 ++++++++++++
 .../processors/query/calcite/integration/tpch/q15.sql    | 12 ------------
 4 files changed, 26 insertions(+), 16 deletions(-)

diff --git 
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
 
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
index bdf1904609d..31eed86a2ef 100644
--- 
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
+++ 
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/AbstractBasicIntegrationTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.query.calcite.integration;
 
+import java.util.Collections;
 import java.util.List;
 import org.apache.calcite.plan.RelOptCluster;
 import org.apache.calcite.plan.RelOptTable;
@@ -240,11 +241,20 @@ public class AbstractBasicIntegrationTest extends 
GridCommonAbstractTest {
 
     /** */
     protected List<List<?>> sql(IgniteEx ignite, String sql, Object... params) 
{
-        List<FieldsQueryCursor<List<?>>> cur = 
queryProcessor(ignite).query(queryContext(), "PUBLIC", sql, params);
+        // {@code sql} can contain more than one query.
+        List<FieldsQueryCursor<List<?>>> allCurs = 
queryProcessor(ignite).query(queryContext(), "PUBLIC", sql, params);
 
-        try (QueryCursor<List<?>> srvCursor = cur.get(0)) {
-            return srvCursor.getAll();
+        if (allCurs.size() > 1) {
+            log.warning("The query statement '" + sql + "' contains " + 
allCurs.size() + " actual queries. " +
+                "All the cursors are fetched, but only the last result is 
returned.");
         }
+
+        List<List<?>> res = Collections.emptyList();
+
+        for (FieldsQueryCursor<List<?>> cur : allCurs)
+            res = cur.getAll();
+
+        return res;
     }
 
     /** */
diff --git 
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/AbstractTpchTest.java
 
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/AbstractTpchTest.java
index 19e91d4a85b..8f0e410bb9f 100644
--- 
a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/AbstractTpchTest.java
+++ 
b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/tpch/AbstractTpchTest.java
@@ -28,7 +28,7 @@ import org.junit.runners.Parameterized;
 @RunWith(Parameterized.class)
 public abstract class AbstractTpchTest extends AbstractBasicIntegrationTest {
     /** */
-    protected static final Collection<Integer> USED_TESTS = F.asList(16, 17, 
19, 20);
+    protected static final Collection<Integer> USED_TESTS = F.asList(15, 16, 
17, 19, 20);
 
     /** Query ID. */
     @Parameterized.Parameter
diff --git 
a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/ddl.sql
 
b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/ddl.sql
index d09a2fc70b7..a2aab9a3235 100644
--- 
a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/ddl.sql
+++ 
b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/ddl.sql
@@ -103,3 +103,15 @@ CREATE INDEX l_rd ON lineitem (L_RECEIPTDATE ASC);
 CREATE INDEX l_ok ON lineitem (L_ORDERKEY ASC);
 CREATE INDEX l_pk_sk ON lineitem (L_PARTKEY ASC, L_SUPPKEY ASC);
 CREATE INDEX l_sk_pk ON lineitem (L_SUPPKEY ASC, L_PARTKEY ASC);
+
+CREATE OR REPLACE VIEW revenue0 AS
+SELECT
+    l_suppkey AS supplier_no,
+    SUM(l_extendedprice * (1 - l_discount)) AS total_revenue
+FROM
+    lineitem
+WHERE
+    l_shipdate >= DATE '1996-01-01'
+    AND l_shipdate < TIMESTAMPADD(MONTH, 3, DATE '1996-01-01')
+GROUP BY
+    l_suppkey;
diff --git 
a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql
 
b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql
index 131af70560e..ed220de273d 100644
--- 
a/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql
+++ 
b/modules/calcite/src/test/resources/org/apache/ignite/internal/processors/query/calcite/integration/tpch/q15.sql
@@ -4,18 +4,6 @@
 -- Functional Query Definition
 -- Approved February 1998
 
-create OR REPLACE view revenue0 as
-    select
-        l_suppkey as supplier_no,
-        sum(l_extendedprice * (1 - l_discount)) as total_revenue
-    from
-        lineitem
-    where
-        l_shipdate >= date '1996-01-01'
-        and l_shipdate < TIMESTAMPADD(MONTH, 3, date '1996-01-01')
-    group by
-        l_suppkey;
-
 
 select
     s_suppkey,

Reply via email to