[
https://issues.apache.org/jira/browse/IGNITE-22993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nikolay Izhikov updated IGNITE-22993:
-------------------------------------
Labels: calcite ise (was: )
> Count from REPLICATED caches with partition filter
> --------------------------------------------------
>
> Key: IGNITE-22993
> URL: https://issues.apache.org/jira/browse/IGNITE-22993
> Project: Ignite
> Issue Type: Bug
> Reporter: Nikolay Izhikov
> Priority: Major
> Labels: calcite, ise
>
> Case when SQL query `SELECT COUNT(*) FROM T` with partitions invoked for
> REPLICATED cache data don't work properly.
> {code:java}
> /** */
> 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();
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)