Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 829db70ae -> 6de5b613a
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/6de5b613 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6de5b613 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6de5b613 Branch: refs/heads/4.x-HBase-0.98 Commit: 6de5b613abee53e84ada5fb6404897734043e71a Parents: 829db70 Author: Samarth <[email protected]> Authored: Wed Jul 27 15:30:24 2016 -0700 Committer: Samarth <[email protected]> Committed: Wed Jul 27 15:30:24 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/6de5b613/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 757e304..f6c7be4 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)) {
