[
https://issues.apache.org/jira/browse/PHOENIX-3578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15876648#comment-15876648
]
Maryann Xue commented on PHOENIX-3578:
--------------------------------------
+1 to the analysis. Thank you very much, [~comnetwork]! But one important
question: is it true that we cannot use range scan or skip scan if the scan is
in reverse order? If yes, I think there should be no need for a dynamic join
filter at all in this case. Thus, you don't need any change in WhereCompiler or
HashJoinPlan, but instead you can go disable the dynamic filter during join
compilation (in QueryCompiler.java) if LHS is a reverse scan.
A few other minor suggestions:
1) Could you add space after commas and both before and after operators like
"==", "+", etc?
2) In code comment, could you please give a brief description of the problem
instead of referring to "PHOENIX-3578", or simply say "We cannot use skip scan
or range scan if the ordering is OrderBy.REV_ROW_KEY_ORDER_BY."?
3) Maybe rename "assertQueryPlan" to "checkQueryPlan"? And it might be better
to put each of "doTestJoinDynamicFilterBug3578()" calls into an independent
test case.
> 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, 4.9.0
> Environment: hbase-1.1.2
> Reporter: sungmin.cho
> Attachments: PHOENIX-3578_v1.patch
>
>
> 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.15#6346)