Lars Hofhansl created PHOENIX-4976:
--------------------------------------

             Summary: Comparisson on RVC are still incorrect
                 Key: PHOENIX-4976
                 URL: https://issues.apache.org/jira/browse/PHOENIX-4976
             Project: Phoenix
          Issue Type: Bug
            Reporter: Lars Hofhansl


See PHOENIX-3383

{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.

Edit: > and < return all rows with the same first key part (k1)



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

Reply via email to