Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.0 be4353b7c -> e018f6596


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

Branch: refs/heads/4.x-HBase-1.0
Commit: e018f65960cbfe344120a4fce2c09c150144f842
Parents: be4353b
Author: Samarth <[email protected]>
Authored: Wed Jul 27 15:59:29 2016 -0700
Committer: Samarth <[email protected]>
Committed: Wed Jul 27 15:59:29 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/e018f659/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 9f5cbe4..00c2ce7 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