phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Biju Nair (JIRA)" <j...@apache.org>
Subject [jira] [Created] (PHOENIX-3933) Start row is skipped when iterating a result set with ScanUtil.setReversed(scan)
Date Sat, 10 Jun 2017 02:56:20 GMT
Biju Nair created PHOENIX-3933:
----------------------------------

             Summary: 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


{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