You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Lars Hofhansl (JIRA)" <ji...@apache.org> on 2018/10/16 06:13:00 UTC

[jira] [Comment Edited] (PHOENIX-3383) Comparison between descending row keys used in RVC is reverse

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

Lars Hofhansl edited comment on PHOENIX-3383 at 10/16/18 6:12 AM:
------------------------------------------------------------------

Unfortunate there is still bug here:
{code}
create table test(k1 integer not null, k2 integer not null, k3 integer not null, v integer, constraint pk primary key (k1, k2 desc, k3));

upsert into test values(1,1,1,2);
upsert into test values(1,2,1,2);
upsert into test values(1,3,1,2);
upsert into test values(1,4,1,2);
{code}

{code}
select * from test where (k1, k2, k3) = (1,2,1) order by k1, k2 desc, k3;
+-----+-----+-----+----+
| K1  | K2  | K3  | V  |
+-----+-----+-----+----+
| 1   | 2   | 1   | 2  |
+-----+-----+-----+----+
{code}

{code}
select * from test where (k1, k2, k3) > (1,2,1) order by k1, k2 desc, k3;
+-----+-----+-----+----+
| K1  | K2  | K3  | V  |
+-----+-----+-----+----+
| 1   | 4   | 1   | 2  |
| 1   | 3   | 1   | 2  |
| 1   | 2   | 1   | 2  |
| 1   | 1   | 1   | 2  |
+-----+-----+-----+----+
{code}

{code}
select * from test where (k1, k2, k3) < (1,2,1) order by k1, k2 desc, k3;
+-----+-----+-----+----+
| K1  | K2  | K3  | V  |
+-----+-----+-----+----+
| 1   | 4   | 1   | 2  |
| 1   | 3   | 1   | 2  |
| 1   | 2   | 1   | 2  |
| 1   | 1   | 1   | 2  |
+-----+-----+-----+----+
{code}

Looks like in this case each > or < comparison will simply return all rows. This does not happen when the second key part is not descending.


was (Author: lhofhansl):
Unfortunate there is still bug here:
{code}
create table test(k1 integer not null, k2 integer not null, k3 integer not null, v integer, constraint pk primary key (k1, k2 desc, k3));

upsert into test values(1,1,1,2);
upsert into test values(1,2,1,2);
upsert into test values(1,3,1,2);
upsert into test values(1,4,1,2);
{code}

{code}
select * from test where (k1, k2, k3) > (1,2,1) order by k1, k2 desc, k3;
+-----+-----+-----+----+
| K1  | K2  | K3  | V  |
+-----+-----+-----+----+
| 1   | 4   | 1   | 2  |
| 1   | 3   | 1   | 2  |
| 1   | 2   | 1   | 2  |
| 1   | 1   | 1   | 2  |
+-----+-----+-----+----+

select * from test where (k1, k2, k3) < (1,2,1) order by k1, k2 desc, k3;
+-----+-----+-----+----+
| K1  | K2  | K3  | V  |
+-----+-----+-----+----+
| 1   | 4   | 1   | 2  |
| 1   | 3   | 1   | 2  |
| 1   | 2   | 1   | 2  |
| 1   | 1   | 1   | 2  |
+-----+-----+-----+----+
{code}

Looks like in this case each > or < comparison will simply return all rows. This does not happen when the second key part is not descending.

> Comparison between descending row keys used in RVC is reverse
> -------------------------------------------------------------
>
>                 Key: PHOENIX-3383
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3383
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: James Taylor
>            Priority: Major
>              Labels: DESC
>             Fix For: 4.15.0, 5.1.0
>
>         Attachments: PHOENIX-3383-wip1.patch, PHOENIX-3383-wip5.patch, PHOENIX-3383-wip6.patch, PHOENIX-3383-wip7.patch, PHOENIX-3383_v1.patch, PHOENIX-3383_v10.patch, PHOENIX-3383_v11.patch, PHOENIX-3383_v12.patch, PHOENIX-3383_v13.patch, PHOENIX-3383_v2.patch, PHOENIX-3383_v3.patch, PHOENIX-3383_v4.patch, PHOENIX-3383_v5.patch, PHOENIX-3383_v6.patch, PHOENIX-3383_v7.patch, PHOENIX-3383_v8.patch, PHOENIX-3383_v9.patch, PHOENIX-3383_wip.patch, PHOENIX-3383_wip2.patch, PHOENIX-3383_wip3.patch
>
>
> See PHOENIX-3382, but the comparison for RVC with descending row key columns is the reverse of what it should be.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)