You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Yi Tian (JIRA)" <ji...@apache.org> on 2015/09/21 16:39:04 UTC

[jira] [Updated] (PHOENIX-2279) Error result when there are both `group by` and `limit `operation after `union`

     [ https://issues.apache.org/jira/browse/PHOENIX-2279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yi Tian updated PHOENIX-2279:
-----------------------------
    Description: 
Here is how to reproduce this issue:
{quote}
0: jdbc:phoenix:localhost> create table test2 (a varchar(10) CONSTRAINT PK PRIMARY KEY (a)) VERSIONS=1;
No rows affected (0.259 seconds)
0: jdbc:phoenix:localhost> create table test1 (a varchar(10) CONSTRAINT PK PRIMARY KEY (a)) VERSIONS=1;
No rows affected (0.258 seconds)
0: jdbc:phoenix:localhost> upsert into test2 values('a1');
1 row affected (0.014 seconds)
0: jdbc:phoenix:localhost> upsert into test2 values('a2');
1 row affected (0.004 seconds)
0: jdbc:phoenix:localhost> upsert into test1 values('a1');
1 row affected (0.013 seconds)
0: jdbc:phoenix:localhost> upsert into test1 values('a2');
1 row affected (0.005 seconds)
0: jdbc:phoenix:localhost> select a,count(1) from (select a from test1 union all select a from test2) group by a limit 2;
+-------+----------+
| A     | COUNT(1) |
+-------+----------+
| a1    | 2        |
+-------+----------+
1 row selected (0.017 seconds)
{quote}

The result should be:
+-------+----------+
| A     | COUNT(1) |
+-------+----------+
| a1    | 2        |
| a2    | 2        |
+-------+----------+

  was:
Here is how to reproduce this issue:
{quote}
0: jdbc:phoenix:localhost> create table test2 (a varchar(10) CONSTRAINT PK PRIMARY KEY (a)) VERSIONS=1;
No rows affected (0.259 seconds)
0: jdbc:phoenix:localhost> create table test1 (a varchar(10) CONSTRAINT PK PRIMARY KEY (a)) VERSIONS=1;
No rows affected (0.258 seconds)
0: jdbc:phoenix:localhost> upsert into test2 values('a1');
1 row affected (0.014 seconds)
0: jdbc:phoenix:localhost> upsert into test2 values('a2');
1 row affected (0.004 seconds)
0: jdbc:phoenix:localhost> upsert into test1 values('a1');
1 row affected (0.013 seconds)
0: jdbc:phoenix:localhost> upsert into test1 values('a2');
1 row affected (0.005 seconds)
0: jdbc:phoenix:localhost> select a,count(1) from (select a from test1 union all select a from test2) group by a limit 2;
+------------+------------------------------------------+
|     A      |                 COUNT(1)                 |
+------------+------------------------------------------+
| a1         | 2                                        |
+------------+------------------------------------------+
1 row selected (0.017 seconds)
{quote}

The result should be:
+------------+------------------------------------------+
|     A      |                 COUNT(1)                 |
+------------+------------------------------------------+
| a1         | 2                                        |
| a2         | 2                                        |
+------------+------------------------------------------+


> Error result when there are both `group by` and `limit `operation after `union`
> -------------------------------------------------------------------------------
>
>                 Key: PHOENIX-2279
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2279
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.5.1
>            Reporter: Yi Tian
>
> Here is how to reproduce this issue:
> {quote}
> 0: jdbc:phoenix:localhost> create table test2 (a varchar(10) CONSTRAINT PK PRIMARY KEY (a)) VERSIONS=1;
> No rows affected (0.259 seconds)
> 0: jdbc:phoenix:localhost> create table test1 (a varchar(10) CONSTRAINT PK PRIMARY KEY (a)) VERSIONS=1;
> No rows affected (0.258 seconds)
> 0: jdbc:phoenix:localhost> upsert into test2 values('a1');
> 1 row affected (0.014 seconds)
> 0: jdbc:phoenix:localhost> upsert into test2 values('a2');
> 1 row affected (0.004 seconds)
> 0: jdbc:phoenix:localhost> upsert into test1 values('a1');
> 1 row affected (0.013 seconds)
> 0: jdbc:phoenix:localhost> upsert into test1 values('a2');
> 1 row affected (0.005 seconds)
> 0: jdbc:phoenix:localhost> select a,count(1) from (select a from test1 union all select a from test2) group by a limit 2;
> +-------+----------+
> | A     | COUNT(1) |
> +-------+----------+
> | a1    | 2        |
> +-------+----------+
> 1 row selected (0.017 seconds)
> {quote}
> The result should be:
> +-------+----------+
> | A     | COUNT(1) |
> +-------+----------+
> | a1    | 2        |
> | a2    | 2        |
> +-------+----------+



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)