Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-22993

Count from REPLICATED caches with partition filter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • Docs Required, Release Notes Required

    Description

      Case when SQL query `SELECT COUNT FROM T` with partitions invoked for REPLICATED cache data don't work properly.

      /** */
      public class QueryWithPartitionsIntegration2Test extends GridCommonAbstractTest {
          /** {@inheritDoc} */
          @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
              IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
      
              cfg.getSqlConfiguration().setQueryEnginesConfiguration(new CalciteQueryEngineConfiguration());
      
              return cfg;
          }
      
          /** */
          @Test
          public void testSelectCount() throws Exception {
              startGrid(0).createCache(DEFAULT_CACHE_NAME);
      
              sql("CREATE TABLE T(ID INT PRIMARY KEY, IDX_VAL VARCHAR, VAL VARCHAR) WITH template=replicated");
      
              StringBuilder sb = new StringBuilder("INSERT INTO T(ID, IDX_VAL, VAL) VALUES ");
      
              int cnt = 10_000;
              for (int i = 0; i < cnt; ++i) {
                  if (i != 0)
                      sb.append(",");
      
                  sb.append("(").append(i).append(", ")
                      .append("'name_").append(i).append("', ")
                      .append("'name_").append(i).append("')");
              }
      
              sql(sb.toString());
      
              assertEquals((long)cnt, sql("SELECT COUNT(*) FROM T").get(0).get(0));
              assertNotEquals((long)cnt, sql("SELECT COUNT(*) FROM T", 42).get(0).get(0));
          }
      
          /** */
          public List<List<?>> sql(String sqlText, int... parts) {
              SqlFieldsQuery qry = new SqlFieldsQuery(sqlText).setTimeout(5, TimeUnit.SECONDS);
      
              if (!F.isEmpty(parts))
                  qry.setPartitions(parts);
      
              return grid(0).cache(F.first(grid(0).cacheNames())).query(qry).getAll();
          }
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nizhikov Nikolay Izhikov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: