You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexey Plotnik (Jira)" <ji...@apache.org> on 2021/05/26 10:36:00 UTC

[jira] [Commented] (IGNITE-14120) select count * returns multiple rows

    [ https://issues.apache.org/jira/browse/IGNITE-14120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17351686#comment-17351686 ] 

Alexey Plotnik commented on IGNITE-14120:
-----------------------------------------

Steps to reproduce:

1. Add cache template configuration (queryParallelism = 4):

{code}
<bean id="cache-partitioned-query-parallelism-template" abstract="true" class="org.apache.ignite.configuration.CacheConfiguration">
    <property name="name" value="cache-partitioned-query-parallelism*"/>
    <property name="cacheMode" value="PARTITIONED" />
    <property name="readFromBackup" value="false" />
    <property name="statisticsEnabled" value="true" />
    <property name="queryParallelism" value="4"/>
    <property name="sqlIndexMaxInlineSize" value="64"/>
    <property name="backups" value="0" />
    <property name="partitionLossPolicy" value="READ_WRITE_SAFE" />
    <property name="atomicityMode" value="TRANSACTIONAL" />
</bean>
{code}

2. Create TABLE:

{code}
DROP TABLE SC_NULL_TEST;
CREATE TABLE SC_NULL_TEST (
  ID INT(11),
  VAL INT(11),
  PRIMARY KEY (ID)
) WITH "template=cache-partitioned-query-parallelism, CACHE_NAME=SC_NULL_TEST";
{code}

3. Insert some sample data:

{code}
insert into SC_NULL_TEST VALUES(1, 1);
{code}

4. Do a full scan count query:

{code}
0: jdbc:ignite:thin://127.0.0.1/PUBLIC> select count(*) from SC_NULL_TEST;
+--------------------------------+
|            COUNT(*)            |
+--------------------------------+
| 1                              |
+--------------------------------+
1 row selected (0.003 seconds)
{code}

The result is correct.

5. Do a count query with where clause:

{code}
0: jdbc:ignite:thin://127.0.0.1/PUBLIC> select count(*) from SC_NULL_TEST where id = 1;
+--------------------------------+
|            COUNT(*)            |
+--------------------------------+
| 0                              |
| 1                              |
| 0                              |
| 0                              |
+--------------------------------+
4 rows selected (0.004 seconds)
{code}

Resultset size is equal to queryParallelism value


> select count * returns multiple rows
> ------------------------------------
>
>                 Key: IGNITE-14120
>                 URL: https://issues.apache.org/jira/browse/IGNITE-14120
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.8.1
>            Reporter: Isaac Zhu
>            Priority: Major
>
> I have a partitioned table which has 1 backup, the *queryParallelism* is set to 4.
> The table primary key is column "ID", 
> If I do this query:
>         select count( * ) from my_table where ID = 1000;
> It will return 4 rows:
>         1
>          0
>          0
>          0
>  
> If I query by other not primary-key columns of this table, the result is good, like:
>         select count( *) from my_table where name = 'abcd'
> result is:
>         0



--
This message was sent by Atlassian Jira
(v8.3.4#803005)