sungmin.cho created PHOENIX-3578:
------------------------------------

             Summary: Incorrect query results when applying inner join and 
orderby desc
                 Key: PHOENIX-3578
                 URL: https://issues.apache.org/jira/browse/PHOENIX-3578
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.8.0
         Environment: hbase-1.1.2
            Reporter: sungmin.cho


Step to reproduce:

h4. 1. Create two tables
{noformat}
CREATE TABLE IF NOT EXISTS master (
  id integer not null,
  col1 varchar,
  constraint pk_master primary key(id)
);

CREATE TABLE IF NOT EXISTS detail (
  id integer not null,
  seq integer not null,
  col2 varchar,
  constraint pk_master primary key(id, seq)
);
{noformat}

h4. 2. Upsert values
{noformat}
upsert into master values(1, 'A1');
upsert into master values(2, 'A2');
upsert into master values(3, 'A3');

upsert into detail values(1, 1, 'B1');
upsert into detail values(1, 2, 'B2');
upsert into detail values(2, 1, 'B1');
upsert into detail values(2, 2, 'B2');
upsert into detail values(3, 1, 'B1');
upsert into detail values(3, 2, 'B2');
upsert into detail values(3, 3, 'B3');
{noformat}

h4. 3. Execute query
{noformat}
select m.id, m.col1, d.seq, d.col2
from master m, detail d
where m.id = d.id
  and d.id between 1 and 2
order by m.id desc
{noformat}

h4. (/) Expected result
{noformat}
+-------+---------+--------+---------+
| M.ID  | M.COL1  | D.SEQ  | D.COL2  |
+-------+---------+--------+---------+
| 2     | A2      | 1      | B1      |
| 2     | A2      | 2      | B2      |
| 1     | A1      | 1      | B1      |
| 1     | A1      | 2      | B2      |
+-------+---------+--------+---------+
{noformat}

h4. (!) Incorrect result
{noformat}
+-------+---------+--------+---------+
| M.ID  | M.COL1  | D.SEQ  | D.COL2  |
+-------+---------+--------+---------+
| 1     | A1      | 1      | B1      |
| 1     | A1      | 2      | B2      |
+-------+---------+--------+---------+
{noformat}



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

Reply via email to