Repository: phoenix
Updated Branches:
  refs/heads/master e7b4398d9 -> da8def924


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/da8def92
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/da8def92
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/da8def92

Branch: refs/heads/master
Commit: da8def924b933b5cbdf8007095bf686ead6fd168
Parents: e7b4398
Author: Samarth <[email protected]>
Authored: Wed Jul 27 15:30:43 2016 -0700
Committer: Samarth <[email protected]>
Committed: Wed Jul 27 15:30:43 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/da8def92/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