phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Taylor (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (PHOENIX-3933) Start row is skipped when iterating a result set with ScanUtil.setReversed(scan)
Date Sat, 10 Jun 2017 03:33:18 GMT

     [ https://issues.apache.org/jira/browse/PHOENIX-3933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

James Taylor resolved PHOENIX-3933.
-----------------------------------
    Resolution: Invalid

It's not valid to just call ScanUtil.setReverseScan(scan) and then create a ResulSet manually.
Please make sure your unit tests are purely JDBC as that's the supported API. A reverse scan
will only be used if you're ordering by the descending row key (as it is slower than a forward
scan). If this skips a row, that would be a serious bug.

> 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.3.15#6346)

Mime
View raw message