Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 16504816b -> 6e5e232e2


PHOENIX-3121 Queries with filter and reverse scan failing when limit is a 
multiple of scanner cache size


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6e5e232e
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6e5e232e
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6e5e232e

Branch: refs/heads/4.x-HBase-1.1
Commit: 6e5e232e291c20edf20ea762a0ff3e752662251c
Parents: 1650481
Author: Samarth <[email protected]>
Authored: Wed Jul 27 15:59:55 2016 -0700
Committer: Samarth <[email protected]>
Committed: Wed Jul 27 15:59:55 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/phoenix/execute/BaseQueryPlan.java    | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e5e232e/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java 
b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
index b940084..868378e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/BaseQueryPlan.java
@@ -236,6 +236,12 @@ public abstract class BaseQueryPlan implements QueryPlan {
         
         if (OrderBy.REV_ROW_KEY_ORDER_BY.equals(orderBy)) {
             ScanUtil.setReversed(scan);
+            // Hack for working around PHOENIX-3121 (reverse scans fail when 
limit is a multiple of scanner cache size).
+            //TODO: remove once PHOENIX-3121 is fixed.
+            int scannerCacheSize = context.getStatement().getFetchSize();
+            if (limit != null && limit % scannerCacheSize == 0) {
+                scan.setCaching(scannerCacheSize + 1);
+            }
         }
         
         if (statement.getHint().hasHint(Hint.SMALL)) {

Reply via email to