Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 03d162f3e -> 8b051c929
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/8b051c92 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8b051c92 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8b051c92 Branch: refs/heads/4.x-HBase-0.98 Commit: 8b051c929c6d2d22d4c30228196d632d4f8e7552 Parents: 03d162f Author: Samarth Jain <sama...@apache.org> Authored: Thu Jun 8 14:39:18 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Jun 8 14:39:18 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/8b051c92/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 f9a5d3c..267aae1 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 @@ -271,7 +271,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(); @@ -377,7 +377,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/8b051c92/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);