[2/2] phoenix git commit: PHOENIX-1556 Base hash versus sort merge join decision on cost
PHOENIX-1556 Base hash versus sort merge join decision on cost Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/71537ed6 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/71537ed6 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/71537ed6 Branch: refs/heads/5.x-HBase-2.0 Commit: 71537ed63d1bffbbc60c43e7c6592c9bce279786 Parents: f0b31ce Author: maryannxue Authored: Mon Feb 12 14:07:30 2018 -0800 Committer: maryannxue Committed: Mon Feb 19 22:48:36 2018 -0800 -- .../phoenix/end2end/CostBasedDecisionIT.java| 420 - .../apache/phoenix/compile/JoinCompiler.java| 43 ++ .../phoenix/compile/ListJarsQueryPlan.java | 8 +- .../apache/phoenix/compile/QueryCompiler.java | 449 ++- .../org/apache/phoenix/compile/QueryPlan.java | 2 + .../apache/phoenix/compile/TraceQueryPlan.java | 6 + .../apache/phoenix/execute/AggregatePlan.java | 41 +- .../phoenix/execute/ClientAggregatePlan.java| 46 +- .../phoenix/execute/ClientProcessingPlan.java | 4 + .../apache/phoenix/execute/ClientScanPlan.java | 22 +- .../apache/phoenix/execute/CorrelatePlan.java | 26 +- .../apache/phoenix/execute/CursorFetchPlan.java | 6 + .../apache/phoenix/execute/HashJoinPlan.java| 128 -- .../execute/LiteralResultIterationPlan.java | 6 + .../org/apache/phoenix/execute/ScanPlan.java| 14 +- .../phoenix/execute/SortMergeJoinPlan.java | 20 +- .../phoenix/execute/TupleProjectionPlan.java| 6 + .../org/apache/phoenix/execute/UnionPlan.java | 12 +- .../apache/phoenix/execute/UnnestArrayPlan.java | 6 + .../execute/visitor/AvgRowWidthVisitor.java | 205 + .../execute/visitor/ByteCountVisitor.java | 125 ++ .../execute/visitor/QueryPlanVisitor.java | 46 ++ .../execute/visitor/RowCountVisitor.java| 335 ++ .../apache/phoenix/jdbc/PhoenixStatement.java | 6 + .../java/org/apache/phoenix/util/CostUtil.java | 61 +-- .../query/ParallelIteratorsSplitTest.java | 6 + 26 files changed, 1612 insertions(+), 437 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/71537ed6/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java index a3584ce..493855a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java @@ -32,12 +32,16 @@ import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; + import org.junit.BeforeClass; import org.junit.Test; import com.google.common.collect.Maps; public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { +private final String testTable500; +private final String testTable990; +private final String testTable1000; @BeforeClass public static void doSetup() throws Exception { @@ -46,9 +50,16 @@ public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { props.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5)); props.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true)); props.put(QueryServices.COST_BASED_OPTIMIZER_ENABLED, Boolean.toString(true)); +props.put(QueryServices.MAX_SERVER_CACHE_SIZE_ATTRIB, Long.toString(15)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } +public CostBasedDecisionIT() throws Exception { +testTable500 = initTestTableValues(500); +testTable990 = initTestTableValues(990); +testTable1000 = initTestTableValues(1000); +} + @Test public void testCostOverridesStaticPlanOrdering1() throws Exception { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); @@ -64,10 +75,7 @@ public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { String query = "SELECT rowkey, c1, c2 FROM " + tableName + " where c1 LIKE 'X0%' ORDER BY rowkey"; // Use the data table plan that opts out order-by when stats are not available. -ResultSet rs = conn.createStatement().executeQuery("explain " + query); -String plan = QueryUtil.getExplainPlan(rs); -assertTrue("Expected 'FULL SCAN' in the plan:\n" + plan + ".", -plan.contains("FULL SCAN")); +verifyQueryPlan(query, "FULL SCAN"); Prepar
[2/2] phoenix git commit: PHOENIX-1556 Base hash versus sort merge join decision on cost
PHOENIX-1556 Base hash versus sort merge join decision on cost Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c7302511 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c7302511 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c7302511 Branch: refs/heads/4.x-HBase-1.2 Commit: c73025115fd007240b705b5ce25fbcb37b999ec9 Parents: ff4ad20 Author: maryannxue Authored: Mon Feb 12 14:23:52 2018 -0800 Committer: maryannxue Committed: Mon Feb 12 14:23:52 2018 -0800 -- .../phoenix/end2end/CostBasedDecisionIT.java| 420 - .../apache/phoenix/compile/JoinCompiler.java| 43 ++ .../phoenix/compile/ListJarsQueryPlan.java | 8 +- .../apache/phoenix/compile/QueryCompiler.java | 449 ++- .../org/apache/phoenix/compile/QueryPlan.java | 2 + .../apache/phoenix/compile/TraceQueryPlan.java | 6 + .../apache/phoenix/execute/AggregatePlan.java | 41 +- .../phoenix/execute/ClientAggregatePlan.java| 46 +- .../phoenix/execute/ClientProcessingPlan.java | 4 + .../apache/phoenix/execute/ClientScanPlan.java | 22 +- .../apache/phoenix/execute/CorrelatePlan.java | 26 +- .../apache/phoenix/execute/CursorFetchPlan.java | 6 + .../apache/phoenix/execute/HashJoinPlan.java| 128 -- .../execute/LiteralResultIterationPlan.java | 6 + .../org/apache/phoenix/execute/ScanPlan.java| 14 +- .../phoenix/execute/SortMergeJoinPlan.java | 20 +- .../phoenix/execute/TupleProjectionPlan.java| 6 + .../org/apache/phoenix/execute/UnionPlan.java | 12 +- .../apache/phoenix/execute/UnnestArrayPlan.java | 6 + .../execute/visitor/AvgRowWidthVisitor.java | 205 + .../execute/visitor/ByteCountVisitor.java | 125 ++ .../execute/visitor/QueryPlanVisitor.java | 46 ++ .../execute/visitor/RowCountVisitor.java| 335 ++ .../apache/phoenix/jdbc/PhoenixStatement.java | 6 + .../java/org/apache/phoenix/util/CostUtil.java | 61 +-- .../query/ParallelIteratorsSplitTest.java | 6 + 26 files changed, 1612 insertions(+), 437 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c7302511/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java index a3584ce..493855a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java @@ -32,12 +32,16 @@ import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; + import org.junit.BeforeClass; import org.junit.Test; import com.google.common.collect.Maps; public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { +private final String testTable500; +private final String testTable990; +private final String testTable1000; @BeforeClass public static void doSetup() throws Exception { @@ -46,9 +50,16 @@ public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { props.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5)); props.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true)); props.put(QueryServices.COST_BASED_OPTIMIZER_ENABLED, Boolean.toString(true)); +props.put(QueryServices.MAX_SERVER_CACHE_SIZE_ATTRIB, Long.toString(15)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } +public CostBasedDecisionIT() throws Exception { +testTable500 = initTestTableValues(500); +testTable990 = initTestTableValues(990); +testTable1000 = initTestTableValues(1000); +} + @Test public void testCostOverridesStaticPlanOrdering1() throws Exception { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); @@ -64,10 +75,7 @@ public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { String query = "SELECT rowkey, c1, c2 FROM " + tableName + " where c1 LIKE 'X0%' ORDER BY rowkey"; // Use the data table plan that opts out order-by when stats are not available. -ResultSet rs = conn.createStatement().executeQuery("explain " + query); -String plan = QueryUtil.getExplainPlan(rs); -assertTrue("Expected 'FULL SCAN' in the plan:\n" + plan + ".", -plan.contains("FULL SCAN")); +verifyQueryPlan(query, "FULL SCAN"); Prepar
[2/2] phoenix git commit: PHOENIX-1556 Base hash versus sort merge join decision on cost
PHOENIX-1556 Base hash versus sort merge join decision on cost Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ab907091 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ab907091 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ab907091 Branch: refs/heads/4.x-HBase-1.3 Commit: ab90709104f775cf8fbf7e23079e50bbd8f570e9 Parents: 74b2dcc Author: maryannxue Authored: Mon Feb 12 14:22:54 2018 -0800 Committer: maryannxue Committed: Mon Feb 12 14:22:54 2018 -0800 -- .../phoenix/end2end/CostBasedDecisionIT.java| 420 - .../apache/phoenix/compile/JoinCompiler.java| 43 ++ .../phoenix/compile/ListJarsQueryPlan.java | 8 +- .../apache/phoenix/compile/QueryCompiler.java | 449 ++- .../org/apache/phoenix/compile/QueryPlan.java | 2 + .../apache/phoenix/compile/TraceQueryPlan.java | 6 + .../apache/phoenix/execute/AggregatePlan.java | 41 +- .../phoenix/execute/ClientAggregatePlan.java| 46 +- .../phoenix/execute/ClientProcessingPlan.java | 4 + .../apache/phoenix/execute/ClientScanPlan.java | 22 +- .../apache/phoenix/execute/CorrelatePlan.java | 26 +- .../apache/phoenix/execute/CursorFetchPlan.java | 6 + .../apache/phoenix/execute/HashJoinPlan.java| 128 -- .../execute/LiteralResultIterationPlan.java | 6 + .../org/apache/phoenix/execute/ScanPlan.java| 14 +- .../phoenix/execute/SortMergeJoinPlan.java | 20 +- .../phoenix/execute/TupleProjectionPlan.java| 6 + .../org/apache/phoenix/execute/UnionPlan.java | 12 +- .../apache/phoenix/execute/UnnestArrayPlan.java | 6 + .../execute/visitor/AvgRowWidthVisitor.java | 205 + .../execute/visitor/ByteCountVisitor.java | 125 ++ .../execute/visitor/QueryPlanVisitor.java | 46 ++ .../execute/visitor/RowCountVisitor.java| 335 ++ .../apache/phoenix/jdbc/PhoenixStatement.java | 6 + .../java/org/apache/phoenix/util/CostUtil.java | 61 +-- .../query/ParallelIteratorsSplitTest.java | 6 + 26 files changed, 1612 insertions(+), 437 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ab907091/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java index a3584ce..493855a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java @@ -32,12 +32,16 @@ import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; + import org.junit.BeforeClass; import org.junit.Test; import com.google.common.collect.Maps; public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { +private final String testTable500; +private final String testTable990; +private final String testTable1000; @BeforeClass public static void doSetup() throws Exception { @@ -46,9 +50,16 @@ public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { props.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5)); props.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true)); props.put(QueryServices.COST_BASED_OPTIMIZER_ENABLED, Boolean.toString(true)); +props.put(QueryServices.MAX_SERVER_CACHE_SIZE_ATTRIB, Long.toString(15)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } +public CostBasedDecisionIT() throws Exception { +testTable500 = initTestTableValues(500); +testTable990 = initTestTableValues(990); +testTable1000 = initTestTableValues(1000); +} + @Test public void testCostOverridesStaticPlanOrdering1() throws Exception { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); @@ -64,10 +75,7 @@ public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { String query = "SELECT rowkey, c1, c2 FROM " + tableName + " where c1 LIKE 'X0%' ORDER BY rowkey"; // Use the data table plan that opts out order-by when stats are not available. -ResultSet rs = conn.createStatement().executeQuery("explain " + query); -String plan = QueryUtil.getExplainPlan(rs); -assertTrue("Expected 'FULL SCAN' in the plan:\n" + plan + ".", -plan.contains("FULL SCAN")); +verifyQueryPlan(query, "FULL SCAN"); Prepar
[2/2] phoenix git commit: PHOENIX-1556 Base hash versus sort merge join decision on cost
PHOENIX-1556 Base hash versus sort merge join decision on cost Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9461d0d6 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9461d0d6 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9461d0d6 Branch: refs/heads/master Commit: 9461d0d6a299bb3cbcf53905d7e9b73895a99299 Parents: a6bf735 Author: maryannxue Authored: Mon Feb 12 14:07:30 2018 -0800 Committer: maryannxue Committed: Mon Feb 12 14:07:30 2018 -0800 -- .../phoenix/end2end/CostBasedDecisionIT.java| 420 - .../apache/phoenix/compile/JoinCompiler.java| 43 ++ .../phoenix/compile/ListJarsQueryPlan.java | 8 +- .../apache/phoenix/compile/QueryCompiler.java | 449 ++- .../org/apache/phoenix/compile/QueryPlan.java | 2 + .../apache/phoenix/compile/TraceQueryPlan.java | 6 + .../apache/phoenix/execute/AggregatePlan.java | 41 +- .../phoenix/execute/ClientAggregatePlan.java| 46 +- .../phoenix/execute/ClientProcessingPlan.java | 4 + .../apache/phoenix/execute/ClientScanPlan.java | 22 +- .../apache/phoenix/execute/CorrelatePlan.java | 26 +- .../apache/phoenix/execute/CursorFetchPlan.java | 6 + .../apache/phoenix/execute/HashJoinPlan.java| 128 -- .../execute/LiteralResultIterationPlan.java | 6 + .../org/apache/phoenix/execute/ScanPlan.java| 14 +- .../phoenix/execute/SortMergeJoinPlan.java | 20 +- .../phoenix/execute/TupleProjectionPlan.java| 6 + .../org/apache/phoenix/execute/UnionPlan.java | 12 +- .../apache/phoenix/execute/UnnestArrayPlan.java | 6 + .../execute/visitor/AvgRowWidthVisitor.java | 205 + .../execute/visitor/ByteCountVisitor.java | 125 ++ .../execute/visitor/QueryPlanVisitor.java | 46 ++ .../execute/visitor/RowCountVisitor.java| 335 ++ .../apache/phoenix/jdbc/PhoenixStatement.java | 6 + .../java/org/apache/phoenix/util/CostUtil.java | 61 +-- .../query/ParallelIteratorsSplitTest.java | 6 + 26 files changed, 1612 insertions(+), 437 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9461d0d6/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java index a3584ce..493855a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CostBasedDecisionIT.java @@ -32,12 +32,16 @@ import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; + import org.junit.BeforeClass; import org.junit.Test; import com.google.common.collect.Maps; public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { +private final String testTable500; +private final String testTable990; +private final String testTable1000; @BeforeClass public static void doSetup() throws Exception { @@ -46,9 +50,16 @@ public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { props.put(QueryServices.STATS_UPDATE_FREQ_MS_ATTRIB, Long.toString(5)); props.put(QueryServices.USE_STATS_FOR_PARALLELIZATION, Boolean.toString(true)); props.put(QueryServices.COST_BASED_OPTIMIZER_ENABLED, Boolean.toString(true)); +props.put(QueryServices.MAX_SERVER_CACHE_SIZE_ATTRIB, Long.toString(15)); setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); } +public CostBasedDecisionIT() throws Exception { +testTable500 = initTestTableValues(500); +testTable990 = initTestTableValues(990); +testTable1000 = initTestTableValues(1000); +} + @Test public void testCostOverridesStaticPlanOrdering1() throws Exception { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); @@ -64,10 +75,7 @@ public class CostBasedDecisionIT extends BaseUniqueNamesOwnClusterIT { String query = "SELECT rowkey, c1, c2 FROM " + tableName + " where c1 LIKE 'X0%' ORDER BY rowkey"; // Use the data table plan that opts out order-by when stats are not available. -ResultSet rs = conn.createStatement().executeQuery("explain " + query); -String plan = QueryUtil.getExplainPlan(rs); -assertTrue("Expected 'FULL SCAN' in the plan:\n" + plan + ".", -plan.contains("FULL SCAN")); +verifyQueryPlan(query, "FULL SCAN"); PreparedState