phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Batyrshin (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PHOENIX-3342) ORDER BY and LIMIT+OFFSET doesnt work on second (or more) column from compound key
Date Sat, 01 Oct 2016 18:55:20 GMT

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

Alex Batyrshin updated PHOENIX-3342:
------------------------------------
    Description: 
Here is simple test case
{code}
CREATE TABLE "test" (
    col1 VARCHAR,
    col2 VARCHAR,
    "foo"."data" VARCHAR,
    CONSTRAINT PK PRIMARY KEY (col1, col2)
);

0: jdbc:phoenix:localhost> upsert into "test" (COL1, COL2, "data") values ('1', '1', 'd1');
1 row affected (0.044 seconds)
0: jdbc:phoenix:localhost> upsert into "test" (COL1, COL2, "data") values ('1', '2', 'd2');
1 row affected (0.008 seconds)
0: jdbc:phoenix:localhost> upsert into "test" (COL1, COL2, "data") values ('1', '3', 'd3');
1 row affected (0.007 seconds)

0: jdbc:phoenix:localhost> select * from "test" order by col2;
+-------+-------+-------+
| COL1  | COL2  | data  |
+-------+-------+-------+
| 1     | 1     | d1    |
| 1     | 2     | d2    |
| 1     | 3     | d3    |
+-------+-------+-------+
3 rows selected (0.026 seconds)

0: jdbc:phoenix:localhost> select * from "test" order by col2 limit 1;
+-------+-------+-------+
| COL1  | COL2  | data  |
+-------+-------+-------+
| 1     | 1     | d1    |
+-------+-------+-------+
1 row selected (0.026 seconds)

0: jdbc:phoenix:localhost> select * from "test" order by col2 offset 1;
+-------+-------+-------+
| COL1  | COL2  | data  |
+-------+-------+-------+
| 1     | 2     | d2    |
| 1     | 3     | d3    |
+-------+-------+-------+
2 rows selected (0.02 seconds)
{code}

And this query doesn't work as expected:
{code}
0: jdbc:phoenix:localhost> select * from "test" order by col2 limit 1 offset 1;
+-------+-------+-------+
| COL1  | COL2  | data  |
+-------+-------+-------+
+-------+-------+-------+
No rows selected (0.024 seconds)
{code}

  was:
Here is simple test case
{code}
CREATE TABLE "test" (
    col1 VARCHAR,
    col2 VARCHAR,
    "foo"."data" VARCHAR,
    CONSTRAINT PK PRIMARY KEY (col1, col2)
);

0: jdbc:phoenix:localhost> upsert into "test" (COL1, COL2, "data") values ('1', '1', 'd1');
1 row affected (0.044 seconds)
0: jdbc:phoenix:localhost> upsert into "test" (COL1, COL2, "data") values ('1', '2', 'd2');
1 row affected (0.008 seconds)
0: jdbc:phoenix:localhost> upsert into "test" (COL1, COL2, "data") values ('1', '3', 'd3');
1 row affected (0.007 seconds)

0: jdbc:phoenix:localhost> select * from "test" order by col2;
+-------+-------+-------+
| COL1  | COL2  | data  |
+-------+-------+-------+
| 1     | 1     | d1    |
| 1     | 2     | d2    |
| 1     | 3     | d3    |
+-------+-------+-------+
3 rows selected (0.026 seconds)

0: jdbc:phoenix:localhost> select * from "test" order by col2 offset 1;
+-------+-------+-------+
| COL1  | COL2  | data  |
+-------+-------+-------+
| 1     | 2     | d2    |
| 1     | 3     | d3    |
+-------+-------+-------+
2 rows selected (0.02 seconds)
{code}

And this query doesn't work as expected:
{code}
0: jdbc:phoenix:localhost> select * from "test" order by col2 limit 1 offset 1;
+-------+-------+-------+
| COL1  | COL2  | data  |
+-------+-------+-------+
+-------+-------+-------+
No rows selected (0.024 seconds)
{code}


> ORDER BY and LIMIT+OFFSET doesnt work on second (or more) column from compound key
> ----------------------------------------------------------------------------------
>
>                 Key: PHOENIX-3342
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3342
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.8.1
>            Reporter: Alex Batyrshin
>
> Here is simple test case
> {code}
> CREATE TABLE "test" (
>     col1 VARCHAR,
>     col2 VARCHAR,
>     "foo"."data" VARCHAR,
>     CONSTRAINT PK PRIMARY KEY (col1, col2)
> );
> 0: jdbc:phoenix:localhost> upsert into "test" (COL1, COL2, "data") values ('1', '1',
'd1');
> 1 row affected (0.044 seconds)
> 0: jdbc:phoenix:localhost> upsert into "test" (COL1, COL2, "data") values ('1', '2',
'd2');
> 1 row affected (0.008 seconds)
> 0: jdbc:phoenix:localhost> upsert into "test" (COL1, COL2, "data") values ('1', '3',
'd3');
> 1 row affected (0.007 seconds)
> 0: jdbc:phoenix:localhost> select * from "test" order by col2;
> +-------+-------+-------+
> | COL1  | COL2  | data  |
> +-------+-------+-------+
> | 1     | 1     | d1    |
> | 1     | 2     | d2    |
> | 1     | 3     | d3    |
> +-------+-------+-------+
> 3 rows selected (0.026 seconds)
> 0: jdbc:phoenix:localhost> select * from "test" order by col2 limit 1;
> +-------+-------+-------+
> | COL1  | COL2  | data  |
> +-------+-------+-------+
> | 1     | 1     | d1    |
> +-------+-------+-------+
> 1 row selected (0.026 seconds)
> 0: jdbc:phoenix:localhost> select * from "test" order by col2 offset 1;
> +-------+-------+-------+
> | COL1  | COL2  | data  |
> +-------+-------+-------+
> | 1     | 2     | d2    |
> | 1     | 3     | d3    |
> +-------+-------+-------+
> 2 rows selected (0.02 seconds)
> {code}
> And this query doesn't work as expected:
> {code}
> 0: jdbc:phoenix:localhost> select * from "test" order by col2 limit 1 offset 1;
> +-------+-------+-------+
> | COL1  | COL2  | data  |
> +-------+-------+-------+
> +-------+-------+-------+
> No rows selected (0.024 seconds)
> {code}



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

Mime
View raw message