Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 3138ad44b -> 2c0fc8a81
PHOENIX-3926 Do not use EncodedColumnQualifierCellsList optimization when doing raw scans Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2c0fc8a8 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2c0fc8a8 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2c0fc8a8 Branch: refs/heads/4.x-HBase-1.1 Commit: 2c0fc8a81db7ade28092ee3002e081ddf3898314 Parents: 3138ad4 Author: Samarth Jain <[email protected]> Authored: Thu Jun 8 14:38:54 2017 -0700 Committer: Samarth Jain <[email protected]> Committed: Thu Jun 8 14:38:54 2017 -0700 ---------------------------------------------------------------------- .../java/org/apache/phoenix/iterate/BaseResultIterators.java | 4 ++-- .../java/org/apache/phoenix/util/EncodedColumnsUtil.java | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c0fc8a8/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java index e72e380..8d6c107 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java @@ -269,7 +269,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result private static void setQualifierRanges(boolean keyOnlyFilter, PTable table, Scan scan, StatementContext context) throws SQLException { - if (EncodedColumnsUtil.useEncodedQualifierListOptimization(table)) { + if (EncodedColumnsUtil.useEncodedQualifierListOptimization(table, scan)) { Pair<Integer, Integer> minMaxQualifiers = new Pair<>(); for (Pair<byte[], byte[]> whereCol : context.getWhereConditionColumns()) { byte[] cq = whereCol.getSecond(); @@ -375,7 +375,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result if (statement.getHint().hasHint(Hint.SEEK_TO_COLUMN)) { // Allow seeking to column during filtering preventSeekToColumn = false; - } else if (!EncodedColumnsUtil.useEncodedQualifierListOptimization(table)) { + } else if (!EncodedColumnsUtil.useEncodedQualifierListOptimization(table, scan)) { /* * preventSeekToColumn cannot be true, even if hinted, when encoded qualifier list * optimization is being used. When using the optimization, it is necessary that we http://git-wip-us.apache.org/repos/asf/phoenix/blob/2c0fc8a8/phoenix-core/src/main/java/org/apache/phoenix/util/EncodedColumnsUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/EncodedColumnsUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/EncodedColumnsUtil.java index 591fc0c..0cf996a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/EncodedColumnsUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/EncodedColumnsUtil.java @@ -125,8 +125,12 @@ public class EncodedColumnsUtil { return new Pair<>(minQ, maxQ); } - public static boolean useEncodedQualifierListOptimization(PTable table) { - return table.getImmutableStorageScheme() != null + public static boolean useEncodedQualifierListOptimization(PTable table, Scan scan) { + /* + * HBase doesn't allow raw scans to have columns set. And we need columns to be set + * explicitly on the scan to use this optimization. + */ + return !scan.isRaw() && table.getImmutableStorageScheme() != null && table.getImmutableStorageScheme() == ImmutableStorageScheme.ONE_CELL_PER_COLUMN && usesEncodedColumnNames(table) && !table.isTransactional() && !ScanUtil.hasDynamicColumns(table);
