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 2023/07/06 16:54:23 UTC

[ignite] branch master updated: IGNITE-19818 SQL Calcite: Fix failure on planning when cache size exceeds Integer.MAX_VALUE - Fixes #10804.

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 490311df216 IGNITE-19818 SQL Calcite: Fix failure on planning when cache size exceeds Integer.MAX_VALUE - Fixes #10804.
490311df216 is described below

commit 490311df216adfcb4188e944d63debb357313684
Author: Aleksey Plekhanov <pl...@gmail.com>
AuthorDate: Thu Jul 6 19:53:03 2023 +0300

    IGNITE-19818 SQL Calcite: Fix failure on planning when cache size exceeds Integer.MAX_VALUE - Fixes #10804.
    
    Signed-off-by: Aleksey Plekhanov <pl...@gmail.com>
---
 .../query/calcite/schema/IgniteStatisticsImpl.java        |  2 +-
 .../integration/ServerStatisticsIntegrationTest.java      | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/IgniteStatisticsImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/IgniteStatisticsImpl.java
index 788d6e946ac..e06820adcd8 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/IgniteStatisticsImpl.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/schema/IgniteStatisticsImpl.java
@@ -122,7 +122,7 @@ public class IgniteStatisticsImpl implements Statistic {
     private void refreshStatsIfNeededEx() {
         if (cliReqCnt.getAndIncrement() % STATS_CLI_UPDATE_THRESHOLD == 0) {
             try {
-                primaryRowCnt = desc.cacheInfo().cacheContext().cache().size(new CachePeekMode[] {CachePeekMode.PRIMARY});
+                primaryRowCnt = desc.cacheInfo().cacheContext().cache().sizeLong(new CachePeekMode[] {CachePeekMode.PRIMARY});
             }
             catch (IgniteCheckedException ignore) {
                 // No-op.
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ServerStatisticsIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ServerStatisticsIntegrationTest.java
index bc05ce087b8..f69673b5ab8 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ServerStatisticsIntegrationTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/ServerStatisticsIntegrationTest.java
@@ -37,6 +37,7 @@ import org.apache.ignite.internal.processors.query.calcite.QueryChecker;
 import org.apache.ignite.internal.processors.query.calcite.util.Commons;
 import org.apache.ignite.internal.processors.query.stat.StatisticsKey;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.testframework.GridTestUtils;
 import org.junit.Test;
 
@@ -415,6 +416,20 @@ public class ServerStatisticsIntegrationTest extends AbstractBasicIntegrationTes
         }
     }
 
+    /**
+     * Check planning with large table size.
+     */
+    @Test
+    public void testSizeIntOverflow() {
+        createAndPopulateTable();
+
+        F.first(grid(0).context().cache().cache(TABLE_NAME).context().offheap().cacheDataStores())
+            .updateSize(CU.cacheId(TABLE_NAME), 1L + Integer.MAX_VALUE);
+
+        assertQuery(grid(0), "select * from person")
+            .matches(QueryChecker.containsTableScan("PUBLIC", "PERSON")).check();
+    }
+
     /**
      * Clear query cache in specified node.
      *