You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Biju Nair (JIRA)" <ji...@apache.org> on 2017/06/17 00:48:00 UTC
[jira] [Commented] (PHOENIX-3933) Start row is skipped when
iterating a result set with ScanUtil.setReversed(scan)
[ https://issues.apache.org/jira/browse/PHOENIX-3933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16052594#comment-16052594 ]
Biju Nair commented on PHOENIX-3933:
------------------------------------
Thanks [~giacomotaylor]. I was trying to make changes to the Phoenix code with the assumption that {{scan}} iteration will mimic the behavior in {{HBase}} and in hindsight the assumption is not correct.
> Start row is skipped when iterating a result set with ScanUtil.setReversed(scan)
> --------------------------------------------------------------------------------
>
> Key: PHOENIX-3933
> URL: https://issues.apache.org/jira/browse/PHOENIX-3933
> Project: Phoenix
> Issue Type: Bug
> Reporter: Biju Nair
> Priority: Minor
>
> {code}
> ResultSet rs = statement.executeQuery("SELECT * FROM " + tableName );
> QueryPlan plan = statement.unwrap(PhoenixStatement.class).getQueryPlan();
> Scan scan = plan.getContext().getScan();
> while(rs.next()) {
> LOG.debug("******** "+rs.getInt(1));
> }
> {code}
> This section of the code returns
> {code}
> [main] org.apache.phoenix.end2end.ReverseScanTest(126): ******** 0
> [main] org.apache.phoenix.end2end.ReverseScanTest(126): ******** 1
> [main] org.apache.phoenix.end2end.ReverseScanTest(126): ******** 2
> [main] org.apache.phoenix.end2end.ReverseScanTest(126): ******** 3
> [main] org.apache.phoenix.end2end.ReverseScanTest(126): ******** 4
> [main] org.apache.phoenix.end2end.ReverseScanTest(126): ******** 5
> [main] org.apache.phoenix.end2end.ReverseScanTest(126): ******** 6
> [main] org.apache.phoenix.end2end.ReverseScanTest(126): ******** 7
> [main] org.apache.phoenix.end2end.ReverseScanTest(126): ******** 8
> {code}
> If the {{scan}} is set to reverse the start and stop key is set to 4 & 8 the resulting result set doesn't seem to include 8 in the result which is different from the HBase scan when reversed.
> {code}
> ScanUtil.setReversed(scan);
> scan.setStartRow(PInteger.INSTANCE.toBytes(4));
> scan.setStopRow(PInteger.INSTANCE.toBytes(8));
> rs = new PhoenixResultSet(plan.iterator(), plan.getProjector(), plan.getContext());
> while(rs.next()){
> LOG.debug("**rev*** "+rs.getInt(1));
> }
> {code}
> the result is
> {code}
> org.apache.phoenix.end2end.ReverseScanTest(136): **rev*** 7
> org.apache.phoenix.end2end.ReverseScanTest(136): **rev*** 6
> org.apache.phoenix.end2end.ReverseScanTest(136): **rev*** 5
> org.apache.phoenix.end2end.ReverseScanTest(136): **rev*** 4
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)