Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 3db62b9f5 -> 6183bd87a
Revert "PHOENIX-3161 Check possibility of moving rebuilding code to coprocessor of data table." This reverts commit 3db62b9f5dd9f13c12baa5758f9aef0b541780c7. Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6183bd87 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6183bd87 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6183bd87 Branch: refs/heads/4.x-HBase-1.1 Commit: 6183bd87aee5c3db4a15d5a37fa5ef716a5394b7 Parents: 3db62b9 Author: Ankit Singhal <ankitsingha...@gmail.com> Authored: Fri Oct 21 19:38:54 2016 +0530 Committer: Ankit Singhal <ankitsingha...@gmail.com> Committed: Fri Oct 21 19:38:54 2016 +0530 ---------------------------------------------------------------------- .../java/org/apache/phoenix/end2end/QueryWithOffsetIT.java | 8 -------- .../phoenix/coprocessor/BaseScannerRegionObserver.java | 1 - .../src/main/java/org/apache/phoenix/execute/ScanPlan.java | 6 ++---- .../org/apache/phoenix/iterate/BaseResultIterators.java | 3 +-- .../apache/phoenix/iterate/MergeSortTopNResultIterator.java | 3 --- .../phoenix/compile/StatementHintsCompilationTest.java | 2 +- .../test/java/org/apache/phoenix/query/QueryPlanTest.java | 9 +++------ 7 files changed, 7 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6183bd87/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java index cab75b7..04d1126 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryWithOffsetIT.java @@ -19,7 +19,6 @@ package org.apache.phoenix.end2end; import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.sql.Connection; @@ -104,13 +103,6 @@ public class QueryWithOffsetIT extends ParallelStatsDisabledIT { assertTrue(rs.next()); assertEquals(STRINGS[i - 1], rs.getString(1)); } - limit =1; - offset=1; - rs = conn.createStatement() - .executeQuery("SELECT k2 from " + tableName + " order by k2 desc limit " + limit + " offset " + offset); - assertTrue(rs.next()); - assertEquals(25, rs.getInt(1)); - assertFalse(rs.next()); conn.close(); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/6183bd87/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java index f6bd512..4fa1399 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/BaseScannerRegionObserver.java @@ -88,7 +88,6 @@ abstract public class BaseScannerRegionObserver extends BaseRegionObserver { public static final String EXPECTED_UPPER_REGION_KEY = "_ExpectedUpperRegionKey"; public static final String REVERSE_SCAN = "_ReverseScan"; public static final String ANALYZE_TABLE = "_ANALYZETABLE"; - public static final String REBUILD_INDEXES = "_RebuildIndexes"; public static final String TX_STATE = "_TxState"; public static final String GUIDEPOST_WIDTH_BYTES = "_GUIDEPOST_WIDTH_BYTES"; public static final String GUIDEPOST_PER_REGION = "_GUIDEPOST_PER_REGION"; http://git-wip-us.apache.org/repos/asf/phoenix/blob/6183bd87/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java index ebe4441..7f735b7 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/execute/ScanPlan.java @@ -96,9 +96,7 @@ public class ScanPlan extends BaseQueryPlan { if (isOrdered) { // TopN int thresholdBytes = context.getConnection().getQueryServices().getProps().getInt( QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES); - ScanRegionObserver.serializeIntoScan(context.getScan(), thresholdBytes, - limit == null ? -1 : QueryUtil.getOffsetLimit(limit, offset), orderBy.getOrderByExpressions(), - projector.getEstimatedRowByteSize()); + ScanRegionObserver.serializeIntoScan(context.getScan(), thresholdBytes, limit == null ? -1 : limit, orderBy.getOrderByExpressions(), projector.getEstimatedRowByteSize()); } Integer perScanLimit = !allowPageFilter || isOrdered ? null : limit; perScanLimit = QueryUtil.getOffsetLimit(perScanLimit, offset); @@ -201,7 +199,7 @@ public class ScanPlan extends BaseQueryPlan { * limit is provided, run query serially. */ boolean isOrdered = !orderBy.getOrderByExpressions().isEmpty(); - Integer perScanLimit = !allowPageFilter || isOrdered ? null : QueryUtil.getOffsetLimit(limit, offset); + Integer perScanLimit = QueryUtil.getOffsetLimit(!allowPageFilter || isOrdered ? null : limit, offset); boolean isOffsetOnServer = isOffsetPossibleOnServer(context, orderBy, offset, isSalted, table.getIndexType()); /* * For queries that are doing a row key order by and are not possibly querying more than a http://git-wip-us.apache.org/repos/asf/phoenix/blob/6183bd87/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 25f3bec..d4c8bef 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 @@ -93,7 +93,6 @@ import org.apache.phoenix.util.Closeables; import org.apache.phoenix.util.LogUtil; import org.apache.phoenix.util.PrefixByteCodec; import org.apache.phoenix.util.PrefixByteDecoder; -import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.SQLCloseables; import org.apache.phoenix.util.ScanUtil; import org.apache.phoenix.util.SchemaUtil; @@ -348,7 +347,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result public BaseResultIterators(QueryPlan plan, Integer perScanLimit, Integer offset, ParallelScanGrouper scanGrouper, Scan scan) throws SQLException { super(plan.getContext(), plan.getTableRef(), plan.getGroupBy(), plan.getOrderBy(), - plan.getStatement().getHint(), QueryUtil.getOffsetLimit(plan.getLimit(), plan.getOffset()), offset); + plan.getStatement().getHint(), plan.getLimit(), offset); this.plan = plan; this.scan = scan; this.scanGrouper = scanGrouper; http://git-wip-us.apache.org/repos/asf/phoenix/blob/6183bd87/phoenix-core/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java b/phoenix-core/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java index 42429b1..a9d8046 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/MergeSortTopNResultIterator.java @@ -103,9 +103,6 @@ public class MergeSortTopNResultIterator extends MergeSortResultIterator { if (offset > 0) { planSteps.add("CLIENT OFFSET " + offset); } - if (limit > 0) { - planSteps.add("CLIENT LIMIT " + limit); - } } @Override http://git-wip-us.apache.org/repos/asf/phoenix/blob/6183bd87/phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java b/phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java index 8e3bb59..394bf27 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/StatementHintsCompilationTest.java @@ -101,7 +101,7 @@ public class StatementHintsCompilationTest extends BaseConnectionlessQueryTest { assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER EH ['111111111111111','foo ','2012-11-01 00:00:00.000'] - ['111111111111111','fop ','2012-11-30 00:00:00.000']\n" + " SERVER FILTER BY FIRST KEY ONLY AND (CREATED_DATE >= DATE '2012-11-01 00:00:00.000' AND CREATED_DATE < DATE '2012-11-30 00:00:00.000')\n" + " SERVER TOP 100 ROWS SORTED BY [ORGANIZATION_ID, PARENT_ID, CREATED_DATE DESC, ENTITY_HISTORY_ID]\n" + - "CLIENT MERGE SORT\nCLIENT LIMIT 100",QueryUtil.getExplainPlan(rs)); + "CLIENT MERGE SORT",QueryUtil.getExplainPlan(rs)); } @Test http://git-wip-us.apache.org/repos/asf/phoenix/blob/6183bd87/phoenix-core/src/test/java/org/apache/phoenix/query/QueryPlanTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryPlanTest.java b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryPlanTest.java index 787ca33..7aef5a3 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/query/QueryPlanTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/query/QueryPlanTest.java @@ -112,8 +112,7 @@ public class QueryPlanTest extends BaseConnectionlessQueryTest { "SELECT a_string FROM atable ORDER BY a_string DESC LIMIT 3", "CLIENT PARALLEL 1-WAY FULL SCAN OVER ATABLE\n" + " SERVER TOP 3 ROWS SORTED BY [A_STRING DESC]\n" + - "CLIENT MERGE SORT\n" + - "CLIENT LIMIT 3" , + "CLIENT MERGE SORT", "SELECT count(1) FROM atable GROUP BY a_string,b_string HAVING max(a_string) = 'a'", "CLIENT PARALLEL 1-WAY FULL SCAN OVER ATABLE\n" + @@ -145,8 +144,7 @@ public class QueryPlanTest extends BaseConnectionlessQueryTest { "SELECT a_string,b_string FROM atable WHERE organization_id = '000000000000001' ORDER BY a_string ASC NULLS FIRST LIMIT 10", "CLIENT PARALLEL 1-WAY RANGE SCAN OVER ATABLE ['000000000000001']\n" + " SERVER TOP 10 ROWS SORTED BY [A_STRING]\n" + - "CLIENT MERGE SORT\n" + - "CLIENT LIMIT 10", + "CLIENT MERGE SORT", "SELECT max(a_integer) FROM atable WHERE organization_id = '000000000000001' GROUP BY organization_id,entity_id,ROUND(a_date,'HOUR') ORDER BY entity_id NULLS LAST LIMIT 10", "CLIENT PARALLEL 1-WAY RANGE SCAN OVER ATABLE ['000000000000001']\n" + @@ -157,8 +155,7 @@ public class QueryPlanTest extends BaseConnectionlessQueryTest { "SELECT a_string,b_string FROM atable WHERE organization_id = '000000000000001' ORDER BY a_string DESC NULLS LAST LIMIT 10", "CLIENT PARALLEL 1-WAY RANGE SCAN OVER ATABLE ['000000000000001']\n" + " SERVER TOP 10 ROWS SORTED BY [A_STRING DESC NULLS LAST]\n" + - "CLIENT MERGE SORT\n" + - "CLIENT LIMIT 10", + "CLIENT MERGE SORT", "SELECT a_string,b_string FROM atable WHERE organization_id IN ('000000000000001', '000000000000005')", "CLIENT PARALLEL 1-WAY SKIP SCAN ON 2 KEYS OVER ATABLE ['000000000000001'] - ['000000000000005']",