phoenix git commit: PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table
Repository: phoenix Updated Branches: refs/heads/4.13-HBase-0.98 9ab3bbe61 -> 455d0a6e4 PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/455d0a6e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/455d0a6e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/455d0a6e Branch: refs/heads/4.13-HBase-0.98 Commit: 455d0a6e4b94f67d44caa228f5fe2aef12082271 Parents: 9ab3bbe Author: Samarth Jain <sama...@apache.org> Authored: Fri Dec 8 14:46:24 2017 -0800 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Dec 8 14:46:24 2017 -0800 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 36 .../phoenix/iterate/BaseResultIterators.java| 6 +--- 2 files changed, 37 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/455d0a6e/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index a662986..c15641d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -1068,4 +1068,40 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { .getQueryPlan().getScans().get(0).size()); } } + +@Test +public void testQueryingWithUseStatsForParallelizationOnOff() throws SQLException { +testUseStatsForParallelizationOnSaltedTable(true, true); +testUseStatsForParallelizationOnSaltedTable(true, false); +testUseStatsForParallelizationOnSaltedTable(false, true); +testUseStatsForParallelizationOnSaltedTable(false, false); +} + +private void testUseStatsForParallelizationOnSaltedTable(boolean useStatsFlag, boolean salted) +throws SQLException { +String tableName = generateUniqueName(); +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute( +"create table " + tableName + "(k varchar not null primary key, v varchar) " ++ (salted ? " SALT_BUCKETS=2," : "") + " USE_STATS_FOR_PARALLELIZATION=" ++ useStatsFlag); +conn.createStatement().execute("upsert into " + tableName + " values ('1', 'B')"); +conn.createStatement().execute("upsert into " + tableName + " values ('2', 'A')"); +conn.commit(); +String query = "SELECT V FROM " + tableName + " ORDER BY V"; +ResultSet rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); + +// Collect stats and make sure query still works correctly +conn.createStatement().execute("UPDATE STATISTICS " + tableName); +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); +} + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/455d0a6e/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 f397c8a..f9b90b4 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 @@ -609,11 +609,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result estimate.bytesEstimate += gpsBytes; } } -if (startNewScan && !scans.isEmpty() && useStatsForParallelization) { -/* - * Note that even if region boundary was crossed, if we are not using stats for - * parallelization, nothing gets added to the parallel scans. - */ +if (startNewScan && !scans.isEmpty()) { parallelScans.add(scans); scans = Lists.newArrayListWithExpectedSize(1); }
phoenix git commit: PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table
Repository: phoenix Updated Branches: refs/heads/4.13-HBase-1.1 3634aac10 -> 7cf1c7661 PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7cf1c766 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7cf1c766 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7cf1c766 Branch: refs/heads/4.13-HBase-1.1 Commit: 7cf1c766100e60fe9d32863faf2de79fc78dc91f Parents: 3634aac Author: Samarth Jain <sama...@apache.org> Authored: Fri Dec 8 14:46:08 2017 -0800 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Dec 8 14:46:08 2017 -0800 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 36 .../phoenix/iterate/BaseResultIterators.java| 6 +--- 2 files changed, 37 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/7cf1c766/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index bfc6819..49efa97 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -1068,4 +1068,40 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { .getQueryPlan().getScans().get(0).size()); } } + +@Test +public void testQueryingWithUseStatsForParallelizationOnOff() throws SQLException { +testUseStatsForParallelizationOnSaltedTable(true, true); +testUseStatsForParallelizationOnSaltedTable(true, false); +testUseStatsForParallelizationOnSaltedTable(false, true); +testUseStatsForParallelizationOnSaltedTable(false, false); +} + +private void testUseStatsForParallelizationOnSaltedTable(boolean useStatsFlag, boolean salted) +throws SQLException { +String tableName = generateUniqueName(); +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute( +"create table " + tableName + "(k varchar not null primary key, v varchar) " ++ (salted ? " SALT_BUCKETS=2," : "") + " USE_STATS_FOR_PARALLELIZATION=" ++ useStatsFlag); +conn.createStatement().execute("upsert into " + tableName + " values ('1', 'B')"); +conn.createStatement().execute("upsert into " + tableName + " values ('2', 'A')"); +conn.commit(); +String query = "SELECT V FROM " + tableName + " ORDER BY V"; +ResultSet rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); + +// Collect stats and make sure query still works correctly +conn.createStatement().execute("UPDATE STATISTICS " + tableName); +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); +} + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/7cf1c766/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 eb09813..bd67fa8 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 @@ -607,11 +607,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result estimate.bytesEstimate += gpsBytes; } } -if (startNewScan && !scans.isEmpty() && useStatsForParallelization) { -/* - * Note that even if region boundary was crossed, if we are not using stats for - * parallelization, nothing gets added to the parallel scans. - */ +if (startNewScan && !scans.isEmpty()) { parallelScans.add(scans); scans = Lists.newArrayListWithExpectedSize(1); }
phoenix git commit: PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table
Repository: phoenix Updated Branches: refs/heads/4.13-HBase-1.2 bfec658d0 -> 59180b817 PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/59180b81 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/59180b81 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/59180b81 Branch: refs/heads/4.13-HBase-1.2 Commit: 59180b8176c96b722a677782a6494356ef9a97af Parents: bfec658 Author: Samarth Jain <sama...@apache.org> Authored: Fri Dec 8 14:45:54 2017 -0800 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Dec 8 14:45:54 2017 -0800 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 36 .../phoenix/iterate/BaseResultIterators.java| 6 +--- 2 files changed, 37 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/59180b81/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index bfc6819..49efa97 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -1068,4 +1068,40 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { .getQueryPlan().getScans().get(0).size()); } } + +@Test +public void testQueryingWithUseStatsForParallelizationOnOff() throws SQLException { +testUseStatsForParallelizationOnSaltedTable(true, true); +testUseStatsForParallelizationOnSaltedTable(true, false); +testUseStatsForParallelizationOnSaltedTable(false, true); +testUseStatsForParallelizationOnSaltedTable(false, false); +} + +private void testUseStatsForParallelizationOnSaltedTable(boolean useStatsFlag, boolean salted) +throws SQLException { +String tableName = generateUniqueName(); +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute( +"create table " + tableName + "(k varchar not null primary key, v varchar) " ++ (salted ? " SALT_BUCKETS=2," : "") + " USE_STATS_FOR_PARALLELIZATION=" ++ useStatsFlag); +conn.createStatement().execute("upsert into " + tableName + " values ('1', 'B')"); +conn.createStatement().execute("upsert into " + tableName + " values ('2', 'A')"); +conn.commit(); +String query = "SELECT V FROM " + tableName + " ORDER BY V"; +ResultSet rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); + +// Collect stats and make sure query still works correctly +conn.createStatement().execute("UPDATE STATISTICS " + tableName); +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); +} + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/59180b81/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 eb09813..bd67fa8 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 @@ -607,11 +607,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result estimate.bytesEstimate += gpsBytes; } } -if (startNewScan && !scans.isEmpty() && useStatsForParallelization) { -/* - * Note that even if region boundary was crossed, if we are not using stats for - * parallelization, nothing gets added to the parallel scans. - */ +if (startNewScan && !scans.isEmpty()) { parallelScans.add(scans); scans = Lists.newArrayListWithExpectedSize(1); }
phoenix git commit: PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table
Repository: phoenix Updated Branches: refs/heads/4.13-HBase-1.3 17fa65486 -> cc3b2754f PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cc3b2754 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cc3b2754 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cc3b2754 Branch: refs/heads/4.13-HBase-1.3 Commit: cc3b2754fee43a0ac23abc3ad7ba5c958d68853c Parents: 17fa654 Author: Samarth Jain <sama...@apache.org> Authored: Fri Dec 8 14:45:33 2017 -0800 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Dec 8 14:45:33 2017 -0800 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 36 .../phoenix/iterate/BaseResultIterators.java| 6 +--- 2 files changed, 37 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc3b2754/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index bfc6819..49efa97 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -1068,4 +1068,40 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { .getQueryPlan().getScans().get(0).size()); } } + +@Test +public void testQueryingWithUseStatsForParallelizationOnOff() throws SQLException { +testUseStatsForParallelizationOnSaltedTable(true, true); +testUseStatsForParallelizationOnSaltedTable(true, false); +testUseStatsForParallelizationOnSaltedTable(false, true); +testUseStatsForParallelizationOnSaltedTable(false, false); +} + +private void testUseStatsForParallelizationOnSaltedTable(boolean useStatsFlag, boolean salted) +throws SQLException { +String tableName = generateUniqueName(); +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute( +"create table " + tableName + "(k varchar not null primary key, v varchar) " ++ (salted ? " SALT_BUCKETS=2," : "") + " USE_STATS_FOR_PARALLELIZATION=" ++ useStatsFlag); +conn.createStatement().execute("upsert into " + tableName + " values ('1', 'B')"); +conn.createStatement().execute("upsert into " + tableName + " values ('2', 'A')"); +conn.commit(); +String query = "SELECT V FROM " + tableName + " ORDER BY V"; +ResultSet rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); + +// Collect stats and make sure query still works correctly +conn.createStatement().execute("UPDATE STATISTICS " + tableName); +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); +} + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc3b2754/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 eb09813..bd67fa8 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 @@ -607,11 +607,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result estimate.bytesEstimate += gpsBytes; } } -if (startNewScan && !scans.isEmpty() && useStatsForParallelization) { -/* - * Note that even if region boundary was crossed, if we are not using stats for - * parallelization, nothing gets added to the parallel scans. - */ +if (startNewScan && !scans.isEmpty()) { parallelScans.add(scans); scans = Lists.newArrayListWithExpectedSize(1); }
phoenix git commit: PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table
Repository: phoenix Updated Branches: refs/heads/5.x-HBase-2.0 385c42372 -> 8dc47e807 PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8dc47e80 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8dc47e80 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8dc47e80 Branch: refs/heads/5.x-HBase-2.0 Commit: 8dc47e807624db31fe5112085005f089ae0482ab Parents: 385c423 Author: Samarth Jain <sama...@apache.org> Authored: Fri Dec 8 14:44:31 2017 -0800 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Dec 8 14:44:31 2017 -0800 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 36 .../phoenix/iterate/BaseResultIterators.java| 6 +--- 2 files changed, 37 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8dc47e80/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 74f4f34..1608d85 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -1069,4 +1069,40 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { .getQueryPlan().getScans().get(0).size()); } } + +@Test +public void testQueryingWithUseStatsForParallelizationOnOff() throws SQLException { +testUseStatsForParallelizationOnSaltedTable(true, true); +testUseStatsForParallelizationOnSaltedTable(true, false); +testUseStatsForParallelizationOnSaltedTable(false, true); +testUseStatsForParallelizationOnSaltedTable(false, false); +} + +private void testUseStatsForParallelizationOnSaltedTable(boolean useStatsFlag, boolean salted) +throws SQLException { +String tableName = generateUniqueName(); +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute( +"create table " + tableName + "(k varchar not null primary key, v varchar) " ++ (salted ? " SALT_BUCKETS=2," : "") + " USE_STATS_FOR_PARALLELIZATION=" ++ useStatsFlag); +conn.createStatement().execute("upsert into " + tableName + " values ('1', 'B')"); +conn.createStatement().execute("upsert into " + tableName + " values ('2', 'A')"); +conn.commit(); +String query = "SELECT V FROM " + tableName + " ORDER BY V"; +ResultSet rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); + +// Collect stats and make sure query still works correctly +conn.createStatement().execute("UPDATE STATISTICS " + tableName); +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); +} + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/8dc47e80/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 e710c82..05d3d9e 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 @@ -607,11 +607,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result estimate.bytesEstimate += gpsBytes; } } -if (startNewScan && !scans.isEmpty() && useStatsForParallelization) { -/* - * Note that even if region boundary was crossed, if we are not using stats for - * parallelization, nothing gets added to the parallel scans. - */ +if (startNewScan && !scans.isEmpty()) { parallelScans.add(scans); scans = Lists.newArrayListWithExpectedSize(1); }
phoenix git commit: PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 bfec658d0 -> 3f1784ffe PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3f1784ff Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3f1784ff Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3f1784ff Branch: refs/heads/4.x-HBase-1.2 Commit: 3f1784ffebf48b813d43dd676bd8b1575e17656b Parents: bfec658 Author: Samarth Jain <sama...@apache.org> Authored: Fri Dec 8 14:43:44 2017 -0800 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Dec 8 14:43:44 2017 -0800 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 36 .../phoenix/iterate/BaseResultIterators.java| 6 +--- 2 files changed, 37 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f1784ff/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index bfc6819..49efa97 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -1068,4 +1068,40 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { .getQueryPlan().getScans().get(0).size()); } } + +@Test +public void testQueryingWithUseStatsForParallelizationOnOff() throws SQLException { +testUseStatsForParallelizationOnSaltedTable(true, true); +testUseStatsForParallelizationOnSaltedTable(true, false); +testUseStatsForParallelizationOnSaltedTable(false, true); +testUseStatsForParallelizationOnSaltedTable(false, false); +} + +private void testUseStatsForParallelizationOnSaltedTable(boolean useStatsFlag, boolean salted) +throws SQLException { +String tableName = generateUniqueName(); +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute( +"create table " + tableName + "(k varchar not null primary key, v varchar) " ++ (salted ? " SALT_BUCKETS=2," : "") + " USE_STATS_FOR_PARALLELIZATION=" ++ useStatsFlag); +conn.createStatement().execute("upsert into " + tableName + " values ('1', 'B')"); +conn.createStatement().execute("upsert into " + tableName + " values ('2', 'A')"); +conn.commit(); +String query = "SELECT V FROM " + tableName + " ORDER BY V"; +ResultSet rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); + +// Collect stats and make sure query still works correctly +conn.createStatement().execute("UPDATE STATISTICS " + tableName); +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); +} + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/3f1784ff/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 eb09813..bd67fa8 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 @@ -607,11 +607,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result estimate.bytesEstimate += gpsBytes; } } -if (startNewScan && !scans.isEmpty() && useStatsForParallelization) { -/* - * Note that even if region boundary was crossed, if we are not using stats for - * parallelization, nothing gets added to the parallel scans. - */ +if (startNewScan && !scans.isEmpty()) { parallelScans.add(scans); scans = Lists.newArrayListWithExpectedSize(1); }
phoenix git commit: PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 3634aac10 -> ba0bc11e5 PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ba0bc11e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ba0bc11e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ba0bc11e Branch: refs/heads/4.x-HBase-1.1 Commit: ba0bc11e576975df4fa96a8c5b2c7a94de34c308 Parents: 3634aac Author: Samarth Jain <sama...@apache.org> Authored: Fri Dec 8 14:43:25 2017 -0800 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Dec 8 14:43:25 2017 -0800 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 36 .../phoenix/iterate/BaseResultIterators.java| 6 +--- 2 files changed, 37 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba0bc11e/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index bfc6819..49efa97 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -1068,4 +1068,40 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { .getQueryPlan().getScans().get(0).size()); } } + +@Test +public void testQueryingWithUseStatsForParallelizationOnOff() throws SQLException { +testUseStatsForParallelizationOnSaltedTable(true, true); +testUseStatsForParallelizationOnSaltedTable(true, false); +testUseStatsForParallelizationOnSaltedTable(false, true); +testUseStatsForParallelizationOnSaltedTable(false, false); +} + +private void testUseStatsForParallelizationOnSaltedTable(boolean useStatsFlag, boolean salted) +throws SQLException { +String tableName = generateUniqueName(); +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute( +"create table " + tableName + "(k varchar not null primary key, v varchar) " ++ (salted ? " SALT_BUCKETS=2," : "") + " USE_STATS_FOR_PARALLELIZATION=" ++ useStatsFlag); +conn.createStatement().execute("upsert into " + tableName + " values ('1', 'B')"); +conn.createStatement().execute("upsert into " + tableName + " values ('2', 'A')"); +conn.commit(); +String query = "SELECT V FROM " + tableName + " ORDER BY V"; +ResultSet rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); + +// Collect stats and make sure query still works correctly +conn.createStatement().execute("UPDATE STATISTICS " + tableName); +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); +} + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/ba0bc11e/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 eb09813..bd67fa8 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 @@ -607,11 +607,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result estimate.bytesEstimate += gpsBytes; } } -if (startNewScan && !scans.isEmpty() && useStatsForParallelization) { -/* - * Note that even if region boundary was crossed, if we are not using stats for - * parallelization, nothing gets added to the parallel scans. - */ +if (startNewScan && !scans.isEmpty()) { parallelScans.add(scans); scans = Lists.newArrayListWithExpectedSize(1); }
phoenix git commit: PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 65263e479 -> c14857374 PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c1485737 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c1485737 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c1485737 Branch: refs/heads/4.x-HBase-0.98 Commit: c14857374f0da31fc110a8d2e7e081c78beda6f0 Parents: 65263e4 Author: Samarth Jain <sama...@apache.org> Authored: Fri Dec 8 14:42:36 2017 -0800 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Dec 8 14:42:36 2017 -0800 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 36 .../phoenix/iterate/BaseResultIterators.java| 6 +--- 2 files changed, 37 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c1485737/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index a662986..c15641d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -1068,4 +1068,40 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { .getQueryPlan().getScans().get(0).size()); } } + +@Test +public void testQueryingWithUseStatsForParallelizationOnOff() throws SQLException { +testUseStatsForParallelizationOnSaltedTable(true, true); +testUseStatsForParallelizationOnSaltedTable(true, false); +testUseStatsForParallelizationOnSaltedTable(false, true); +testUseStatsForParallelizationOnSaltedTable(false, false); +} + +private void testUseStatsForParallelizationOnSaltedTable(boolean useStatsFlag, boolean salted) +throws SQLException { +String tableName = generateUniqueName(); +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute( +"create table " + tableName + "(k varchar not null primary key, v varchar) " ++ (salted ? " SALT_BUCKETS=2," : "") + " USE_STATS_FOR_PARALLELIZATION=" ++ useStatsFlag); +conn.createStatement().execute("upsert into " + tableName + " values ('1', 'B')"); +conn.createStatement().execute("upsert into " + tableName + " values ('2', 'A')"); +conn.commit(); +String query = "SELECT V FROM " + tableName + " ORDER BY V"; +ResultSet rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); + +// Collect stats and make sure query still works correctly +conn.createStatement().execute("UPDATE STATISTICS " + tableName); +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); +} + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/c1485737/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 f397c8a..f9b90b4 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 @@ -609,11 +609,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result estimate.bytesEstimate += gpsBytes; } } -if (startNewScan && !scans.isEmpty() && useStatsForParallelization) { -/* - * Note that even if region boundary was crossed, if we are not using stats for - * parallelization, nothing gets added to the parallel scans. - */ +if (startNewScan && !scans.isEmpty()) { parallelScans.add(scans); scans = Lists.newArrayListWithExpectedSize(1); }
phoenix git commit: PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table
Repository: phoenix Updated Branches: refs/heads/master d6e61af80 -> 72bc81902 PHOENIX-4397 Incorrect query results when with stats are disabled on a salted table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/72bc8190 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/72bc8190 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/72bc8190 Branch: refs/heads/master Commit: 72bc8190272480fae17475398ef492a3071a3a44 Parents: d6e61af Author: Samarth Jain <sama...@apache.org> Authored: Fri Dec 8 14:40:22 2017 -0800 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Dec 8 14:40:22 2017 -0800 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 36 .../phoenix/iterate/BaseResultIterators.java| 6 +--- 2 files changed, 37 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/72bc8190/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index bfc6819..49efa97 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -1068,4 +1068,40 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { .getQueryPlan().getScans().get(0).size()); } } + +@Test +public void testQueryingWithUseStatsForParallelizationOnOff() throws SQLException { +testUseStatsForParallelizationOnSaltedTable(true, true); +testUseStatsForParallelizationOnSaltedTable(true, false); +testUseStatsForParallelizationOnSaltedTable(false, true); +testUseStatsForParallelizationOnSaltedTable(false, false); +} + +private void testUseStatsForParallelizationOnSaltedTable(boolean useStatsFlag, boolean salted) +throws SQLException { +String tableName = generateUniqueName(); +Connection conn = DriverManager.getConnection(getUrl()); +conn.createStatement().execute( +"create table " + tableName + "(k varchar not null primary key, v varchar) " ++ (salted ? " SALT_BUCKETS=2," : "") + " USE_STATS_FOR_PARALLELIZATION=" ++ useStatsFlag); +conn.createStatement().execute("upsert into " + tableName + " values ('1', 'B')"); +conn.createStatement().execute("upsert into " + tableName + " values ('2', 'A')"); +conn.commit(); +String query = "SELECT V FROM " + tableName + " ORDER BY V"; +ResultSet rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); + +// Collect stats and make sure query still works correctly +conn.createStatement().execute("UPDATE STATISTICS " + tableName); +rs = conn.createStatement().executeQuery(query); +assertTrue(rs.next()); +assertEquals("A", rs.getString(1)); +assertTrue(rs.next()); +assertEquals("B", rs.getString(1)); +} + } http://git-wip-us.apache.org/repos/asf/phoenix/blob/72bc8190/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 eb09813..bd67fa8 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 @@ -607,11 +607,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result estimate.bytesEstimate += gpsBytes; } } -if (startNewScan && !scans.isEmpty() && useStatsForParallelization) { -/* - * Note that even if region boundary was crossed, if we are not using stats for - * parallelization, nothing gets added to the parallel scans. - */ +if (startNewScan && !scans.isEmpty()) { parallelScans.add(scans); scans = Lists.newArrayListWithExpectedSize(1); }
svn commit: r1816793 [1/2] - in /phoenix/site: publish/ publish/language/ source/src/site/ source/src/site/markdown/
Author: samarth Date: Fri Dec 1 03:12:56 2017 New Revision: 1816793 URL: http://svn.apache.org/viewvc?rev=1816793=rev Log: Update website with information on using explain plan api to get hold of query estimate information Added: phoenix/site/publish/explainplan.html phoenix/site/source/src/site/markdown/explainplan.md Modified: phoenix/site/publish/Phoenix-in-15-minutes-or-less.html phoenix/site/publish/array_type.html phoenix/site/publish/atomic_upsert.html phoenix/site/publish/building.html phoenix/site/publish/building_website.html phoenix/site/publish/bulk_dataload.html phoenix/site/publish/columnencoding.html phoenix/site/publish/contributing.html phoenix/site/publish/cursors.html phoenix/site/publish/develop.html phoenix/site/publish/download.html phoenix/site/publish/dynamic_columns.html phoenix/site/publish/faq.html phoenix/site/publish/flume.html phoenix/site/publish/hive_storage_handler.html phoenix/site/publish/index.html phoenix/site/publish/installation.html phoenix/site/publish/issues.html phoenix/site/publish/joins.html phoenix/site/publish/kafka.html phoenix/site/publish/language/datatypes.html phoenix/site/publish/language/functions.html phoenix/site/publish/language/index.html phoenix/site/publish/mailing_list.html phoenix/site/publish/metrics.html phoenix/site/publish/multi-tenancy.html phoenix/site/publish/namspace_mapping.html phoenix/site/publish/news.html phoenix/site/publish/paged.html phoenix/site/publish/performance.html phoenix/site/publish/pherf.html phoenix/site/publish/phoenix_mr.html phoenix/site/publish/phoenix_on_emr.html phoenix/site/publish/phoenix_orm.html phoenix/site/publish/phoenix_python.html phoenix/site/publish/phoenix_spark.html phoenix/site/publish/phoenixcon.html phoenix/site/publish/pig_integration.html phoenix/site/publish/recent.html phoenix/site/publish/release.html phoenix/site/publish/release_notes.html phoenix/site/publish/resources.html phoenix/site/publish/roadmap.html phoenix/site/publish/rowtimestamp.html phoenix/site/publish/salted.html phoenix/site/publish/secondary_indexing.html phoenix/site/publish/sequences.html phoenix/site/publish/server.html phoenix/site/publish/skip_scan.html phoenix/site/publish/source.html phoenix/site/publish/subqueries.html phoenix/site/publish/tablesample.html phoenix/site/publish/team.html phoenix/site/publish/tracing.html phoenix/site/publish/transactions.html phoenix/site/publish/tuning.html phoenix/site/publish/tuning_guide.html phoenix/site/publish/udf.html phoenix/site/publish/update_statistics.html phoenix/site/publish/upgrading.html phoenix/site/publish/views.html phoenix/site/publish/who_is_using.html phoenix/site/source/src/site/markdown/tuning_guide.md phoenix/site/source/src/site/markdown/update_statistics.md phoenix/site/source/src/site/site.xml Modified: phoenix/site/publish/Phoenix-in-15-minutes-or-less.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/Phoenix-in-15-minutes-or-less.html?rev=1816793=1816792=1816793=diff == --- phoenix/site/publish/Phoenix-in-15-minutes-or-less.html (original) +++ phoenix/site/publish/Phoenix-in-15-minutes-or-less.html Fri Dec 1 03:12:56 2017 @@ -1,7 +1,7 @@ @@ -139,6 +139,7 @@ Sequences Joins Subqueries + Explain Plan @@ -470,6 +471,9 @@ ORDER BY sum(population) DESC; Subqueries + + Explain Plan + Modified: phoenix/site/publish/array_type.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/array_type.html?rev=1816793=1816792=1816793=diff == --- phoenix/site/publish/array_type.html (original) +++ phoenix/site/publish/array_type.html Fri Dec 1 03:12:56 2017 @@ -1,7 +1,7 @@ @@ -139,6 +139,7
svn commit: r1816793 [2/2] - in /phoenix/site: publish/ publish/language/ source/src/site/ source/src/site/markdown/
Modified: phoenix/site/publish/sequences.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/sequences.html?rev=1816793=1816792=1816793=diff == --- phoenix/site/publish/sequences.html (original) +++ phoenix/site/publish/sequences.html Fri Dec 1 03:12:56 2017 @@ -1,7 +1,7 @@ @@ -139,6 +139,7 @@ Sequences Joins Subqueries + Explain Plan @@ -445,6 +446,9 @@ VALUES( NEXT VALUE FOR my_schema.my_sequ Subqueries + + Explain Plan + Modified: phoenix/site/publish/server.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/server.html?rev=1816793=1816792=1816793=diff == --- phoenix/site/publish/server.html (original) +++ phoenix/site/publish/server.html Fri Dec 1 03:12:56 2017 @@ -1,7 +1,7 @@ @@ -139,6 +139,7 @@ Sequences Joins Subqueries + Explain Plan @@ -693,6 +694,9 @@ log4j.logger.org.eclipse.jetty.server=IN Subqueries + + Explain Plan + Modified: phoenix/site/publish/skip_scan.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/skip_scan.html?rev=1816793=1816792=1816793=diff == --- phoenix/site/publish/skip_scan.html (original) +++ phoenix/site/publish/skip_scan.html Fri Dec 1 03:12:56 2017 @@ -1,7 +1,7 @@ @@ -139,6 +139,7 @@ Sequences Joins Subqueries + Explain Plan @@ -403,6 +404,9 @@ AND KEY2 IN (1, 2) Subqueries + + Explain Plan + Modified: phoenix/site/publish/source.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/source.html?rev=1816793=1816792=1816793=diff == --- phoenix/site/publish/source.html (original) +++ phoenix/site/publish/source.html Fri Dec 1 03:12:56 2017 @@ -1,7 +1,7 @@ @@ -139,6 +139,7 @@ Sequences Joins Subqueries + Explain Plan
phoenix git commit: PHOENIX-4287 Add null check for parent name
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.3 3e26b3d2f -> 176cf1261 PHOENIX-4287 Add null check for parent name Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/176cf126 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/176cf126 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/176cf126 Branch: refs/heads/4.12-HBase-1.3 Commit: 176cf1261b488cf24922507b672b979ecba3d5c1 Parents: 3e26b3d Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 17:57:50 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 17:57:50 2017 -0700 -- .../java/org/apache/phoenix/iterate/BaseResultIterators.java| 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/176cf126/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 18f28e2..eb09813 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 @@ -1246,9 +1246,10 @@ public abstract class BaseResultIterators extends ExplainTable implements Result } /* * For a view index, we use the property set on view. For indexes on base table, whether - * global or local, we use the property set on the base table. + * global or local, we use the property set on the base table. Null check needed when + * dropping local indexes. */ -if (table.getType() == PTableType.INDEX) { +if (table.getType() == PTableType.INDEX && table.getParentName() != null) { PhoenixConnection conn = context.getConnection(); String parentTableName = table.getParentName().getString(); try {
phoenix git commit: PHOENIX-4287 Add null check for parent name
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.2 e6a5660f9 -> 5ed99dc76 PHOENIX-4287 Add null check for parent name Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5ed99dc7 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5ed99dc7 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5ed99dc7 Branch: refs/heads/4.12-HBase-1.2 Commit: 5ed99dc760367b8d9c086be7abb0c9efe64ae6d2 Parents: e6a5660 Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 17:57:32 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 17:57:32 2017 -0700 -- .../java/org/apache/phoenix/iterate/BaseResultIterators.java| 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5ed99dc7/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 18f28e2..eb09813 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 @@ -1246,9 +1246,10 @@ public abstract class BaseResultIterators extends ExplainTable implements Result } /* * For a view index, we use the property set on view. For indexes on base table, whether - * global or local, we use the property set on the base table. + * global or local, we use the property set on the base table. Null check needed when + * dropping local indexes. */ -if (table.getType() == PTableType.INDEX) { +if (table.getType() == PTableType.INDEX && table.getParentName() != null) { PhoenixConnection conn = context.getConnection(); String parentTableName = table.getParentName().getString(); try {
phoenix git commit: PHOENIX-4287 Add null check for parent name
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-0.98 5a254779d -> c71b0b032 PHOENIX-4287 Add null check for parent name Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c71b0b03 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c71b0b03 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c71b0b03 Branch: refs/heads/4.12-HBase-0.98 Commit: c71b0b032941eba5e75c5f92a39ff6be2f86bc9c Parents: 5a25477 Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 17:57:01 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 17:57:01 2017 -0700 -- .../java/org/apache/phoenix/iterate/BaseResultIterators.java| 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c71b0b03/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 fb78624..f397c8a 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 @@ -1272,9 +1272,10 @@ public abstract class BaseResultIterators extends ExplainTable implements Result } /* * For a view index, we use the property set on view. For indexes on base table, whether - * global or local, we use the property set on the base table. + * global or local, we use the property set on the base table. Null check needed when + * dropping local indexes. */ -if (table.getType() == PTableType.INDEX) { +if (table.getType() == PTableType.INDEX && table.getParentName() != null) { PhoenixConnection conn = context.getConnection(); String parentTableName = table.getParentName().getString(); try {
phoenix git commit: PHOENIX-4287 Add null check for parent name
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.1 7223ff375 -> da91d6707 PHOENIX-4287 Add null check for parent name Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/da91d670 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/da91d670 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/da91d670 Branch: refs/heads/4.12-HBase-1.1 Commit: da91d6707b966481c2d1ea92d36f3493c0588671 Parents: 7223ff3 Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 17:57:18 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 17:57:18 2017 -0700 -- .../java/org/apache/phoenix/iterate/BaseResultIterators.java| 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/da91d670/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 18f28e2..eb09813 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 @@ -1246,9 +1246,10 @@ public abstract class BaseResultIterators extends ExplainTable implements Result } /* * For a view index, we use the property set on view. For indexes on base table, whether - * global or local, we use the property set on the base table. + * global or local, we use the property set on the base table. Null check needed when + * dropping local indexes. */ -if (table.getType() == PTableType.INDEX) { +if (table.getType() == PTableType.INDEX && table.getParentName() != null) { PhoenixConnection conn = context.getConnection(); String parentTableName = table.getParentName().getString(); try {
phoenix git commit: PHOENIX-4287 Add null check for parent name
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 a3cf649c2 -> 2e619b491 PHOENIX-4287 Add null check for parent name Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2e619b49 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2e619b49 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2e619b49 Branch: refs/heads/4.x-HBase-0.98 Commit: 2e619b491f9d71796376a3e1db550cf27e556e5f Parents: a3cf649 Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 17:55:32 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 17:55:32 2017 -0700 -- .../java/org/apache/phoenix/iterate/BaseResultIterators.java| 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2e619b49/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 fb78624..f397c8a 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 @@ -1272,9 +1272,10 @@ public abstract class BaseResultIterators extends ExplainTable implements Result } /* * For a view index, we use the property set on view. For indexes on base table, whether - * global or local, we use the property set on the base table. + * global or local, we use the property set on the base table. Null check needed when + * dropping local indexes. */ -if (table.getType() == PTableType.INDEX) { +if (table.getType() == PTableType.INDEX && table.getParentName() != null) { PhoenixConnection conn = context.getConnection(); String parentTableName = table.getParentName().getString(); try {
phoenix git commit: PHOENIX-4287 Add null check for parent name
Repository: phoenix Updated Branches: refs/heads/master 7d2205d0c -> 895d06797 PHOENIX-4287 Add null check for parent name Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/895d0679 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/895d0679 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/895d0679 Branch: refs/heads/master Commit: 895d067974639cd2205b14940e4e46864b4e2060 Parents: 7d2205d Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 17:52:32 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 17:52:32 2017 -0700 -- .../java/org/apache/phoenix/iterate/BaseResultIterators.java| 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/895d0679/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 18f28e2..eb09813 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 @@ -1246,9 +1246,10 @@ public abstract class BaseResultIterators extends ExplainTable implements Result } /* * For a view index, we use the property set on view. For indexes on base table, whether - * global or local, we use the property set on the base table. + * global or local, we use the property set on the base table. Null check needed when + * dropping local indexes. */ -if (table.getType() == PTableType.INDEX) { +if (table.getType() == PTableType.INDEX && table.getParentName() != null) { PhoenixConnection conn = context.getConnection(); String parentTableName = table.getParentName().getString(); try {
phoenix git commit: PHOENIX-4287 Make indexes inherit use stats property from their parent table or view
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.3 f5a88b6ff -> 3e26b3d2f PHOENIX-4287 Make indexes inherit use stats property from their parent table or view Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/3e26b3d2 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/3e26b3d2 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/3e26b3d2 Branch: refs/heads/4.12-HBase-1.3 Commit: 3e26b3d2f7b854de6cc9f63836998f230c1095a4 Parents: f5a88b6 Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 16:58:56 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 16:58:56 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 146 +-- .../phoenix/iterate/BaseResultIterators.java| 41 +- 2 files changed, 171 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/3e26b3d2/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index e76b147..bfc6819 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -72,8 +72,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { private static void createIndex(String indexName, String table, long guidePostWidth) throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { -conn.createStatement().execute("CREATE INDEX " + indexName + " ON " + table -+ " (c1.a) INCLUDE (c2.b) "); +conn.createStatement().execute( +"CREATE INDEX " + indexName + " ON " + table + " (c1.a) INCLUDE (c2.b) "); conn.createStatement().execute("UPDATE STATISTICS " + indexName); } } @@ -558,9 +558,10 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { Estimate info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // Now, let's disable USE_STATS_FOR_PARALLELIZATION on the table -conn.createStatement().execute("ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); +conn.createStatement().execute( +"ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. assertEquals(4, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() @@ -570,11 +571,11 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // assert that the aggregate query on view also works correctly String viewName = "V_" + generateUniqueName(); -conn.createStatement() -.execute("CREATE VIEW " + viewName + " AS SELECT * FROM " + tableName + " USE_STATS_FOR_PARALLELIZATION = false"); +conn.createStatement().execute("CREATE VIEW " + viewName + " AS SELECT * FROM " ++ tableName + " USE_STATS_FOR_PARALLELIZATION = false"); sql = "SELECT COUNT(*) FROM " + viewName; rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. @@ -595,21 +596,21 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { rs = conn.createStatement().executeQuery(sql); // stats are being used for parallelization. So number of scans is higher. assertEquals(14, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() -.getScans().get(0).size()); +.getScans().get(0).size()); assertTrue(rs.next()); assertEquals(10, rs.getInt(1)); info = getByteRowEstimates(con
phoenix git commit: PHOENIX-4287 Make indexes inherit use stats property from their parent table or view
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.2 4245cc2aa -> e6a5660f9 PHOENIX-4287 Make indexes inherit use stats property from their parent table or view Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e6a5660f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e6a5660f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e6a5660f Branch: refs/heads/4.12-HBase-1.2 Commit: e6a5660f92f0ffcf5c0cc3b6df39b65ab48c32bb Parents: 4245cc2 Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 16:58:29 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 16:58:29 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 146 +-- .../phoenix/iterate/BaseResultIterators.java| 41 +- 2 files changed, 171 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e6a5660f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index e76b147..bfc6819 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -72,8 +72,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { private static void createIndex(String indexName, String table, long guidePostWidth) throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { -conn.createStatement().execute("CREATE INDEX " + indexName + " ON " + table -+ " (c1.a) INCLUDE (c2.b) "); +conn.createStatement().execute( +"CREATE INDEX " + indexName + " ON " + table + " (c1.a) INCLUDE (c2.b) "); conn.createStatement().execute("UPDATE STATISTICS " + indexName); } } @@ -558,9 +558,10 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { Estimate info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // Now, let's disable USE_STATS_FOR_PARALLELIZATION on the table -conn.createStatement().execute("ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); +conn.createStatement().execute( +"ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. assertEquals(4, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() @@ -570,11 +571,11 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // assert that the aggregate query on view also works correctly String viewName = "V_" + generateUniqueName(); -conn.createStatement() -.execute("CREATE VIEW " + viewName + " AS SELECT * FROM " + tableName + " USE_STATS_FOR_PARALLELIZATION = false"); +conn.createStatement().execute("CREATE VIEW " + viewName + " AS SELECT * FROM " ++ tableName + " USE_STATS_FOR_PARALLELIZATION = false"); sql = "SELECT COUNT(*) FROM " + viewName; rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. @@ -595,21 +596,21 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { rs = conn.createStatement().executeQuery(sql); // stats are being used for parallelization. So number of scans is higher. assertEquals(14, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() -.getScans().get(0).size()); +.getScans().get(0).size()); assertTrue(rs.next()); assertEquals(10, rs.getInt(1)); info = getByteRowEstimates(con
phoenix git commit: PHOENIX-4287 Make indexes inherit use stats property from their parent table or view
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-0.98 663d9a4b9 -> 5a254779d PHOENIX-4287 Make indexes inherit use stats property from their parent table or view Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5a254779 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5a254779 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5a254779 Branch: refs/heads/4.12-HBase-0.98 Commit: 5a254779d7a1cb85f1510ebfa445806067c5d5db Parents: 663d9a4 Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 16:57:39 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 16:57:39 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 146 +-- .../phoenix/iterate/BaseResultIterators.java| 41 +- 2 files changed, 171 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5a254779/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 2206478..a662986 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -72,8 +72,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { private static void createIndex(String indexName, String table, long guidePostWidth) throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { -conn.createStatement().execute("CREATE INDEX " + indexName + " ON " + table -+ " (c1.a) INCLUDE (c2.b) "); +conn.createStatement().execute( +"CREATE INDEX " + indexName + " ON " + table + " (c1.a) INCLUDE (c2.b) "); conn.createStatement().execute("UPDATE STATISTICS " + indexName); } } @@ -558,9 +558,10 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { Estimate info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // Now, let's disable USE_STATS_FOR_PARALLELIZATION on the table -conn.createStatement().execute("ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); +conn.createStatement().execute( +"ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. assertEquals(4, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() @@ -570,11 +571,11 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // assert that the aggregate query on view also works correctly String viewName = "V_" + generateUniqueName(); -conn.createStatement() -.execute("CREATE VIEW " + viewName + " AS SELECT * FROM " + tableName + " USE_STATS_FOR_PARALLELIZATION = false"); +conn.createStatement().execute("CREATE VIEW " + viewName + " AS SELECT * FROM " ++ tableName + " USE_STATS_FOR_PARALLELIZATION = false"); sql = "SELECT COUNT(*) FROM " + viewName; rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. @@ -595,21 +596,21 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { rs = conn.createStatement().executeQuery(sql); // stats are being used for parallelization. So number of scans is higher. assertEquals(14, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() -.getScans().get(0).size()); +.getScans().get(0).size()); assertTrue(rs.next()); assertEquals(10, rs.getInt(1)); info = getByteRowEstimates(con
phoenix git commit: PHOENIX-4287 Make indexes inherit use stats property from their parent table or view
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.1 11b1c5a9d -> 7223ff375 PHOENIX-4287 Make indexes inherit use stats property from their parent table or view Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7223ff37 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7223ff37 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7223ff37 Branch: refs/heads/4.12-HBase-1.1 Commit: 7223ff3754cfc24cf14516493bd6c467237ac3ea Parents: 11b1c5a Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 16:58:11 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 16:58:11 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 146 +-- .../phoenix/iterate/BaseResultIterators.java| 41 +- 2 files changed, 171 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/7223ff37/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index e76b147..bfc6819 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -72,8 +72,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { private static void createIndex(String indexName, String table, long guidePostWidth) throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { -conn.createStatement().execute("CREATE INDEX " + indexName + " ON " + table -+ " (c1.a) INCLUDE (c2.b) "); +conn.createStatement().execute( +"CREATE INDEX " + indexName + " ON " + table + " (c1.a) INCLUDE (c2.b) "); conn.createStatement().execute("UPDATE STATISTICS " + indexName); } } @@ -558,9 +558,10 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { Estimate info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // Now, let's disable USE_STATS_FOR_PARALLELIZATION on the table -conn.createStatement().execute("ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); +conn.createStatement().execute( +"ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. assertEquals(4, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() @@ -570,11 +571,11 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // assert that the aggregate query on view also works correctly String viewName = "V_" + generateUniqueName(); -conn.createStatement() -.execute("CREATE VIEW " + viewName + " AS SELECT * FROM " + tableName + " USE_STATS_FOR_PARALLELIZATION = false"); +conn.createStatement().execute("CREATE VIEW " + viewName + " AS SELECT * FROM " ++ tableName + " USE_STATS_FOR_PARALLELIZATION = false"); sql = "SELECT COUNT(*) FROM " + viewName; rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. @@ -595,21 +596,21 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { rs = conn.createStatement().executeQuery(sql); // stats are being used for parallelization. So number of scans is higher. assertEquals(14, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() -.getScans().get(0).size()); +.getScans().get(0).size()); assertTrue(rs.next()); assertEquals(10, rs.getInt(1)); info = getByteRowEstimates(con
phoenix git commit: PHOENIX-4287 Make indexes inherit use stats property from their parent table or view
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 52c57b1d5 -> a3cf649c2 PHOENIX-4287 Make indexes inherit use stats property from their parent table or view Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a3cf649c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a3cf649c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a3cf649c Branch: refs/heads/4.x-HBase-0.98 Commit: a3cf649c28f89b908c1c5100e681899ddfa87bc5 Parents: 52c57b1 Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 16:56:45 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 16:56:45 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 146 +-- .../phoenix/iterate/BaseResultIterators.java| 41 +- 2 files changed, 171 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a3cf649c/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 2206478..a662986 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -72,8 +72,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { private static void createIndex(String indexName, String table, long guidePostWidth) throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { -conn.createStatement().execute("CREATE INDEX " + indexName + " ON " + table -+ " (c1.a) INCLUDE (c2.b) "); +conn.createStatement().execute( +"CREATE INDEX " + indexName + " ON " + table + " (c1.a) INCLUDE (c2.b) "); conn.createStatement().execute("UPDATE STATISTICS " + indexName); } } @@ -558,9 +558,10 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { Estimate info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // Now, let's disable USE_STATS_FOR_PARALLELIZATION on the table -conn.createStatement().execute("ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); +conn.createStatement().execute( +"ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. assertEquals(4, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() @@ -570,11 +571,11 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // assert that the aggregate query on view also works correctly String viewName = "V_" + generateUniqueName(); -conn.createStatement() -.execute("CREATE VIEW " + viewName + " AS SELECT * FROM " + tableName + " USE_STATS_FOR_PARALLELIZATION = false"); +conn.createStatement().execute("CREATE VIEW " + viewName + " AS SELECT * FROM " ++ tableName + " USE_STATS_FOR_PARALLELIZATION = false"); sql = "SELECT COUNT(*) FROM " + viewName; rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. @@ -595,21 +596,21 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { rs = conn.createStatement().executeQuery(sql); // stats are being used for parallelization. So number of scans is higher. assertEquals(14, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() -.getScans().get(0).size()); +.getScans().get(0).size()); assertTrue(rs.next()); assertEquals(10, rs.getInt(1)); info = getByteRowEstimates(con
phoenix git commit: PHOENIX-4287 Make indexes inherit use stats property from their parent table or view
Repository: phoenix Updated Branches: refs/heads/master 8f9356a2b -> 7d2205d0c PHOENIX-4287 Make indexes inherit use stats property from their parent table or view Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7d2205d0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7d2205d0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7d2205d0 Branch: refs/heads/master Commit: 7d2205d0c9854f61e667a4939eeed645de518f45 Parents: 8f9356a Author: Samarth Jain <sama...@apache.org> Authored: Thu Nov 2 16:55:55 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Nov 2 16:56:13 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 146 +-- .../phoenix/iterate/BaseResultIterators.java| 41 +- 2 files changed, 171 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/7d2205d0/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index e76b147..bfc6819 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -72,8 +72,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { private static void createIndex(String indexName, String table, long guidePostWidth) throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { -conn.createStatement().execute("CREATE INDEX " + indexName + " ON " + table -+ " (c1.a) INCLUDE (c2.b) "); +conn.createStatement().execute( +"CREATE INDEX " + indexName + " ON " + table + " (c1.a) INCLUDE (c2.b) "); conn.createStatement().execute("UPDATE STATISTICS " + indexName); } } @@ -558,9 +558,10 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { Estimate info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // Now, let's disable USE_STATS_FOR_PARALLELIZATION on the table -conn.createStatement().execute("ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); +conn.createStatement().execute( +"ALTER TABLE " + tableName + " SET USE_STATS_FOR_PARALLELIZATION = " + false); rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. assertEquals(4, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() @@ -570,11 +571,11 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { info = getByteRowEstimates(conn, sql, binds); assertEquals((Long) 10l, info.getEstimatedRows()); assertTrue(info.getEstimateInfoTs() > 0); - + // assert that the aggregate query on view also works correctly String viewName = "V_" + generateUniqueName(); -conn.createStatement() -.execute("CREATE VIEW " + viewName + " AS SELECT * FROM " + tableName + " USE_STATS_FOR_PARALLELIZATION = false"); +conn.createStatement().execute("CREATE VIEW " + viewName + " AS SELECT * FROM " ++ tableName + " USE_STATS_FOR_PARALLELIZATION = false"); sql = "SELECT COUNT(*) FROM " + viewName; rs = conn.createStatement().executeQuery(sql); // stats are not being used for parallelization. So number of scans is lower. @@ -595,21 +596,21 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { rs = conn.createStatement().executeQuery(sql); // stats are being used for parallelization. So number of scans is higher. assertEquals(14, rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan() -.getScans().get(0).size()); +.getScans().get(0).size()); assertTrue(rs.next()); assertEquals(10, rs.getInt(1)); info = getByteRowEstimates(conn, sql, binds);
[2/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
PHOENIX-4332 Indexes should inherit guide post width of the base data table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f5a88b6f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f5a88b6f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f5a88b6f Branch: refs/heads/4.12-HBase-1.3 Commit: f5a88b6ffa66765949660825d0d1169d7bbfe86f Parents: a59a7dc Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:28:15 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:28:15 2017 -0700 -- ...mnEncodedImmutableNonTxStatsCollectorIT.java | 1 + ...olumnEncodedImmutableTxStatsCollectorIT.java | 1 + ...lumnEncodedMutableNonTxStatsCollectorIT.java | 1 + .../ColumnEncodedMutableTxStatsCollectorIT.java | 1 + ...mnEncodedImmutableNonTxStatsCollectorIT.java | 1 + ...olumnEncodedImmutableTxStatsCollectorIT.java | 1 + .../phoenix/end2end/StatsCollectorIT.java | 734 ...SysTableNamespaceMappedStatsCollectorIT.java | 1 + .../phoenix/schema/stats/StatsCollectorIT.java | 832 +++ .../stats/DefaultStatisticsCollector.java | 58 +- 10 files changed, 895 insertions(+), 736 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/f5a88b6f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java index d5d8442..eb01e89 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedImmutableNonTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/f5a88b6f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java index 23b1654..4e90d70 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedImmutableTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/f5a88b6f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java index 24869a2..2a560db 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedMutableNonTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/f5a88b6f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java index eea591d..01fa2b5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT
[1/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.3 a59a7dcaf -> f5a88b6ff http://git-wip-us.apache.org/repos/asf/phoenix/blob/f5a88b6f/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java index daf7c70..788e2dd 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java @@ -18,6 +18,8 @@ package org.apache.phoenix.schema.stats; import java.io.IOException; +import java.sql.Connection; +import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -45,15 +47,22 @@ import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.query.QueryServicesOptions; +import org.apache.phoenix.schema.PName; +import org.apache.phoenix.schema.PTable; +import org.apache.phoenix.schema.PTable.IndexType; +import org.apache.phoenix.schema.PTableType; import org.apache.phoenix.schema.SortOrder; import org.apache.phoenix.schema.types.PInteger; import org.apache.phoenix.schema.types.PLong; import org.apache.phoenix.util.EnvironmentEdgeManager; import org.apache.phoenix.util.MetaDataUtil; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.SchemaUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; /** @@ -75,6 +84,7 @@ class DefaultStatisticsCollector implements StatisticsCollector { private ImmutableBytesWritable currentRow; private final long clientTimeStamp; private final String tableName; +private final boolean isViewIndexTable; DefaultStatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp, byte[] family, byte[] gp_width_bytes, byte[] gp_per_region_bytes) throws IOException { @@ -95,6 +105,9 @@ class DefaultStatisticsCollector implements StatisticsCollector { // since there's no row representing those in SYSTEM.CATALOG. if (MetaDataUtil.isViewIndex(tableName)) { pName = MetaDataUtil.getViewIndexUserTableName(tableName); +isViewIndexTable = true; +} else { +isViewIndexTable = false; } ptableKey = SchemaUtil.getTableKeyFromFullName(pName); this.clientTimeStamp = clientTimeStamp; @@ -109,7 +122,7 @@ class DefaultStatisticsCollector implements StatisticsCollector { } } -private void initGuidepostDepth() throws IOException { +private void initGuidepostDepth() throws IOException, ClassNotFoundException, SQLException { // First check is if guidepost info set on statement itself if (guidePostPerRegionBytes != null || guidePostWidthBytes != null) { int guidepostPerRegion = 0; @@ -135,6 +148,38 @@ class DefaultStatisticsCollector implements StatisticsCollector { if (!result.isEmpty()) { Cell cell = result.listCells().get(0); guidepostWidth = PLong.INSTANCE.getCodec().decodeLong(cell.getValueArray(), cell.getValueOffset(), SortOrder.getDefault()); +} else if (!isViewIndexTable) { +/* + * The table we are collecting stats for is potentially a base table, or local + * index or a global index. For view indexes, we rely on the the guide post + * width column in the parent data table's metadata which we already tried + * retrieving above. + */ +try (Connection conn = + QueryUtil.getConnectionOnServer(env.getConfiguration())) { +PTable table = PhoenixRuntime.getTable(conn, tableName); +if (table.getType() == PTableType.INDEX +&& table.getIndexType() == IndexType.GLOBAL) { +/* + * For global indexes, we need to get the parentName first and then + * fetch guide post width configured for the parent table. + */ +PName parentName = table.getParentName(); +byte[] parentKey = + SchemaUtil.getTableKeyFromFullName(parentName.getString()); +get =
[2/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
PHOENIX-4332 Indexes should inherit guide post width of the base data table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4245cc2a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4245cc2a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4245cc2a Branch: refs/heads/4.12-HBase-1.2 Commit: 4245cc2aa2f541704583f4a5ca7d533a4457f099 Parents: c36186c Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:27:37 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:27:37 2017 -0700 -- ...mnEncodedImmutableNonTxStatsCollectorIT.java | 1 + ...olumnEncodedImmutableTxStatsCollectorIT.java | 1 + ...lumnEncodedMutableNonTxStatsCollectorIT.java | 1 + .../ColumnEncodedMutableTxStatsCollectorIT.java | 1 + ...mnEncodedImmutableNonTxStatsCollectorIT.java | 1 + ...olumnEncodedImmutableTxStatsCollectorIT.java | 1 + .../phoenix/end2end/StatsCollectorIT.java | 734 ...SysTableNamespaceMappedStatsCollectorIT.java | 1 + .../phoenix/schema/stats/StatsCollectorIT.java | 832 +++ .../stats/DefaultStatisticsCollector.java | 58 +- 10 files changed, 895 insertions(+), 736 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4245cc2a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java index 7ef825e..73a5a76 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedImmutableNonTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/4245cc2a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java index 0c6934b..58a105e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedImmutableTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/4245cc2a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java index 3cd81c7..aaa334d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedMutableNonTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/4245cc2a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java index e4a2734..d884181 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT
[1/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.2 c36186c03 -> 4245cc2aa http://git-wip-us.apache.org/repos/asf/phoenix/blob/4245cc2a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java index daf7c70..788e2dd 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java @@ -18,6 +18,8 @@ package org.apache.phoenix.schema.stats; import java.io.IOException; +import java.sql.Connection; +import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -45,15 +47,22 @@ import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.query.QueryServicesOptions; +import org.apache.phoenix.schema.PName; +import org.apache.phoenix.schema.PTable; +import org.apache.phoenix.schema.PTable.IndexType; +import org.apache.phoenix.schema.PTableType; import org.apache.phoenix.schema.SortOrder; import org.apache.phoenix.schema.types.PInteger; import org.apache.phoenix.schema.types.PLong; import org.apache.phoenix.util.EnvironmentEdgeManager; import org.apache.phoenix.util.MetaDataUtil; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.SchemaUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; /** @@ -75,6 +84,7 @@ class DefaultStatisticsCollector implements StatisticsCollector { private ImmutableBytesWritable currentRow; private final long clientTimeStamp; private final String tableName; +private final boolean isViewIndexTable; DefaultStatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp, byte[] family, byte[] gp_width_bytes, byte[] gp_per_region_bytes) throws IOException { @@ -95,6 +105,9 @@ class DefaultStatisticsCollector implements StatisticsCollector { // since there's no row representing those in SYSTEM.CATALOG. if (MetaDataUtil.isViewIndex(tableName)) { pName = MetaDataUtil.getViewIndexUserTableName(tableName); +isViewIndexTable = true; +} else { +isViewIndexTable = false; } ptableKey = SchemaUtil.getTableKeyFromFullName(pName); this.clientTimeStamp = clientTimeStamp; @@ -109,7 +122,7 @@ class DefaultStatisticsCollector implements StatisticsCollector { } } -private void initGuidepostDepth() throws IOException { +private void initGuidepostDepth() throws IOException, ClassNotFoundException, SQLException { // First check is if guidepost info set on statement itself if (guidePostPerRegionBytes != null || guidePostWidthBytes != null) { int guidepostPerRegion = 0; @@ -135,6 +148,38 @@ class DefaultStatisticsCollector implements StatisticsCollector { if (!result.isEmpty()) { Cell cell = result.listCells().get(0); guidepostWidth = PLong.INSTANCE.getCodec().decodeLong(cell.getValueArray(), cell.getValueOffset(), SortOrder.getDefault()); +} else if (!isViewIndexTable) { +/* + * The table we are collecting stats for is potentially a base table, or local + * index or a global index. For view indexes, we rely on the the guide post + * width column in the parent data table's metadata which we already tried + * retrieving above. + */ +try (Connection conn = + QueryUtil.getConnectionOnServer(env.getConfiguration())) { +PTable table = PhoenixRuntime.getTable(conn, tableName); +if (table.getType() == PTableType.INDEX +&& table.getIndexType() == IndexType.GLOBAL) { +/* + * For global indexes, we need to get the parentName first and then + * fetch guide post width configured for the parent table. + */ +PName parentName = table.getParentName(); +byte[] parentKey = + SchemaUtil.getTableKeyFromFullName(parentName.getString()); +get =
[1/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.1 bb063e9d6 -> 11b1c5a9d http://git-wip-us.apache.org/repos/asf/phoenix/blob/11b1c5a9/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java index daf7c70..788e2dd 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java @@ -18,6 +18,8 @@ package org.apache.phoenix.schema.stats; import java.io.IOException; +import java.sql.Connection; +import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -45,15 +47,22 @@ import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.query.QueryServicesOptions; +import org.apache.phoenix.schema.PName; +import org.apache.phoenix.schema.PTable; +import org.apache.phoenix.schema.PTable.IndexType; +import org.apache.phoenix.schema.PTableType; import org.apache.phoenix.schema.SortOrder; import org.apache.phoenix.schema.types.PInteger; import org.apache.phoenix.schema.types.PLong; import org.apache.phoenix.util.EnvironmentEdgeManager; import org.apache.phoenix.util.MetaDataUtil; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.SchemaUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; /** @@ -75,6 +84,7 @@ class DefaultStatisticsCollector implements StatisticsCollector { private ImmutableBytesWritable currentRow; private final long clientTimeStamp; private final String tableName; +private final boolean isViewIndexTable; DefaultStatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp, byte[] family, byte[] gp_width_bytes, byte[] gp_per_region_bytes) throws IOException { @@ -95,6 +105,9 @@ class DefaultStatisticsCollector implements StatisticsCollector { // since there's no row representing those in SYSTEM.CATALOG. if (MetaDataUtil.isViewIndex(tableName)) { pName = MetaDataUtil.getViewIndexUserTableName(tableName); +isViewIndexTable = true; +} else { +isViewIndexTable = false; } ptableKey = SchemaUtil.getTableKeyFromFullName(pName); this.clientTimeStamp = clientTimeStamp; @@ -109,7 +122,7 @@ class DefaultStatisticsCollector implements StatisticsCollector { } } -private void initGuidepostDepth() throws IOException { +private void initGuidepostDepth() throws IOException, ClassNotFoundException, SQLException { // First check is if guidepost info set on statement itself if (guidePostPerRegionBytes != null || guidePostWidthBytes != null) { int guidepostPerRegion = 0; @@ -135,6 +148,38 @@ class DefaultStatisticsCollector implements StatisticsCollector { if (!result.isEmpty()) { Cell cell = result.listCells().get(0); guidepostWidth = PLong.INSTANCE.getCodec().decodeLong(cell.getValueArray(), cell.getValueOffset(), SortOrder.getDefault()); +} else if (!isViewIndexTable) { +/* + * The table we are collecting stats for is potentially a base table, or local + * index or a global index. For view indexes, we rely on the the guide post + * width column in the parent data table's metadata which we already tried + * retrieving above. + */ +try (Connection conn = + QueryUtil.getConnectionOnServer(env.getConfiguration())) { +PTable table = PhoenixRuntime.getTable(conn, tableName); +if (table.getType() == PTableType.INDEX +&& table.getIndexType() == IndexType.GLOBAL) { +/* + * For global indexes, we need to get the parentName first and then + * fetch guide post width configured for the parent table. + */ +PName parentName = table.getParentName(); +byte[] parentKey = + SchemaUtil.getTableKeyFromFullName(parentName.getString()); +get =
[1/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-0.98 8d524e2f3 -> 663d9a4b9 http://git-wip-us.apache.org/repos/asf/phoenix/blob/663d9a4b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java index 8844cc8..9c4bcce 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java @@ -18,6 +18,8 @@ package org.apache.phoenix.schema.stats; import java.io.IOException; +import java.sql.Connection; +import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -45,15 +47,22 @@ import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.query.QueryServicesOptions; +import org.apache.phoenix.schema.PName; +import org.apache.phoenix.schema.PTable; +import org.apache.phoenix.schema.PTable.IndexType; +import org.apache.phoenix.schema.PTableType; import org.apache.phoenix.schema.SortOrder; import org.apache.phoenix.schema.types.PInteger; import org.apache.phoenix.schema.types.PLong; import org.apache.phoenix.util.EnvironmentEdgeManager; import org.apache.phoenix.util.MetaDataUtil; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.SchemaUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; /** @@ -75,6 +84,7 @@ public class DefaultStatisticsCollector implements StatisticsCollector { private ImmutableBytesWritable currentRow; private final long clientTimeStamp; private final String tableName; +private final boolean isViewIndexTable; DefaultStatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp, byte[] family, byte[] gp_width_bytes, byte[] gp_per_region_bytes) throws IOException { @@ -95,6 +105,9 @@ public class DefaultStatisticsCollector implements StatisticsCollector { // since there's no row representing those in SYSTEM.CATALOG. if (MetaDataUtil.isViewIndex(tableName)) { pName = MetaDataUtil.getViewIndexUserTableName(tableName); +isViewIndexTable = true; +} else { +isViewIndexTable = false; } ptableKey = SchemaUtil.getTableKeyFromFullName(pName); this.clientTimeStamp = clientTimeStamp; @@ -109,7 +122,7 @@ public class DefaultStatisticsCollector implements StatisticsCollector { } } -private void initGuidepostDepth() throws IOException { +private void initGuidepostDepth() throws IOException, ClassNotFoundException, SQLException { // First check is if guidepost info set on statement itself if (guidePostPerRegionBytes != null || guidePostWidthBytes != null) { int guidepostPerRegion = 0; @@ -135,6 +148,38 @@ public class DefaultStatisticsCollector implements StatisticsCollector { if (!result.isEmpty()) { Cell cell = result.listCells().get(0); guidepostWidth = PLong.INSTANCE.getCodec().decodeLong(cell.getValueArray(), cell.getValueOffset(), SortOrder.getDefault()); +} else if (!isViewIndexTable) { +/* + * The table we are collecting stats for is potentially a base table, or local + * index or a global index. For view indexes, we rely on the the guide post + * width column in the parent data table's metadata which we already tried + * retrieving above. + */ +try (Connection conn = + QueryUtil.getConnectionOnServer(env.getConfiguration())) { +PTable table = PhoenixRuntime.getTable(conn, tableName); +if (table.getType() == PTableType.INDEX +&& table.getIndexType() == IndexType.GLOBAL) { +/* + * For global indexes, we need to get the parentName first and then + * fetch guide post width configured for the parent table. + */ +PName parentName = table.getParentName(); +byte[] parentKey = + SchemaUtil.getTableKeyFromFullName(parentName.getString()); +
[2/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
PHOENIX-4332 Indexes should inherit guide post width of the base data table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/663d9a4b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/663d9a4b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/663d9a4b Branch: refs/heads/4.12-HBase-0.98 Commit: 663d9a4b9d1b5cc1b3d7d2d0eb1568a46db87668 Parents: 8d524e2 Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:26:23 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:26:23 2017 -0700 -- ...mnEncodedImmutableNonTxStatsCollectorIT.java | 1 + ...olumnEncodedImmutableTxStatsCollectorIT.java | 1 + ...lumnEncodedMutableNonTxStatsCollectorIT.java | 1 + .../ColumnEncodedMutableTxStatsCollectorIT.java | 1 + ...mnEncodedImmutableNonTxStatsCollectorIT.java | 1 + ...olumnEncodedImmutableTxStatsCollectorIT.java | 1 + .../phoenix/end2end/StatsCollectorIT.java | 734 ...SysTableNamespaceMappedStatsCollectorIT.java | 1 + .../phoenix/schema/stats/StatsCollectorIT.java | 832 +++ .../stats/DefaultStatisticsCollector.java | 58 +- 10 files changed, 895 insertions(+), 736 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/663d9a4b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java index d5d8442..eb01e89 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedImmutableNonTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/663d9a4b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java index 23b1654..4e90d70 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedImmutableTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/663d9a4b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java index 24869a2..2a560db 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedMutableNonTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/663d9a4b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java index eea591d..01fa2b5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT
[1/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 d20ba13a0 -> 6e80b0fb0 http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e80b0fb/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java index 8844cc8..9c4bcce 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java @@ -18,6 +18,8 @@ package org.apache.phoenix.schema.stats; import java.io.IOException; +import java.sql.Connection; +import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -45,15 +47,22 @@ import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.query.QueryServicesOptions; +import org.apache.phoenix.schema.PName; +import org.apache.phoenix.schema.PTable; +import org.apache.phoenix.schema.PTable.IndexType; +import org.apache.phoenix.schema.PTableType; import org.apache.phoenix.schema.SortOrder; import org.apache.phoenix.schema.types.PInteger; import org.apache.phoenix.schema.types.PLong; import org.apache.phoenix.util.EnvironmentEdgeManager; import org.apache.phoenix.util.MetaDataUtil; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.SchemaUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; /** @@ -75,6 +84,7 @@ public class DefaultStatisticsCollector implements StatisticsCollector { private ImmutableBytesWritable currentRow; private final long clientTimeStamp; private final String tableName; +private final boolean isViewIndexTable; DefaultStatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp, byte[] family, byte[] gp_width_bytes, byte[] gp_per_region_bytes) throws IOException { @@ -95,6 +105,9 @@ public class DefaultStatisticsCollector implements StatisticsCollector { // since there's no row representing those in SYSTEM.CATALOG. if (MetaDataUtil.isViewIndex(tableName)) { pName = MetaDataUtil.getViewIndexUserTableName(tableName); +isViewIndexTable = true; +} else { +isViewIndexTable = false; } ptableKey = SchemaUtil.getTableKeyFromFullName(pName); this.clientTimeStamp = clientTimeStamp; @@ -109,7 +122,7 @@ public class DefaultStatisticsCollector implements StatisticsCollector { } } -private void initGuidepostDepth() throws IOException { +private void initGuidepostDepth() throws IOException, ClassNotFoundException, SQLException { // First check is if guidepost info set on statement itself if (guidePostPerRegionBytes != null || guidePostWidthBytes != null) { int guidepostPerRegion = 0; @@ -135,6 +148,38 @@ public class DefaultStatisticsCollector implements StatisticsCollector { if (!result.isEmpty()) { Cell cell = result.listCells().get(0); guidepostWidth = PLong.INSTANCE.getCodec().decodeLong(cell.getValueArray(), cell.getValueOffset(), SortOrder.getDefault()); +} else if (!isViewIndexTable) { +/* + * The table we are collecting stats for is potentially a base table, or local + * index or a global index. For view indexes, we rely on the the guide post + * width column in the parent data table's metadata which we already tried + * retrieving above. + */ +try (Connection conn = + QueryUtil.getConnectionOnServer(env.getConfiguration())) { +PTable table = PhoenixRuntime.getTable(conn, tableName); +if (table.getType() == PTableType.INDEX +&& table.getIndexType() == IndexType.GLOBAL) { +/* + * For global indexes, we need to get the parentName first and then + * fetch guide post width configured for the parent table. + */ +PName parentName = table.getParentName(); +byte[] parentKey = + SchemaUtil.getTableKeyFromFullName(parentName.getString()); +
[2/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
PHOENIX-4332 Indexes should inherit guide post width of the base data table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6e80b0fb Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6e80b0fb Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6e80b0fb Branch: refs/heads/4.x-HBase-0.98 Commit: 6e80b0fb0386c48c0837d73d72dd4aee1ca15c4a Parents: d20ba13 Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:25:39 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:25:39 2017 -0700 -- ...mnEncodedImmutableNonTxStatsCollectorIT.java | 1 + ...olumnEncodedImmutableTxStatsCollectorIT.java | 1 + ...lumnEncodedMutableNonTxStatsCollectorIT.java | 1 + .../ColumnEncodedMutableTxStatsCollectorIT.java | 1 + ...mnEncodedImmutableNonTxStatsCollectorIT.java | 1 + ...olumnEncodedImmutableTxStatsCollectorIT.java | 1 + .../phoenix/end2end/StatsCollectorIT.java | 734 ...SysTableNamespaceMappedStatsCollectorIT.java | 1 + .../phoenix/schema/stats/StatsCollectorIT.java | 832 +++ .../stats/DefaultStatisticsCollector.java | 58 +- 10 files changed, 895 insertions(+), 736 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e80b0fb/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java index d5d8442..eb01e89 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedImmutableNonTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e80b0fb/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java index 23b1654..4e90d70 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedImmutableTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e80b0fb/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java index 24869a2..2a560db 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedMutableNonTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e80b0fb/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java index eea591d..01fa2b5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT
[2/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
PHOENIX-4332 Indexes should inherit guide post width of the base data table Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/61684c44 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/61684c44 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/61684c44 Branch: refs/heads/master Commit: 61684c4431d16deff53adfbb91ea76c13642df61 Parents: 87b6628 Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:24:52 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:24:52 2017 -0700 -- ...mnEncodedImmutableNonTxStatsCollectorIT.java | 1 + ...olumnEncodedImmutableTxStatsCollectorIT.java | 1 + ...lumnEncodedMutableNonTxStatsCollectorIT.java | 1 + .../ColumnEncodedMutableTxStatsCollectorIT.java | 1 + ...mnEncodedImmutableNonTxStatsCollectorIT.java | 1 + ...olumnEncodedImmutableTxStatsCollectorIT.java | 1 + .../phoenix/end2end/StatsCollectorIT.java | 734 ...SysTableNamespaceMappedStatsCollectorIT.java | 1 + .../phoenix/schema/stats/StatsCollectorIT.java | 832 +++ .../stats/DefaultStatisticsCollector.java | 58 +- 10 files changed, 895 insertions(+), 736 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/61684c44/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java index d5d8442..eb01e89 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedImmutableNonTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/61684c44/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java index 23b1654..4e90d70 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedImmutableTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/61684c44/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java index 24869a2..2a560db 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableNonTxStatsCollectorIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import java.util.Arrays; import java.util.Collection; +import org.apache.phoenix.schema.stats.StatsCollectorIT; import org.junit.runners.Parameterized.Parameters; public class ColumnEncodedMutableNonTxStatsCollectorIT extends StatsCollectorIT { http://git-wip-us.apache.org/repos/asf/phoenix/blob/61684c44/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java index eea591d..01fa2b5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedMutableTxStatsCollectorIT.java ++
[1/2] phoenix git commit: PHOENIX-4332 Indexes should inherit guide post width of the base data table
Repository: phoenix Updated Branches: refs/heads/master 87b662867 -> 61684c443 http://git-wip-us.apache.org/repos/asf/phoenix/blob/61684c44/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java index daf7c70..788e2dd 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java @@ -18,6 +18,8 @@ package org.apache.phoenix.schema.stats; import java.io.IOException; +import java.sql.Connection; +import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -45,15 +47,22 @@ import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr; import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.query.QueryServicesOptions; +import org.apache.phoenix.schema.PName; +import org.apache.phoenix.schema.PTable; +import org.apache.phoenix.schema.PTable.IndexType; +import org.apache.phoenix.schema.PTableType; import org.apache.phoenix.schema.SortOrder; import org.apache.phoenix.schema.types.PInteger; import org.apache.phoenix.schema.types.PLong; import org.apache.phoenix.util.EnvironmentEdgeManager; import org.apache.phoenix.util.MetaDataUtil; +import org.apache.phoenix.util.PhoenixRuntime; +import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.SchemaUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; /** @@ -75,6 +84,7 @@ class DefaultStatisticsCollector implements StatisticsCollector { private ImmutableBytesWritable currentRow; private final long clientTimeStamp; private final String tableName; +private final boolean isViewIndexTable; DefaultStatisticsCollector(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp, byte[] family, byte[] gp_width_bytes, byte[] gp_per_region_bytes) throws IOException { @@ -95,6 +105,9 @@ class DefaultStatisticsCollector implements StatisticsCollector { // since there's no row representing those in SYSTEM.CATALOG. if (MetaDataUtil.isViewIndex(tableName)) { pName = MetaDataUtil.getViewIndexUserTableName(tableName); +isViewIndexTable = true; +} else { +isViewIndexTable = false; } ptableKey = SchemaUtil.getTableKeyFromFullName(pName); this.clientTimeStamp = clientTimeStamp; @@ -109,7 +122,7 @@ class DefaultStatisticsCollector implements StatisticsCollector { } } -private void initGuidepostDepth() throws IOException { +private void initGuidepostDepth() throws IOException, ClassNotFoundException, SQLException { // First check is if guidepost info set on statement itself if (guidePostPerRegionBytes != null || guidePostWidthBytes != null) { int guidepostPerRegion = 0; @@ -135,6 +148,38 @@ class DefaultStatisticsCollector implements StatisticsCollector { if (!result.isEmpty()) { Cell cell = result.listCells().get(0); guidepostWidth = PLong.INSTANCE.getCodec().decodeLong(cell.getValueArray(), cell.getValueOffset(), SortOrder.getDefault()); +} else if (!isViewIndexTable) { +/* + * The table we are collecting stats for is potentially a base table, or local + * index or a global index. For view indexes, we rely on the the guide post + * width column in the parent data table's metadata which we already tried + * retrieving above. + */ +try (Connection conn = + QueryUtil.getConnectionOnServer(env.getConfiguration())) { +PTable table = PhoenixRuntime.getTable(conn, tableName); +if (table.getType() == PTableType.INDEX +&& table.getIndexType() == IndexType.GLOBAL) { +/* + * For global indexes, we need to get the parentName first and then + * fetch guide post width configured for the parent table. + */ +PName parentName = table.getParentName(); +byte[] parentKey = + SchemaUtil.getTableKeyFromFullName(parentName.getString()); +get = new
phoenix git commit: PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.3 d11eab6ec -> a59a7dcaf PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a59a7dca Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a59a7dca Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a59a7dca Branch: refs/heads/4.12-HBase-1.3 Commit: a59a7dcaf43453f53cb4159e931ae4b83e94748c Parents: d11eab6 Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:23:01 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:23:01 2017 -0700 -- .../apache/phoenix/end2end/CreateTableIT.java | 73 .../end2end/ExplainPlanWithStatsEnabledIT.java | 2 +- .../phoenix/exception/SQLExceptionCode.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 7 ++ 4 files changed, 82 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a59a7dca/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 93bb02b..1abc653 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -27,6 +27,7 @@ import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -35,6 +36,7 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -743,4 +745,75 @@ public class CreateTableIT extends ParallelStatsDisabledIT { } conn2.close(); } + +@Test +public void testSettingGuidePostWidth() throws Exception { +try (Connection conn = DriverManager.getConnection(getUrl())) { +String dataTable = generateUniqueName(); +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + dataTable + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +conn.createStatement().execute(ddl); +assertEquals(20, checkGuidePostWidth(dataTable)); +String viewName = "V_" + generateUniqueName(); +ddl = +"CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} + +// let the view creation go through +ddl = "CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable; +conn.createStatement().execute(ddl); + +String globalIndex = "GI_" + generateUniqueName(); +ddl = +"CREATE INDEX " + globalIndex + " ON " + dataTable ++ "(a) INCLUDE (b) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String localIndex = "LI_" + generateUniqueName(); +ddl = +"CREATE LOCAL INDEX " + localIndex + " ON " + dataTable ++ "(b) INCLUDE (a) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String viewIndex = "VI_" + generateUniqueName(); +
phoenix git commit: PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.2 74306de2c -> c36186c03 PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c36186c0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c36186c0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c36186c0 Branch: refs/heads/4.12-HBase-1.2 Commit: c36186c03b0ed4250734f775ccf6f4b2a894d2e3 Parents: 74306de Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:22:33 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:22:33 2017 -0700 -- .../apache/phoenix/end2end/CreateTableIT.java | 73 .../end2end/ExplainPlanWithStatsEnabledIT.java | 2 +- .../phoenix/exception/SQLExceptionCode.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 7 ++ 4 files changed, 82 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/c36186c0/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 93bb02b..1abc653 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -27,6 +27,7 @@ import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -35,6 +36,7 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -743,4 +745,75 @@ public class CreateTableIT extends ParallelStatsDisabledIT { } conn2.close(); } + +@Test +public void testSettingGuidePostWidth() throws Exception { +try (Connection conn = DriverManager.getConnection(getUrl())) { +String dataTable = generateUniqueName(); +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + dataTable + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +conn.createStatement().execute(ddl); +assertEquals(20, checkGuidePostWidth(dataTable)); +String viewName = "V_" + generateUniqueName(); +ddl = +"CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} + +// let the view creation go through +ddl = "CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable; +conn.createStatement().execute(ddl); + +String globalIndex = "GI_" + generateUniqueName(); +ddl = +"CREATE INDEX " + globalIndex + " ON " + dataTable ++ "(a) INCLUDE (b) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String localIndex = "LI_" + generateUniqueName(); +ddl = +"CREATE LOCAL INDEX " + localIndex + " ON " + dataTable ++ "(b) INCLUDE (a) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String viewIndex = "VI_" + generateUniqueName(); +
phoenix git commit: PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.1 1d7ce5de7 -> bb063e9d6 PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/bb063e9d Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/bb063e9d Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/bb063e9d Branch: refs/heads/4.12-HBase-1.1 Commit: bb063e9d6d582b554a01306cb2b4c67e068d378d Parents: 1d7ce5d Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:22:12 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:22:12 2017 -0700 -- .../apache/phoenix/end2end/CreateTableIT.java | 73 .../end2end/ExplainPlanWithStatsEnabledIT.java | 2 +- .../phoenix/exception/SQLExceptionCode.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 7 ++ 4 files changed, 82 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/bb063e9d/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 93bb02b..1abc653 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -27,6 +27,7 @@ import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -35,6 +36,7 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -743,4 +745,75 @@ public class CreateTableIT extends ParallelStatsDisabledIT { } conn2.close(); } + +@Test +public void testSettingGuidePostWidth() throws Exception { +try (Connection conn = DriverManager.getConnection(getUrl())) { +String dataTable = generateUniqueName(); +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + dataTable + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +conn.createStatement().execute(ddl); +assertEquals(20, checkGuidePostWidth(dataTable)); +String viewName = "V_" + generateUniqueName(); +ddl = +"CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} + +// let the view creation go through +ddl = "CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable; +conn.createStatement().execute(ddl); + +String globalIndex = "GI_" + generateUniqueName(); +ddl = +"CREATE INDEX " + globalIndex + " ON " + dataTable ++ "(a) INCLUDE (b) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String localIndex = "LI_" + generateUniqueName(); +ddl = +"CREATE LOCAL INDEX " + localIndex + " ON " + dataTable ++ "(b) INCLUDE (a) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String viewIndex = "VI_" + generateUniqueName(); +
phoenix git commit: PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-0.98 5c20b9d93 -> 8d524e2f3 PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8d524e2f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8d524e2f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8d524e2f Branch: refs/heads/4.12-HBase-0.98 Commit: 8d524e2f3b3e83fddf3fcbd58777d72f4c22bdc6 Parents: 5c20b9d Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:21:49 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:21:49 2017 -0700 -- .../apache/phoenix/end2end/CreateTableIT.java | 73 .../end2end/ExplainPlanWithStatsEnabledIT.java | 2 +- .../phoenix/exception/SQLExceptionCode.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 7 ++ 4 files changed, 82 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8d524e2f/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 93bb02b..1abc653 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -27,6 +27,7 @@ import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -35,6 +36,7 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -743,4 +745,75 @@ public class CreateTableIT extends ParallelStatsDisabledIT { } conn2.close(); } + +@Test +public void testSettingGuidePostWidth() throws Exception { +try (Connection conn = DriverManager.getConnection(getUrl())) { +String dataTable = generateUniqueName(); +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + dataTable + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +conn.createStatement().execute(ddl); +assertEquals(20, checkGuidePostWidth(dataTable)); +String viewName = "V_" + generateUniqueName(); +ddl = +"CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} + +// let the view creation go through +ddl = "CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable; +conn.createStatement().execute(ddl); + +String globalIndex = "GI_" + generateUniqueName(); +ddl = +"CREATE INDEX " + globalIndex + " ON " + dataTable ++ "(a) INCLUDE (b) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String localIndex = "LI_" + generateUniqueName(); +ddl = +"CREATE LOCAL INDEX " + localIndex + " ON " + dataTable ++ "(b) INCLUDE (a) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String viewIndex = "VI_" + generateUniqueName(); +
phoenix git commit: PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 e485a5897 -> d20ba13a0 PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d20ba13a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d20ba13a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d20ba13a Branch: refs/heads/4.x-HBase-0.98 Commit: d20ba13a096ac1df1b5f1b9e1a8832cfe4466258 Parents: e485a58 Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:21:25 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:21:25 2017 -0700 -- .../apache/phoenix/end2end/CreateTableIT.java | 73 .../end2end/ExplainPlanWithStatsEnabledIT.java | 2 +- .../phoenix/exception/SQLExceptionCode.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 7 ++ 4 files changed, 82 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d20ba13a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 93bb02b..1abc653 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -27,6 +27,7 @@ import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -35,6 +36,7 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -743,4 +745,75 @@ public class CreateTableIT extends ParallelStatsDisabledIT { } conn2.close(); } + +@Test +public void testSettingGuidePostWidth() throws Exception { +try (Connection conn = DriverManager.getConnection(getUrl())) { +String dataTable = generateUniqueName(); +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + dataTable + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +conn.createStatement().execute(ddl); +assertEquals(20, checkGuidePostWidth(dataTable)); +String viewName = "V_" + generateUniqueName(); +ddl = +"CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} + +// let the view creation go through +ddl = "CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable; +conn.createStatement().execute(ddl); + +String globalIndex = "GI_" + generateUniqueName(); +ddl = +"CREATE INDEX " + globalIndex + " ON " + dataTable ++ "(a) INCLUDE (b) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String localIndex = "LI_" + generateUniqueName(); +ddl = +"CREATE LOCAL INDEX " + localIndex + " ON " + dataTable ++ "(b) INCLUDE (a) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String viewIndex = "VI_" + generateUniqueName(); +
phoenix git commit: PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables
Repository: phoenix Updated Branches: refs/heads/master 82364f6b3 -> 87b662867 PHOENIX-4343 In CREATE TABLE allow setting guide post width only on base data tables Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/87b66286 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/87b66286 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/87b66286 Branch: refs/heads/master Commit: 87b6628674042df285c775e8b0d8259d3c0780a0 Parents: 82364f6 Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 23:21:01 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 23:21:01 2017 -0700 -- .../apache/phoenix/end2end/CreateTableIT.java | 73 .../end2end/ExplainPlanWithStatsEnabledIT.java | 2 +- .../phoenix/exception/SQLExceptionCode.java | 2 +- .../apache/phoenix/schema/MetaDataClient.java | 7 ++ 4 files changed, 82 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/87b66286/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java index 93bb02b..1abc653 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CreateTableIT.java @@ -27,6 +27,7 @@ import static org.junit.Assert.fail; import java.sql.Connection; import java.sql.DriverManager; +import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -35,6 +36,7 @@ import java.util.Properties; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GlobalPermissionOrBuilder; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.exception.SQLExceptionCode; @@ -743,4 +745,75 @@ public class CreateTableIT extends ParallelStatsDisabledIT { } conn2.close(); } + +@Test +public void testSettingGuidePostWidth() throws Exception { +try (Connection conn = DriverManager.getConnection(getUrl())) { +String dataTable = generateUniqueName(); +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + dataTable + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +conn.createStatement().execute(ddl); +assertEquals(20, checkGuidePostWidth(dataTable)); +String viewName = "V_" + generateUniqueName(); +ddl = +"CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} + +// let the view creation go through +ddl = "CREATE VIEW " + viewName + " AS SELECT * FROM " + dataTable; +conn.createStatement().execute(ddl); + +String globalIndex = "GI_" + generateUniqueName(); +ddl = +"CREATE INDEX " + globalIndex + " ON " + dataTable ++ "(a) INCLUDE (b) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String localIndex = "LI_" + generateUniqueName(); +ddl = +"CREATE LOCAL INDEX " + localIndex + " ON " + dataTable ++ "(b) INCLUDE (a) GUIDE_POSTS_WIDTH = " + guidePostWidth; +try { +conn.createStatement().execute(ddl); +} catch (SQLException e) { + assertEquals(SQLExceptionCode.CANNOT_SET_GUIDE_POST_WIDTH.getErrorCode(), +e.getErrorCode()); +} +String viewIndex = "VI_" + generateUniqueName(); +
phoenix git commit: PHOENIX-4287 Addendum to correctly set useStatsForParallelization property
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.2 1844747f5 -> 74306de2c PHOENIX-4287 Addendum to correctly set useStatsForParallelization property Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/74306de2 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/74306de2 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/74306de2 Branch: refs/heads/4.12-HBase-1.2 Commit: 74306de2c15fd54235eae49b0bab0d390dd94560 Parents: 1844747 Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 21:21:52 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 21:21:52 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 87 +--- .../coprocessor/MetaDataEndpointImpl.java | 2 +- .../phoenix/iterate/BaseResultIterators.java| 9 +- .../apache/phoenix/schema/DelegateTable.java| 2 +- .../apache/phoenix/schema/MetaDataClient.java | 30 --- .../java/org/apache/phoenix/schema/PTable.java | 2 +- .../org/apache/phoenix/schema/PTableImpl.java | 22 ++--- 7 files changed, 111 insertions(+), 43 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/74306de2/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 25d4194..b5e4588 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -17,7 +17,6 @@ */ package org.apache.phoenix.end2end; -import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -34,6 +33,7 @@ import java.util.List; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.query.BaseTest; import org.apache.phoenix.schema.PTableKey; import org.apache.phoenix.schema.TableNotFoundException; @@ -352,7 +352,7 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } @Test -public void testSettingUseStatsForQueryPlanProperty() throws Exception { +public void testSettingUseStatsForParallelizationProperty() throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { String table = generateUniqueName(); String ddl = @@ -360,20 +360,31 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR) USE_STATS_FOR_PARALLELIZATION = false"; conn.createStatement().execute(ddl); assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), false); + ddl = "ALTER TABLE " + table + " SET USE_STATS_FOR_PARALLELIZATION = true"; conn.createStatement().execute(ddl); assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), true); + +table = generateUniqueName(); +ddl = +"CREATE TABLE " + table ++ " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR) USE_STATS_FOR_PARALLELIZATION = false"; +conn.createStatement().execute(ddl); +assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), false); + table = generateUniqueName(); ddl = "CREATE TABLE " + table + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR)"; conn.createStatement().execute(ddl); -assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), -DEFAULT_USE_STATS_FOR_PARALLELIZATION); + +// because we didn't set the property, PTable.useStatsForParallelization() should return +// null +assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), null); } } private static void assertUseStatsForQueryFlag(String tableName, PhoenixConnection conn, -boolean flag) throws TableNotFoundException, SQLException { -assertEquals(flag, +Boolean expected) throws TableNotFoundException, SQLExcepti
phoenix git commit: PHOENIX-4287 Addendum to correctly set useStatsForParallelization property
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.1 9e9fce067 -> 1d7ce5de7 PHOENIX-4287 Addendum to correctly set useStatsForParallelization property Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1d7ce5de Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1d7ce5de Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1d7ce5de Branch: refs/heads/4.12-HBase-1.1 Commit: 1d7ce5de753e259412bc0b6ea39785b7e8bf3932 Parents: 9e9fce0 Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 21:17:34 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 21:17:34 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 87 +--- .../coprocessor/MetaDataEndpointImpl.java | 2 +- .../phoenix/iterate/BaseResultIterators.java| 9 +- .../apache/phoenix/schema/DelegateTable.java| 2 +- .../apache/phoenix/schema/MetaDataClient.java | 26 +++--- .../java/org/apache/phoenix/schema/PTable.java | 2 +- .../org/apache/phoenix/schema/PTableImpl.java | 22 ++--- 7 files changed, 110 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/1d7ce5de/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 25d4194..b5e4588 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -17,7 +17,6 @@ */ package org.apache.phoenix.end2end; -import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -34,6 +33,7 @@ import java.util.List; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.query.BaseTest; import org.apache.phoenix.schema.PTableKey; import org.apache.phoenix.schema.TableNotFoundException; @@ -352,7 +352,7 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } @Test -public void testSettingUseStatsForQueryPlanProperty() throws Exception { +public void testSettingUseStatsForParallelizationProperty() throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { String table = generateUniqueName(); String ddl = @@ -360,20 +360,31 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR) USE_STATS_FOR_PARALLELIZATION = false"; conn.createStatement().execute(ddl); assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), false); + ddl = "ALTER TABLE " + table + " SET USE_STATS_FOR_PARALLELIZATION = true"; conn.createStatement().execute(ddl); assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), true); + +table = generateUniqueName(); +ddl = +"CREATE TABLE " + table ++ " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR) USE_STATS_FOR_PARALLELIZATION = false"; +conn.createStatement().execute(ddl); +assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), false); + table = generateUniqueName(); ddl = "CREATE TABLE " + table + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR)"; conn.createStatement().execute(ddl); -assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), -DEFAULT_USE_STATS_FOR_PARALLELIZATION); + +// because we didn't set the property, PTable.useStatsForParallelization() should return +// null +assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), null); } } private static void assertUseStatsForQueryFlag(String tableName, PhoenixConnection conn, -boolean flag) throws TableNotFoundException, SQLException { -assertEquals(flag, +Boolean expected) throws TableNotFoundException, SQLExcepti
phoenix git commit: PHOENIX-4287 Addendum to correctly set useStatsForParallelization property
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-0.98 f2bf8854c -> 5c20b9d93 PHOENIX-4287 Addendum to correctly set useStatsForParallelization property Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5c20b9d9 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5c20b9d9 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5c20b9d9 Branch: refs/heads/4.12-HBase-0.98 Commit: 5c20b9d93ced99efdb26560b89729d3d37ee4212 Parents: f2bf885 Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 21:16:56 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 21:16:56 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 87 +--- .../coprocessor/MetaDataEndpointImpl.java | 2 +- .../phoenix/iterate/BaseResultIterators.java| 9 +- .../apache/phoenix/schema/DelegateTable.java| 2 +- .../apache/phoenix/schema/MetaDataClient.java | 26 +++--- .../java/org/apache/phoenix/schema/PTable.java | 2 +- .../org/apache/phoenix/schema/PTableImpl.java | 22 ++--- 7 files changed, 110 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5c20b9d9/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 520546e..3cd1d12 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -17,7 +17,6 @@ */ package org.apache.phoenix.end2end; -import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -34,6 +33,7 @@ import java.util.List; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.query.BaseTest; import org.apache.phoenix.schema.PTableKey; import org.apache.phoenix.schema.TableNotFoundException; @@ -352,7 +352,7 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } @Test -public void testSettingUseStatsForQueryPlanProperty() throws Exception { +public void testSettingUseStatsForParallelizationProperty() throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { String table = generateUniqueName(); String ddl = @@ -360,20 +360,31 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR) USE_STATS_FOR_PARALLELIZATION = false"; conn.createStatement().execute(ddl); assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), false); + ddl = "ALTER TABLE " + table + " SET USE_STATS_FOR_PARALLELIZATION = true"; conn.createStatement().execute(ddl); assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), true); + +table = generateUniqueName(); +ddl = +"CREATE TABLE " + table ++ " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR) USE_STATS_FOR_PARALLELIZATION = false"; +conn.createStatement().execute(ddl); +assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), false); + table = generateUniqueName(); ddl = "CREATE TABLE " + table + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR)"; conn.createStatement().execute(ddl); -assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), -DEFAULT_USE_STATS_FOR_PARALLELIZATION); + +// because we didn't set the property, PTable.useStatsForParallelization() should return +// null +assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), null); } } private static void assertUseStatsForQueryFlag(String tableName, PhoenixConnection conn, -boolean flag) throws TableNotFoundException, SQLException { -assertEquals(flag, +Boolean expected) throws TableNotFoundException, SQLExcepti
phoenix git commit: PHOENIX-4287 Addendum to correctly set useStatsForParallelization property
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 2c00e3fff -> e485a5897 PHOENIX-4287 Addendum to correctly set useStatsForParallelization property Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e485a589 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e485a589 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e485a589 Branch: refs/heads/4.x-HBase-0.98 Commit: e485a589795813f24fae7e230c4500ebebb5eec5 Parents: 2c00e3f Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 21:16:26 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 21:16:26 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 87 +--- .../coprocessor/MetaDataEndpointImpl.java | 2 +- .../phoenix/iterate/BaseResultIterators.java| 9 +- .../apache/phoenix/schema/DelegateTable.java| 2 +- .../apache/phoenix/schema/MetaDataClient.java | 26 +++--- .../java/org/apache/phoenix/schema/PTable.java | 2 +- .../org/apache/phoenix/schema/PTableImpl.java | 22 ++--- 7 files changed, 110 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e485a589/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 520546e..3cd1d12 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -17,7 +17,6 @@ */ package org.apache.phoenix.end2end; -import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -34,6 +33,7 @@ import java.util.List; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.query.BaseTest; import org.apache.phoenix.schema.PTableKey; import org.apache.phoenix.schema.TableNotFoundException; @@ -352,7 +352,7 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } @Test -public void testSettingUseStatsForQueryPlanProperty() throws Exception { +public void testSettingUseStatsForParallelizationProperty() throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { String table = generateUniqueName(); String ddl = @@ -360,20 +360,31 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR) USE_STATS_FOR_PARALLELIZATION = false"; conn.createStatement().execute(ddl); assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), false); + ddl = "ALTER TABLE " + table + " SET USE_STATS_FOR_PARALLELIZATION = true"; conn.createStatement().execute(ddl); assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), true); + +table = generateUniqueName(); +ddl = +"CREATE TABLE " + table ++ " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR) USE_STATS_FOR_PARALLELIZATION = false"; +conn.createStatement().execute(ddl); +assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), false); + table = generateUniqueName(); ddl = "CREATE TABLE " + table + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR)"; conn.createStatement().execute(ddl); -assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), -DEFAULT_USE_STATS_FOR_PARALLELIZATION); + +// because we didn't set the property, PTable.useStatsForParallelization() should return +// null +assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), null); } } private static void assertUseStatsForQueryFlag(String tableName, PhoenixConnection conn, -boolean flag) throws TableNotFoundException, SQLException { -assertEquals(flag, +Boolean expected) throws TableNotFoundException, SQLExcepti
phoenix git commit: PHOENIX-4287 Addendum to correctly set useStatsForParallelization property
Repository: phoenix Updated Branches: refs/heads/master dc9c2fa8f -> 82364f6b3 PHOENIX-4287 Addendum to correctly set useStatsForParallelization property Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/82364f6b Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/82364f6b Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/82364f6b Branch: refs/heads/master Commit: 82364f6b3083d309f2035f1fd6d132a77ecef71a Parents: dc9c2fa Author: Samarth Jain <sama...@apache.org> Authored: Wed Nov 1 21:13:40 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Nov 1 21:13:40 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 87 +--- .../coprocessor/MetaDataEndpointImpl.java | 2 +- .../phoenix/iterate/BaseResultIterators.java| 9 +- .../apache/phoenix/schema/DelegateTable.java| 2 +- .../apache/phoenix/schema/MetaDataClient.java | 26 +++--- .../java/org/apache/phoenix/schema/PTable.java | 2 +- .../org/apache/phoenix/schema/PTableImpl.java | 22 ++--- 7 files changed, 110 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/82364f6b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 25d4194..b5e4588 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -17,7 +17,6 @@ */ package org.apache.phoenix.end2end; -import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -34,6 +33,7 @@ import java.util.List; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.query.BaseTest; import org.apache.phoenix.schema.PTableKey; import org.apache.phoenix.schema.TableNotFoundException; @@ -352,7 +352,7 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } @Test -public void testSettingUseStatsForQueryPlanProperty() throws Exception { +public void testSettingUseStatsForParallelizationProperty() throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { String table = generateUniqueName(); String ddl = @@ -360,20 +360,31 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR) USE_STATS_FOR_PARALLELIZATION = false"; conn.createStatement().execute(ddl); assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), false); + ddl = "ALTER TABLE " + table + " SET USE_STATS_FOR_PARALLELIZATION = true"; conn.createStatement().execute(ddl); assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), true); + +table = generateUniqueName(); +ddl = +"CREATE TABLE " + table ++ " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR) USE_STATS_FOR_PARALLELIZATION = false"; +conn.createStatement().execute(ddl); +assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), false); + table = generateUniqueName(); ddl = "CREATE TABLE " + table + " (PK1 INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR)"; conn.createStatement().execute(ddl); -assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), -DEFAULT_USE_STATS_FOR_PARALLELIZATION); + +// because we didn't set the property, PTable.useStatsForParallelization() should return +// null +assertUseStatsForQueryFlag(table, conn.unwrap(PhoenixConnection.class), null); } } private static void assertUseStatsForQueryFlag(String tableName, PhoenixConnection conn, -boolean flag) throws TableNotFoundException, SQLException { -assertEquals(flag, +Boolean expected) throws TableNotFoundException, SQLException { +asse
phoenix git commit: PHOENIX-4333 Test to demonstrate partial stats information for tenant views
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.3 4af302207 -> 4f42ef787 PHOENIX-4333 Test to demonstrate partial stats information for tenant views Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4f42ef78 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4f42ef78 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4f42ef78 Branch: refs/heads/4.12-HBase-1.3 Commit: 4f42ef787f4a8fd3f209b095fa26924f76c18784 Parents: 4af3022 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 14:23:07 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 14:23:07 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 95 1 file changed, 95 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4f42ef78/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 931c398..25d4194 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -31,6 +31,7 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; +import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.query.BaseTest; @@ -782,4 +783,98 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { this.time += t; } } + +@Test +public void testPartialStatsForTenantViews() throws Exception { +String tenant1View = generateUniqueName(); +String tenant2View = generateUniqueName(); +String multiTenantTable = generateUniqueName(); +String tenantId1 = "00Dabcdetenant1"; +String tenantId2 = "00Dabcdetenant2"; + +String ddl = +"CREATE TABLE " + multiTenantTable ++ " (orgId CHAR(15) NOT NULL, pk2 CHAR(3) NOT NULL, a bigint, b bigint CONSTRAINT PK PRIMARY KEY " ++ "(ORGID, PK2)) MULTI_TENANT=true, GUIDE_POSTS_WIDTH=20"; +createTestTable(getUrl(), ddl, null, null); +try (Connection conn = DriverManager.getConnection(getUrl())) { +// split such that some data for view2 resides on region of view1 +try (HBaseAdmin admin = + conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) { +byte[] splitKey = Bytes.toBytes("00Dabcdetenant200B"); +admin.split(Bytes.toBytes(multiTenantTable), splitKey); +} + +/** + * Insert 2 rows for tenant1 and 6 for tenant2 + */ +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId1 + "','00A',1,1)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId1 + "','00B',2,2)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00A',3,3)"); +// We split at tenant2 + 00B. So the following rows will reside in a different region +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00B',4,4)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00C',5,5)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00D',6,6)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00E',7,7)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00F',8,8)"); +conn.commit(); +} +try (Connection conn = getTenantConnection(tenantId1)) { +conn.createStatement().execute( +"CREATE VIEW " + t
phoenix git commit: PHOENIX-4333 Test to demonstrate partial stats information for tenant views
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.2 d83364127 -> 1844747f5 PHOENIX-4333 Test to demonstrate partial stats information for tenant views Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/1844747f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/1844747f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/1844747f Branch: refs/heads/4.12-HBase-1.2 Commit: 1844747f5a1216d93320c837177862f521c9a327 Parents: d833641 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 14:22:49 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 14:22:49 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 96 1 file changed, 96 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/1844747f/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 2d25980..25d4194 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -31,8 +31,10 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; +import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.query.BaseTest; import org.apache.phoenix.schema.PTableKey; import org.apache.phoenix.schema.TableNotFoundException; import org.apache.phoenix.util.EnvironmentEdge; @@ -781,4 +783,98 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { this.time += t; } } + +@Test +public void testPartialStatsForTenantViews() throws Exception { +String tenant1View = generateUniqueName(); +String tenant2View = generateUniqueName(); +String multiTenantTable = generateUniqueName(); +String tenantId1 = "00Dabcdetenant1"; +String tenantId2 = "00Dabcdetenant2"; + +String ddl = +"CREATE TABLE " + multiTenantTable ++ " (orgId CHAR(15) NOT NULL, pk2 CHAR(3) NOT NULL, a bigint, b bigint CONSTRAINT PK PRIMARY KEY " ++ "(ORGID, PK2)) MULTI_TENANT=true, GUIDE_POSTS_WIDTH=20"; +createTestTable(getUrl(), ddl, null, null); +try (Connection conn = DriverManager.getConnection(getUrl())) { +// split such that some data for view2 resides on region of view1 +try (HBaseAdmin admin = + conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) { +byte[] splitKey = Bytes.toBytes("00Dabcdetenant200B"); +admin.split(Bytes.toBytes(multiTenantTable), splitKey); +} + +/** + * Insert 2 rows for tenant1 and 6 for tenant2 + */ +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId1 + "','00A',1,1)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId1 + "','00B',2,2)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00A',3,3)"); +// We split at tenant2 + 00B. So the following rows will reside in a different region +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00B',4,4)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00C',5,5)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00D',6,6)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00E',7,7)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00F',8,8)"); +conn.commit(); +
phoenix git commit: PHOENIX-4333 Test to demonstrate partial stats information for tenant views
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-0.98 17368fd16 -> f2bf8854c PHOENIX-4333 Test to demonstrate partial stats information for tenant views Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f2bf8854 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f2bf8854 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f2bf8854 Branch: refs/heads/4.12-HBase-0.98 Commit: f2bf8854ceebade9eb8bdf93408d77e589e7dbb2 Parents: 17368fd Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 14:19:02 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 14:19:02 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 95 1 file changed, 95 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/f2bf8854/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 533ff8b..520546e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -31,6 +31,7 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; +import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.query.BaseTest; @@ -782,4 +783,98 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { this.time += t; } } + +@Test +public void testPartialStatsForTenantViews() throws Exception { +String tenant1View = generateUniqueName(); +String tenant2View = generateUniqueName(); +String multiTenantTable = generateUniqueName(); +String tenantId1 = "00Dabcdetenant1"; +String tenantId2 = "00Dabcdetenant2"; + +String ddl = +"CREATE TABLE " + multiTenantTable ++ " (orgId CHAR(15) NOT NULL, pk2 CHAR(3) NOT NULL, a bigint, b bigint CONSTRAINT PK PRIMARY KEY " ++ "(ORGID, PK2)) MULTI_TENANT=true, GUIDE_POSTS_WIDTH=20"; +createTestTable(getUrl(), ddl, null, null); +try (Connection conn = DriverManager.getConnection(getUrl())) { +// split such that some data for view2 resides on region of view1 +try (HBaseAdmin admin = + conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) { +byte[] splitKey = Bytes.toBytes("00Dabcdetenant200B"); +admin.split(Bytes.toBytes(multiTenantTable), splitKey); +} + +/** + * Insert 2 rows for tenant1 and 6 for tenant2 + */ +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId1 + "','00A',1,1)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId1 + "','00B',2,2)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00A',3,3)"); +// We split at tenant2 + 00B. So the following rows will reside in a different region +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00B',4,4)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00C',5,5)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00D',6,6)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00E',7,7)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00F',8,8)"); +conn.commit(); +} +try (Connection conn = getTenantConnection(tenantId1)) { +conn.createStatement().execute( +"CREATE VIEW " + t
phoenix git commit: PHOENIX-4333 Test to demonstrate partial stats information for tenant views
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.1 d75b4d374 -> 9e9fce067 PHOENIX-4333 Test to demonstrate partial stats information for tenant views Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/9e9fce06 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/9e9fce06 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/9e9fce06 Branch: refs/heads/4.12-HBase-1.1 Commit: 9e9fce0677165468692f08ae1e539c00e2ae894f Parents: d75b4d3 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 14:19:22 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 14:19:22 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 95 1 file changed, 95 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/9e9fce06/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 931c398..25d4194 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -31,6 +31,7 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; +import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.query.BaseTest; @@ -782,4 +783,98 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { this.time += t; } } + +@Test +public void testPartialStatsForTenantViews() throws Exception { +String tenant1View = generateUniqueName(); +String tenant2View = generateUniqueName(); +String multiTenantTable = generateUniqueName(); +String tenantId1 = "00Dabcdetenant1"; +String tenantId2 = "00Dabcdetenant2"; + +String ddl = +"CREATE TABLE " + multiTenantTable ++ " (orgId CHAR(15) NOT NULL, pk2 CHAR(3) NOT NULL, a bigint, b bigint CONSTRAINT PK PRIMARY KEY " ++ "(ORGID, PK2)) MULTI_TENANT=true, GUIDE_POSTS_WIDTH=20"; +createTestTable(getUrl(), ddl, null, null); +try (Connection conn = DriverManager.getConnection(getUrl())) { +// split such that some data for view2 resides on region of view1 +try (HBaseAdmin admin = + conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) { +byte[] splitKey = Bytes.toBytes("00Dabcdetenant200B"); +admin.split(Bytes.toBytes(multiTenantTable), splitKey); +} + +/** + * Insert 2 rows for tenant1 and 6 for tenant2 + */ +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId1 + "','00A',1,1)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId1 + "','00B',2,2)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00A',3,3)"); +// We split at tenant2 + 00B. So the following rows will reside in a different region +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00B',4,4)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00C',5,5)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00D',6,6)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00E',7,7)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00F',8,8)"); +conn.commit(); +} +try (Connection conn = getTenantConnection(tenantId1)) { +conn.createStatement().execute( +"CREATE VIEW " + t
phoenix git commit: PHOENIX-4333 Test to demonstrate partial stats information for tenant views
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 cb1087a99 -> 848329127 PHOENIX-4333 Test to demonstrate partial stats information for tenant views Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/84832912 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/84832912 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/84832912 Branch: refs/heads/4.x-HBase-0.98 Commit: 848329127e9832968a7fad5faba318f74bccce91 Parents: cb1087a Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 14:15:16 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 14:15:16 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 95 1 file changed, 95 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/84832912/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 533ff8b..520546e 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -31,6 +31,7 @@ import java.sql.SQLException; import java.util.Collections; import java.util.List; +import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.query.BaseTest; @@ -782,4 +783,98 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { this.time += t; } } + +@Test +public void testPartialStatsForTenantViews() throws Exception { +String tenant1View = generateUniqueName(); +String tenant2View = generateUniqueName(); +String multiTenantTable = generateUniqueName(); +String tenantId1 = "00Dabcdetenant1"; +String tenantId2 = "00Dabcdetenant2"; + +String ddl = +"CREATE TABLE " + multiTenantTable ++ " (orgId CHAR(15) NOT NULL, pk2 CHAR(3) NOT NULL, a bigint, b bigint CONSTRAINT PK PRIMARY KEY " ++ "(ORGID, PK2)) MULTI_TENANT=true, GUIDE_POSTS_WIDTH=20"; +createTestTable(getUrl(), ddl, null, null); +try (Connection conn = DriverManager.getConnection(getUrl())) { +// split such that some data for view2 resides on region of view1 +try (HBaseAdmin admin = + conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) { +byte[] splitKey = Bytes.toBytes("00Dabcdetenant200B"); +admin.split(Bytes.toBytes(multiTenantTable), splitKey); +} + +/** + * Insert 2 rows for tenant1 and 6 for tenant2 + */ +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId1 + "','00A',1,1)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId1 + "','00B',2,2)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00A',3,3)"); +// We split at tenant2 + 00B. So the following rows will reside in a different region +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00B',4,4)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00C',5,5)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00D',6,6)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00E',7,7)"); +conn.createStatement().execute( +"upsert into " + multiTenantTable + " values ('" + tenantId2 + "','00F',8,8)"); +conn.commit(); +} +try (Connection conn = getTenantConnection(tenantId1)) { +conn.createStatement().execute( +"CREATE VIEW " + t
phoenix git commit: PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.3 cc5103750 -> 4af302207 PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4af30220 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4af30220 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4af30220 Branch: refs/heads/4.12-HBase-1.3 Commit: 4af302207bf9d4e7a3739d6f006062d7f54ee840 Parents: cc51037 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 10:14:44 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 10:14:44 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 209 ++- .../phoenix/iterate/BaseResultIterators.java| 55 +++-- 2 files changed, 246 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4af30220/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 62538af..931c398 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.sql.Connection; @@ -387,11 +388,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { @Test public void testBytesRowsForSelectOnTenantViews() throws Exception { String tenant1View = generateUniqueName(); -; String tenant2View = generateUniqueName(); -; String tenant3View = generateUniqueName(); -; String multiTenantBaseTable = generateUniqueName(); String tenant1 = "tenant1"; String tenant2 = "tenant2"; @@ -504,6 +502,211 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } } +@Test // See https://issues.apache.org/jira/browse/PHOENIX-4287 +public void testEstimatesForAggregateQueries() throws Exception { +String tableName = generateUniqueName(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + tableName + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth ++ ", USE_STATS_FOR_PARALLELIZATION=false"; +byte[][] splits = +new byte[][] { Bytes.toBytes(102), Bytes.toBytes(105), Bytes.toBytes(108) }; +BaseTest.createTestTable(getUrl(), ddl, splits, null); +conn.createStatement().execute("upsert into " + tableName + " values (100,1,3)"); +conn.createStatement().execute("upsert into " + tableName + " values (101,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (102,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (103,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (104,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (105,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (106,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (107,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (108,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (109,2,4)"); +conn.commit(); +conn.createStatement().execute("UPDATE STATISTICS " + tableName + ""); +} +List binds = Lists.newArrayList(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +String sql = &qu
phoenix git commit: PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.2 4765a8bf8 -> d83364127 PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d8336412 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d8336412 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d8336412 Branch: refs/heads/4.12-HBase-1.2 Commit: d833641276f5b160436a07952e7f0ecfb89b06dd Parents: 4765a8b Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 10:14:16 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 10:14:16 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 209 ++- .../phoenix/iterate/BaseResultIterators.java| 55 +++-- 2 files changed, 246 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d8336412/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index b4f9871..2d25980 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.sql.Connection; @@ -386,11 +387,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { @Test public void testBytesRowsForSelectOnTenantViews() throws Exception { String tenant1View = generateUniqueName(); -; String tenant2View = generateUniqueName(); -; String tenant3View = generateUniqueName(); -; String multiTenantBaseTable = generateUniqueName(); String tenant1 = "tenant1"; String tenant2 = "tenant2"; @@ -503,6 +501,211 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } } +@Test // See https://issues.apache.org/jira/browse/PHOENIX-4287 +public void testEstimatesForAggregateQueries() throws Exception { +String tableName = generateUniqueName(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + tableName + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth ++ ", USE_STATS_FOR_PARALLELIZATION=false"; +byte[][] splits = +new byte[][] { Bytes.toBytes(102), Bytes.toBytes(105), Bytes.toBytes(108) }; +BaseTest.createTestTable(getUrl(), ddl, splits, null); +conn.createStatement().execute("upsert into " + tableName + " values (100,1,3)"); +conn.createStatement().execute("upsert into " + tableName + " values (101,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (102,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (103,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (104,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (105,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (106,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (107,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (108,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (109,2,4)"); +conn.commit(); +conn.createStatement().execute("UPDATE STATISTICS " + tableName + ""); +} +List binds = Lists.newArrayList(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +String sql = &qu
phoenix git commit: PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.1 5b557d616 -> d75b4d374 PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d75b4d37 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d75b4d37 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d75b4d37 Branch: refs/heads/4.12-HBase-1.1 Commit: d75b4d37422cb1abe81b7770c5000a1719f24100 Parents: 5b557d6 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 10:14:01 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 10:14:01 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 209 ++- .../phoenix/iterate/BaseResultIterators.java| 55 +++-- 2 files changed, 246 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d75b4d37/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 62538af..931c398 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.sql.Connection; @@ -387,11 +388,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { @Test public void testBytesRowsForSelectOnTenantViews() throws Exception { String tenant1View = generateUniqueName(); -; String tenant2View = generateUniqueName(); -; String tenant3View = generateUniqueName(); -; String multiTenantBaseTable = generateUniqueName(); String tenant1 = "tenant1"; String tenant2 = "tenant2"; @@ -504,6 +502,211 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } } +@Test // See https://issues.apache.org/jira/browse/PHOENIX-4287 +public void testEstimatesForAggregateQueries() throws Exception { +String tableName = generateUniqueName(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + tableName + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth ++ ", USE_STATS_FOR_PARALLELIZATION=false"; +byte[][] splits = +new byte[][] { Bytes.toBytes(102), Bytes.toBytes(105), Bytes.toBytes(108) }; +BaseTest.createTestTable(getUrl(), ddl, splits, null); +conn.createStatement().execute("upsert into " + tableName + " values (100,1,3)"); +conn.createStatement().execute("upsert into " + tableName + " values (101,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (102,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (103,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (104,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (105,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (106,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (107,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (108,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (109,2,4)"); +conn.commit(); +conn.createStatement().execute("UPDATE STATISTICS " + tableName + ""); +} +List binds = Lists.newArrayList(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +String sql = &qu
phoenix git commit: PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-0.98 edafeb817 -> 17368fd16 PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/17368fd1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/17368fd1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/17368fd1 Branch: refs/heads/4.12-HBase-0.98 Commit: 17368fd1613b44ab71803e7b8a03eeb03da06937 Parents: edafeb8 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 10:13:33 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 10:13:33 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 209 ++- .../phoenix/iterate/BaseResultIterators.java| 55 +++-- 2 files changed, 246 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/17368fd1/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 4e59967..533ff8b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.sql.Connection; @@ -387,11 +388,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { @Test public void testBytesRowsForSelectOnTenantViews() throws Exception { String tenant1View = generateUniqueName(); -; String tenant2View = generateUniqueName(); -; String tenant3View = generateUniqueName(); -; String multiTenantBaseTable = generateUniqueName(); String tenant1 = "tenant1"; String tenant2 = "tenant2"; @@ -504,6 +502,211 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } } +@Test // See https://issues.apache.org/jira/browse/PHOENIX-4287 +public void testEstimatesForAggregateQueries() throws Exception { +String tableName = generateUniqueName(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + tableName + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth ++ ", USE_STATS_FOR_PARALLELIZATION=false"; +byte[][] splits = +new byte[][] { Bytes.toBytes(102), Bytes.toBytes(105), Bytes.toBytes(108) }; +BaseTest.createTestTable(getUrl(), ddl, splits, null); +conn.createStatement().execute("upsert into " + tableName + " values (100,1,3)"); +conn.createStatement().execute("upsert into " + tableName + " values (101,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (102,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (103,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (104,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (105,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (106,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (107,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (108,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (109,2,4)"); +conn.commit(); +conn.createStatement().execute("UPDATE STATISTICS " + tableName + ""); +} +List binds = Lists.newArrayList(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +String sql = &qu
phoenix git commit: PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 38db82042 -> cb1087a99 PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cb1087a9 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cb1087a9 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cb1087a9 Branch: refs/heads/4.x-HBase-0.98 Commit: cb1087a9913465c0676cc7debbfde77266b59f4c Parents: 38db820 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 10:13:01 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 10:13:01 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 209 ++- .../phoenix/iterate/BaseResultIterators.java| 55 +++-- 2 files changed, 246 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cb1087a9/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 4e59967..533ff8b 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.sql.Connection; @@ -387,11 +388,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { @Test public void testBytesRowsForSelectOnTenantViews() throws Exception { String tenant1View = generateUniqueName(); -; String tenant2View = generateUniqueName(); -; String tenant3View = generateUniqueName(); -; String multiTenantBaseTable = generateUniqueName(); String tenant1 = "tenant1"; String tenant2 = "tenant2"; @@ -504,6 +502,211 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } } +@Test // See https://issues.apache.org/jira/browse/PHOENIX-4287 +public void testEstimatesForAggregateQueries() throws Exception { +String tableName = generateUniqueName(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + tableName + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth ++ ", USE_STATS_FOR_PARALLELIZATION=false"; +byte[][] splits = +new byte[][] { Bytes.toBytes(102), Bytes.toBytes(105), Bytes.toBytes(108) }; +BaseTest.createTestTable(getUrl(), ddl, splits, null); +conn.createStatement().execute("upsert into " + tableName + " values (100,1,3)"); +conn.createStatement().execute("upsert into " + tableName + " values (101,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (102,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (103,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (104,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (105,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (106,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (107,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (108,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (109,2,4)"); +conn.commit(); +conn.createStatement().execute("UPDATE STATISTICS " + tableName + ""); +} +List binds = Lists.newArrayList(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +String sql = &qu
phoenix git commit: PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization
Repository: phoenix Updated Branches: refs/heads/master 54a8f2730 -> 97fe4f8aa PHOENIX-4287 Incorrect aggregate query results when stats are disable for parallelization Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/97fe4f8a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/97fe4f8a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/97fe4f8a Branch: refs/heads/master Commit: 97fe4f8aa24d2b0cdf9d1418252b4d69cfb6e7a1 Parents: 54a8f27 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 31 10:12:22 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 31 10:12:32 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 209 ++- .../phoenix/iterate/BaseResultIterators.java| 55 +++-- 2 files changed, 246 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/97fe4f8a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index 62538af..931c398 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -20,6 +20,7 @@ package org.apache.phoenix.end2end; import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_USE_STATS_FOR_PARALLELIZATION; import static org.apache.phoenix.util.PhoenixRuntime.TENANT_ID_ATTRIB; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.sql.Connection; @@ -387,11 +388,8 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { @Test public void testBytesRowsForSelectOnTenantViews() throws Exception { String tenant1View = generateUniqueName(); -; String tenant2View = generateUniqueName(); -; String tenant3View = generateUniqueName(); -; String multiTenantBaseTable = generateUniqueName(); String tenant1 = "tenant1"; String tenant2 = "tenant2"; @@ -504,6 +502,211 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { } } +@Test // See https://issues.apache.org/jira/browse/PHOENIX-4287 +public void testEstimatesForAggregateQueries() throws Exception { +String tableName = generateUniqueName(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +int guidePostWidth = 20; +String ddl = +"CREATE TABLE " + tableName + " (k INTEGER PRIMARY KEY, a bigint, b bigint)" ++ " GUIDE_POSTS_WIDTH=" + guidePostWidth ++ ", USE_STATS_FOR_PARALLELIZATION=false"; +byte[][] splits = +new byte[][] { Bytes.toBytes(102), Bytes.toBytes(105), Bytes.toBytes(108) }; +BaseTest.createTestTable(getUrl(), ddl, splits, null); +conn.createStatement().execute("upsert into " + tableName + " values (100,1,3)"); +conn.createStatement().execute("upsert into " + tableName + " values (101,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (102,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (103,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (104,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (105,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (106,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (107,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (108,2,4)"); +conn.createStatement().execute("upsert into " + tableName + " values (109,2,4)"); +conn.commit(); +conn.createStatement().execute("UPDATE STATISTICS " + tableName + ""); +} +List binds = Lists.newArrayList(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +String sql = &qu
phoenix git commit: PHOENIX-4289 UPDATE STATISTICS command does not collect stats for local indexes
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.2 e90daafda -> 4765a8bf8 PHOENIX-4289 UPDATE STATISTICS command does not collect stats for local indexes Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/4765a8bf Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4765a8bf Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4765a8bf Branch: refs/heads/4.12-HBase-1.2 Commit: 4765a8bf8915787b15de6c03f6f16f7732efa9ce Parents: e90daaf Author: Samarth Jain <sama...@apache.org> Authored: Sun Oct 29 23:08:39 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Sun Oct 29 23:08:39 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 12 ++ .../phoenix/end2end/index/BaseLocalIndexIT.java | 1 + .../phoenix/end2end/index/LocalIndexIT.java | 46 ++- .../parse/UpdateStatisticsStatement.java| 4 + .../apache/phoenix/schema/MetaDataClient.java | 125 +++ 5 files changed, 138 insertions(+), 50 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/4765a8bf/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index cd4555c..b4f9871 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -306,6 +306,18 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { final Long estimatedRows; final Long estimateInfoTs; +public Long getEstimatedBytes() { +return estimatedBytes; +} + +public Long getEstimatedRows() { +return estimatedRows; +} + +public Long getEstimateInfoTs() { +return estimateInfoTs; +} + Estimate(Long rows, Long bytes, Long ts) { this.estimatedBytes = bytes; this.estimatedRows = rows; http://git-wip-us.apache.org/repos/asf/phoenix/blob/4765a8bf/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java index 30baec4..4f58ead 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java @@ -59,6 +59,7 @@ public abstract class BaseLocalIndexIT extends BaseUniqueNamesOwnClusterIT { serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1); clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); +clientProps.put(QueryServices.MIN_STATS_UPDATE_FREQ_MS_ATTRIB, "12"); setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator())); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/4765a8bf/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java index 48221ab..0dcf1d5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java @@ -17,6 +17,7 @@ */ package org.apache.phoenix.end2end.index; +import static org.apache.phoenix.end2end.ExplainPlanWithStatsEnabledIT.getByteRowEstimates; import static org.apache.phoenix.util.MetaDataUtil.getViewIndexSequenceName; import static org.apache.phoenix.util.MetaDataUtil.getViewIndexSequenceSchemaName; import static org.junit.Assert.assertArrayEquals; @@ -55,8 +56,10 @@ import org.apache.hadoop.hbase.util.FSUtils; import org.apache.hadoop.hbase.util.Pair; import org.apache.phoenix.compile.QueryPlan; import org.apache.phoenix.coprocessor.BaseScannerRegionObserver; +import org.apache.phoenix.end2end.ExplainPlanWithStatsEnabledIT.Estimate; import org.apache.phoenix.hbase.index.IndexRegionSplitPolicy; import org.apache.phoenix.jdbc.PhoenixConnection; +impor
phoenix git commit: PHOENIX-4289 UPDATE STATISTICS command does not collect stats for local indexes
Repository: phoenix Updated Branches: refs/heads/4.12-HBase-1.3 b51b67403 -> cc5103750 PHOENIX-4289 UPDATE STATISTICS command does not collect stats for local indexes Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cc510375 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cc510375 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cc510375 Branch: refs/heads/4.12-HBase-1.3 Commit: cc5103750103ea6b37f06fb7526638a16a957aa8 Parents: b51b674 Author: Samarth Jain <sama...@apache.org> Authored: Sun Oct 29 23:07:27 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Sun Oct 29 23:07:27 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 13 .../phoenix/end2end/index/BaseLocalIndexIT.java | 3 + .../phoenix/end2end/index/LocalIndexIT.java | 46 ++- .../phoenix/iterate/BaseResultIterators.java| 4 +- .../apache/phoenix/schema/MetaDataClient.java | 80 +--- 5 files changed, 115 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc510375/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index cd4555c..62538af 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -32,6 +32,7 @@ import java.util.List; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.query.BaseTest; import org.apache.phoenix.schema.PTableKey; import org.apache.phoenix.schema.TableNotFoundException; import org.apache.phoenix.util.EnvironmentEdge; @@ -306,6 +307,18 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { final Long estimatedRows; final Long estimateInfoTs; +public Long getEstimatedBytes() { +return estimatedBytes; +} + +public Long getEstimatedRows() { +return estimatedRows; +} + +public Long getEstimateInfoTs() { +return estimateInfoTs; +} + Estimate(Long rows, Long bytes, Long ts) { this.estimatedBytes = bytes; this.estimatedRows = rows; http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc510375/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java index 30baec4..1659d73 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java @@ -59,6 +59,9 @@ public abstract class BaseLocalIndexIT extends BaseUniqueNamesOwnClusterIT { serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1); clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); +// setting update frequency to a large value to test out that we are +// generating stats for local indexes +clientProps.put(QueryServices.MIN_STATS_UPDATE_FREQ_MS_ATTRIB, "12"); setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator())); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/cc510375/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java index 48221ab..0dcf1d5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java @@ -17,6 +17,7 @@ */ package org.apache.phoenix.end2end.index; +import static org.apache.phoenix.end2end.ExplainPlanWithStatsEnabledIT.getByteRowEstimates; import static org.apache.phoenix.util.MetaDataUtil.getViewIndexSequenceName; import static org.apache.phoenix.util.MetaDataUtil.getViewIndexSequenceSchemaName
phoenix git commit: PHOENIX-4289 UPDATE STATISTICS command does not collect stats for local indexes
Repository: phoenix Updated Branches: refs/heads/master 82a4dd8f7 -> 60a9b099e PHOENIX-4289 UPDATE STATISTICS command does not collect stats for local indexes Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/60a9b099 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/60a9b099 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/60a9b099 Branch: refs/heads/master Commit: 60a9b099eccaf328fd796b93176d8ac665fe039c Parents: 82a4dd8 Author: Samarth Jain <sama...@apache.org> Authored: Sun Oct 29 22:59:03 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Sun Oct 29 22:59:03 2017 -0700 -- .../end2end/ExplainPlanWithStatsEnabledIT.java | 13 .../phoenix/end2end/index/BaseLocalIndexIT.java | 3 + .../phoenix/end2end/index/LocalIndexIT.java | 46 ++- .../phoenix/iterate/BaseResultIterators.java| 4 +- .../apache/phoenix/schema/MetaDataClient.java | 80 +--- 5 files changed, 115 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/60a9b099/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java index cd4555c..62538af 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExplainPlanWithStatsEnabledIT.java @@ -32,6 +32,7 @@ import java.util.List; import org.apache.hadoop.hbase.util.Bytes; import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.query.BaseTest; import org.apache.phoenix.schema.PTableKey; import org.apache.phoenix.schema.TableNotFoundException; import org.apache.phoenix.util.EnvironmentEdge; @@ -306,6 +307,18 @@ public class ExplainPlanWithStatsEnabledIT extends ParallelStatsEnabledIT { final Long estimatedRows; final Long estimateInfoTs; +public Long getEstimatedBytes() { +return estimatedBytes; +} + +public Long getEstimatedRows() { +return estimatedRows; +} + +public Long getEstimateInfoTs() { +return estimateInfoTs; +} + Estimate(Long rows, Long bytes, Long ts) { this.estimatedBytes = bytes; this.estimatedRows = rows; http://git-wip-us.apache.org/repos/asf/phoenix/blob/60a9b099/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java index 30baec4..1659d73 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/BaseLocalIndexIT.java @@ -59,6 +59,9 @@ public abstract class BaseLocalIndexIT extends BaseUniqueNamesOwnClusterIT { serverProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); Map<String, String> clientProps = Maps.newHashMapWithExpectedSize(1); clientProps.put(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); +// setting update frequency to a large value to test out that we are +// generating stats for local indexes +clientProps.put(QueryServices.MIN_STATS_UPDATE_FREQ_MS_ATTRIB, "12"); setUpTestDriver(new ReadOnlyProps(serverProps.entrySet().iterator()), new ReadOnlyProps(clientProps.entrySet().iterator())); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/60a9b099/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java index 48221ab..0dcf1d5 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java @@ -17,6 +17,7 @@ */ package org.apache.phoenix.end2end.index; +import static org.apache.phoenix.end2end.ExplainPlanWithStatsEnabledIT.getByteRowEstimates; import static org.apache.phoenix.util.MetaDataUtil.getViewIndexSequenceName; import static org.apache.phoenix.util.MetaDataUtil.getViewIndexSequenceSchemaName; import static
svn commit: r1813331 [4/4] - in /phoenix/site: publish/ publish/language/ source/src/site/markdown/
Modified: phoenix/site/publish/update_statistics.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/update_statistics.html?rev=1813331=1813330=1813331=diff == --- phoenix/site/publish/update_statistics.html (original) +++ phoenix/site/publish/update_statistics.html Wed Oct 25 18:16:48 2017 @@ -1,7 +1,7 @@ @@ -162,8 +162,9 @@ Statistics Collection -The UPDATE STATISTICS command updates the statistics collected on a table, to improve query performance. This command collects a set of keys per region per column family that are equal byte distanced from each other. These collected keys are called guideposts and they act as hints/guides to improve the parallelization of queries on a given target region. +The UPDATE STATISTICS command updates the statistics collected on a table. This command collects a set of keys per region per column family that are equal byte distanced from each other. These collected keys are called guideposts and they act as hints/guides to improve the parallelization of queries on a given target region. Statistics are also automatically collected during major compactions and region splits so manually running this command may not be necessary. +In 4.12, we have added a new configuration phoenix.use.stats.parallelization which controls whether statistical information on the data should be used to drive query parallelization (as described below). The default value of the configuration is true. Parallelization Phoenix breaks up queries into multiple scans and runs them in parallel to reduce latency. Parallelization in Phoenix is driven by the statistics related configuration parameters. Each chunk of data between guideposts will be run in parallel in a separate scan to improve query performance. The chunk size is determined by the GUIDE_POSTS_WIDTH table property (Phoenix 4.9 or above) or the global server-side phoenix.stats.guidepost.width parameter if the table property is not set. As the size of the chunks decrease, you’ll want to increase phoenix.query.queueSize as more work will be queued in that case. Note that at a minimum, separate scans will be run for each table region. Statistics in Phoenix provides a means of gaining intraregion parallelization. In addition to the guidepost width specification, the client-side phoenix.query.threadPoolSize and phoenix.query.queueSize parameters and the server-side hbase.regionserver.handler.count parameter have an impact on the amount of parallelization. @@ -469,7 +470,7 @@ Back to top - Copyright 2017 http://www.apache.org;>Apache Software Foundation. All Rights Reserved. + Copyright 2013-2017 http://www.apache.org;>Apache Software Foundation. All Rights Reserved. Modified: phoenix/site/source/src/site/markdown/columnencoding.md URL: http://svn.apache.org/viewvc/phoenix/site/source/src/site/markdown/columnencoding.md?rev=1813331=1813330=1813331=diff == --- phoenix/site/source/src/site/markdown/columnencoding.md (original) +++ phoenix/site/source/src/site/markdown/columnencoding.md Wed Oct 25 18:16:48 2017 @@ -79,6 +79,5 @@ COLUMN_ENCODED_BYTES = 1; When using SINGLE_CELL_ARRAY_WITH_OFFSETS encoding, one has to use a number based column mapping scheme. An attempt to use SINGLE_CELL_ARRAY_WITH_OFFSETS with COLUMN_ENCODED_BYTES = NONE will throw an error. - - - +###How to disable column mapping? +To disable column mapping across all new tables, you need to set phoenix.default.column.encoded.bytes.attrib to 0. One can also leave it on globally and have it disabled selectively for a table by setting the COLUMN_ENCODED_BYTES = 0 property in the create table statement. Modified: phoenix/site/source/src/site/markdown/tuning_guide.md URL: http://svn.apache.org/viewvc/phoenix/site/source/src/site/markdown/tuning_guide.md?rev=1813331=1813330=1813331=diff == --- phoenix/site/source/src/site/markdown/tuning_guide.md (original) +++ phoenix/site/source/src/site/markdown/tuning_guide.md Wed Oct 25 18:16:48 2017 @@ -275,6 +275,8 @@ http://phoenix.apache.org/language/index You can improve parallelization with the [UPDATE STATISTICS](https://phoenix.apache.org/update_statistics.html) command. This command subdivides each region by determining keys called *guideposts* that are equidistant from each other, then uses these guideposts to break up queries into multiple parallel scans. Statistics are turned on by default. With Phoenix 4.9, the user can set guidepost width for each table. Optimal guidepost width depends on a number of factors such as cluster size, cluster
svn commit: r1813331 [1/4] - in /phoenix/site: publish/ publish/language/ source/src/site/markdown/
Author: samarth Date: Wed Oct 25 18:16:48 2017 New Revision: 1813331 URL: http://svn.apache.org/viewvc?rev=1813331=rev Log: PHOENIX-4320 Update website pages with information on phoenix.use.stats.parallelization config Modified: phoenix/site/publish/columnencoding.html phoenix/site/publish/language/datatypes.html phoenix/site/publish/language/functions.html phoenix/site/publish/language/index.html phoenix/site/publish/tuning_guide.html phoenix/site/publish/update_statistics.html phoenix/site/source/src/site/markdown/columnencoding.md phoenix/site/source/src/site/markdown/tuning_guide.md phoenix/site/source/src/site/markdown/update_statistics.md Modified: phoenix/site/publish/columnencoding.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/columnencoding.html?rev=1813331=1813330=1813331=diff == --- phoenix/site/publish/columnencoding.html (original) +++ phoenix/site/publish/columnencoding.html Wed Oct 25 18:16:48 2017 @@ -1,7 +1,7 @@ @@ -287,6 +287,10 @@ COLUMN_ENCODED_BYTES = 1; When using SINGLE_CELL_ARRAY_WITH_OFFSETS encoding, one has to use a number based column mapping scheme. An attempt to use SINGLE_CELL_ARRAY_WITH_OFFSETS with COLUMN_ENCODED_BYTES = NONE will throw an error. + + How to disable column mapping? + To disable column mapping across all new tables, you need to set phoenix.default.column.encoded.bytes.attrib to 0. One can also leave it on globally and have it disabled selectively for a table by setting the COLUMN_ENCODED_BYTES = 0 property in the create table statement. + @@ -529,7 +533,7 @@ COLUMN_ENCODED_BYTES = 1; Back to top - Copyright 2017 http://www.apache.org;>Apache Software Foundation. All Rights Reserved. + Copyright 2013-2017 http://www.apache.org;>Apache Software Foundation. All Rights Reserved. Modified: phoenix/site/publish/language/datatypes.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/language/datatypes.html?rev=1813331=1813330=1813331=diff == --- phoenix/site/publish/language/datatypes.html (original) +++ phoenix/site/publish/language/datatypes.html Wed Oct 25 18:16:48 2017 @@ -1,7 +1,7 @@ @@ -161,579 +161,7 @@ Data Types - - - -Index - - - - - - -INTEGER Type - -UNSIGNED_INT Type - -BIGINT Type - -UNSIGNED_LONG Type - -TINYINT Type - -UNSIGNED_TINYINT Type - -SMALLINT Type - -UNSIGNED_SMALLINT Type - -FLOAT Type - - -UNSIGNED_FLOAT Type - -DOUBLE Type - -UNSIGNED_DOUBLE Type - -DECIMAL Type - -BOOLEAN Type - -TIME Type - -DATE Type - -TIMESTAMP Type - -UNSIGNED_TIME Type - - -UNSIGNED_DATE Type - -UNSIGNED_TIMESTAMP Type - -VARCHAR Type - -CHAR Type - -BINARY Type - -VARBINARY Type - -ARRAY - - - - - - -INTEGER Type - - -INTEGER - - -INTEGER - - - -Possible values: -2147483648 to 2147483647.Mapped to java.lang.Integer. The binary representation is a 4 byte integer with the sign bit flipped (so that negative values sorts before positive values). -Example: -INTEGER - -UNSIGNED_INT Type - - -UNSIGNED_INT - - -UNSIGNED_INT - - - -Possible values: 0 to 2147483647. Mapped to java.lang.Integer. The binary representation is a 4 byte integer, matching the HBase Bytes.toBytes(int) method. The purpose of this type is to map to existing HBase data that was serialized using this HBase utility method. If that is not the case, use the regular signed type instead. -Example: -UNSIGNED_INT - -BIGINT Type - - -BIGINT - - -BIGINT - - - -Possible values: -9223372036854775808 to 9223372036854775807. Mapped to java.lang.Long. The binary representation is an 8 byte long with the sign bit flipped (so that negative values sorts before positive values). -Example: -BIGINT - -UNSIGNED_LONG Type - - -UNSIGNED_LONG - - -UNSIGNED_LONG - - - -Possible values: 0 to 9223372036854775807. Mapped to java.lan
svn commit: r1813331 [2/4] - in /phoenix/site: publish/ publish/language/ source/src/site/markdown/
Modified: phoenix/site/publish/language/functions.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/language/functions.html?rev=1813331=1813330=1813331=diff == --- phoenix/site/publish/language/functions.html (original) +++ phoenix/site/publish/language/functions.html Wed Oct 25 18:16:48 2017 @@ -1,7 +1,7 @@ @@ -161,1864 +161,7 @@ Functions - - - -Aggregate Functions - - - - - - -AVG - -COUNT - -APPROX_COUNT_DISTINCT - -MAX - -MIN - -SUM - - -PERCENTILE_CONT - -PERCENTILE_DISC - -PERCENT_RANK - -FIRST_VALUE - -LAST_VALUE - -FIRST_VALUES - - -LAST_VALUES - -NTH_VALUE - -STDDEV_POP - -STDDEV_SAMP - - - - - -String Functions - - - - - - -SUBSTR - -INSTR - -TRIM - -LTRIM - -RTRIM - - -LPAD - -LENGTH - -REGEXP_SUBSTR - -REGEXP_REPLACE - -REGEXP_SPLIT - - -UPPER - -LOWER - -REVERSE - -TO_CHAR - - - - - -Time and Date Functions - - - - - - -TO_DATE - -TO_TIME - -TO_TIMESTAMP - -CURRENT_TIME - -CONVERT_TZ - -TIMEZONE_OFFSET - - -NOW - -YEAR - -MONTH - -WEEK - -DAYOFYEAR - -DAYOFMONTH - - -DAYOFWEEK - -HOUR - -MINUTE - -SECOND - - - - - -Numeric Functions - - - - - - -ROUND - -CEIL - - -FLOOR - -TRUNC - - -TO_NUMBER - -RAND - - - - - -Array Functions - - - - - - -ARRAY_ELEM - -ARRAY_LENGTH - -ARRAY_APPEND - - -ARRAY_PREPEND - -ARRAY_CAT - -ARRAY_FILL - - -ARRAY_TO_STRING - -ANY - -ALL - - - - - -Math Functions - - - - - - -SIGN - -ABS - -SQRT - - -CBRT - -EXP - -POWER - - -LN - -LOG - - - - - -Other Functions - - - - - - -MD5 - -INVERT - -ENCODE - -DECODE - - -COALESCE - -GET_BIT - -GET_BYTE - -OCTET_LENGTH - - -SET_BIT - -SET_BYTE - - - - - - - -AVG - - -AVG ( { numericTerm } ) - - -AVG ( numericTerm ) - - - -The average (mean) value. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. The returned value is of the same data type as the parameter. -Example: -AVG(X) - -COUNT - - -COUNT( [ DISTINCT ] { * | { term } } ) - - -COUNT (DISTINCT*term) - - - -The count of all row, or of the non-null values. This method returns a long. When DISTINCT is used, it counts only distinct values. If no rows are selected, the result is 0. Aggregates are only allowed in
svn commit: r1813331 [3/4] - in /phoenix/site: publish/ publish/language/ source/src/site/markdown/
Modified: phoenix/site/publish/language/index.html URL: http://svn.apache.org/viewvc/phoenix/site/publish/language/index.html?rev=1813331=1813330=1813331=diff == --- phoenix/site/publish/language/index.html (original) +++ phoenix/site/publish/language/index.html Wed Oct 25 18:16:48 2017 @@ -1,7 +1,7 @@ @@ -161,1632 +161,7 @@ Grammar - - - -Commands - - - - - - -SELECT - -UPSERT VALUES - -UPSERT SELECT - -DELETE - -DECLARE CURSOR - -OPEN CURSOR - -FETCH NEXT - -CLOSE - -CREATE TABLE - - -DROP TABLE - -CREATE FUNCTION - -DROP FUNCTION - -CREATE VIEW - -DROP VIEW - -CREATE SEQUENCE - -DROP SEQUENCE - -ALTER - -CREATE INDEX - - -DROP INDEX - -ALTER INDEX - -EXPLAIN - -UPDATE STATISTICS - -CREATE SCHEMA - -USE - -DROP SCHEMA - - - - - -Other Grammar - - - - - - -Constraint - -Options - -Hint - -Scan Hint - -Cache Hint - -Index Hint - -Small Hint - -Seek To Column Hint - -Join Hint - -Serial Hint - -Column Def - -Table Ref - -Sequence Ref - -Column Ref - -Select Expression - -Select Statement - -Split Point - -Table Spec - -Aliased Table Ref - - -Join Type - -Func Argument - -Class Name - -Jar Path - -Order - -Expression - -And Condition - -Boolean Condition - -Condition - -RHS Operand - -Operand - -Summand - -Factor - -Term - -Array Constructor - -Sequence - -Cast - -Row Value Constructor - -Bind Parameter - - -Value - -Case - -Case When - -Name - -Quoted Name - -Alias - -Null - -Data Type - -SQL Data Type - -HBase Data Type - -String - -Boolean - -Numeric - -Int - -Long - -Decimal - -Number - -Comments - - - - - - -SELECT - - -selectStatement [ { UNION ALL selectStatement [...] } ] -[ ORDER BY order [,...] ] [ LIMIT {bindParameter | number} ] -[ OFFSET {bindParameter | number} [ ROW | ROWS ] ] [ FETCH { FIRST | NEXT } {bindParameter | number} { ROW | ROWS } ONLY ] - - -selectStatementUNION ALL selectStatement...ORDER BY order, ...LIMITbindParameter< /td>numberOFFSETbindParameternumber< /td>ROWROWSFETCHFIRSTNEXTbindParameternumberROWROWSONLY - - - -Selects data from one or more tables. UNION ALL combines rows from multiple select statements. ORDER BY sorts the result based on the given expressions. LIMIT(or FETCH FIRST) limits the number of rows returned by the query with no limit applied if unspecified or specified as null or less than zero. The LIMIT(or FETCH FIRST) clause is executed after the ORDER BY clause to support top-N type queries. OFFSET clause skips that many rows before beginning to return rows. An
phoenix git commit: PHOENIX-4273 Don't run MutableIndexSplitIT tests till fixed
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 587b79b52 -> 82fab2233 PHOENIX-4273 Don't run MutableIndexSplitIT tests till fixed Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/82fab223 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/82fab223 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/82fab223 Branch: refs/heads/4.x-HBase-0.98 Commit: 82fab2233f266deb5623158f18bc3dee11615b3f Parents: 587b79b Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 14:48:42 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 14:48:42 2017 -0700 -- .../phoenix/end2end/index/MutableIndexSplitForwardScanIT.java | 3 ++- .../phoenix/end2end/index/MutableIndexSplitReverseScanIT.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/82fab223/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java index 75e2ae2..83320c2 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java @@ -19,7 +19,8 @@ package org.apache.phoenix.end2end.index; import org.junit.Test; -public class MutableIndexSplitForwardScanIT extends MutableIndexSplitIT { +//TODO: re-enable once PHOENIX-4273 is fixed +public abstract class MutableIndexSplitForwardScanIT extends MutableIndexSplitIT { public MutableIndexSplitForwardScanIT(boolean localIndex, boolean multiTenant) { super(localIndex, multiTenant); http://git-wip-us.apache.org/repos/asf/phoenix/blob/82fab223/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java index d7afb31..f57dfdd 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java @@ -19,7 +19,8 @@ package org.apache.phoenix.end2end.index; import org.junit.Test; -public class MutableIndexSplitReverseScanIT extends MutableIndexSplitIT { +//TODO: re-enable once PHOENIX-4273 is fixeds +public abstract class MutableIndexSplitReverseScanIT extends MutableIndexSplitIT { public MutableIndexSplitReverseScanIT(boolean localIndex, boolean multiTenant) { super(localIndex, multiTenant);
phoenix git commit: PHOENIX-4273 Don't run MutableIndexSplitIT tests till fixed
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 0b5ec9ab9 -> 940377dc4 PHOENIX-4273 Don't run MutableIndexSplitIT tests till fixed Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/940377dc Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/940377dc Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/940377dc Branch: refs/heads/4.x-HBase-1.1 Commit: 940377dc46ca8acee7ce0ed0c98590e883dd790d Parents: 0b5ec9a Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 14:48:14 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 14:48:14 2017 -0700 -- .../phoenix/end2end/index/MutableIndexSplitForwardScanIT.java | 3 ++- .../phoenix/end2end/index/MutableIndexSplitReverseScanIT.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/940377dc/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java index 75e2ae2..83320c2 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java @@ -19,7 +19,8 @@ package org.apache.phoenix.end2end.index; import org.junit.Test; -public class MutableIndexSplitForwardScanIT extends MutableIndexSplitIT { +//TODO: re-enable once PHOENIX-4273 is fixed +public abstract class MutableIndexSplitForwardScanIT extends MutableIndexSplitIT { public MutableIndexSplitForwardScanIT(boolean localIndex, boolean multiTenant) { super(localIndex, multiTenant); http://git-wip-us.apache.org/repos/asf/phoenix/blob/940377dc/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java index d7afb31..f57dfdd 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java @@ -19,7 +19,8 @@ package org.apache.phoenix.end2end.index; import org.junit.Test; -public class MutableIndexSplitReverseScanIT extends MutableIndexSplitIT { +//TODO: re-enable once PHOENIX-4273 is fixeds +public abstract class MutableIndexSplitReverseScanIT extends MutableIndexSplitIT { public MutableIndexSplitReverseScanIT(boolean localIndex, boolean multiTenant) { super(localIndex, multiTenant);
phoenix git commit: PHOENIX-4273 Don't run MutableIndexSplitIT tests till fixed
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 94d4716e3 -> af5716c1b PHOENIX-4273 Don't run MutableIndexSplitIT tests till fixed Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/af5716c1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/af5716c1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/af5716c1 Branch: refs/heads/4.x-HBase-1.2 Commit: af5716c1b3dbb3b8da6db8d210966f426225cf70 Parents: 94d4716 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 14:47:45 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 14:47:45 2017 -0700 -- .../phoenix/end2end/index/MutableIndexSplitForwardScanIT.java | 3 ++- .../phoenix/end2end/index/MutableIndexSplitReverseScanIT.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/af5716c1/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java index 75e2ae2..83320c2 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java @@ -19,7 +19,8 @@ package org.apache.phoenix.end2end.index; import org.junit.Test; -public class MutableIndexSplitForwardScanIT extends MutableIndexSplitIT { +//TODO: re-enable once PHOENIX-4273 is fixed +public abstract class MutableIndexSplitForwardScanIT extends MutableIndexSplitIT { public MutableIndexSplitForwardScanIT(boolean localIndex, boolean multiTenant) { super(localIndex, multiTenant); http://git-wip-us.apache.org/repos/asf/phoenix/blob/af5716c1/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java index d7afb31..f57dfdd 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java @@ -19,7 +19,8 @@ package org.apache.phoenix.end2end.index; import org.junit.Test; -public class MutableIndexSplitReverseScanIT extends MutableIndexSplitIT { +//TODO: re-enable once PHOENIX-4273 is fixeds +public abstract class MutableIndexSplitReverseScanIT extends MutableIndexSplitIT { public MutableIndexSplitReverseScanIT(boolean localIndex, boolean multiTenant) { super(localIndex, multiTenant);
phoenix git commit: PHOENIX-4273 Don't run MutableIndexSplitIT tests till fixed
Repository: phoenix Updated Branches: refs/heads/master 54e2bbf83 -> 68b5db54d PHOENIX-4273 Don't run MutableIndexSplitIT tests till fixed Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/68b5db54 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/68b5db54 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/68b5db54 Branch: refs/heads/master Commit: 68b5db54d6dd79d521cf29dd84cef8e9b362cbf4 Parents: 54e2bbf Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 14:47:05 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 14:47:05 2017 -0700 -- .../phoenix/end2end/index/MutableIndexSplitForwardScanIT.java | 3 ++- .../phoenix/end2end/index/MutableIndexSplitReverseScanIT.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/68b5db54/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java index 75e2ae2..83320c2 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java @@ -19,7 +19,8 @@ package org.apache.phoenix.end2end.index; import org.junit.Test; -public class MutableIndexSplitForwardScanIT extends MutableIndexSplitIT { +//TODO: re-enable once PHOENIX-4273 is fixed +public abstract class MutableIndexSplitForwardScanIT extends MutableIndexSplitIT { public MutableIndexSplitForwardScanIT(boolean localIndex, boolean multiTenant) { super(localIndex, multiTenant); http://git-wip-us.apache.org/repos/asf/phoenix/blob/68b5db54/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java index d7afb31..f57dfdd 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java @@ -19,7 +19,8 @@ package org.apache.phoenix.end2end.index; import org.junit.Test; -public class MutableIndexSplitReverseScanIT extends MutableIndexSplitIT { +//TODO: re-enable once PHOENIX-4273 is fixeds +public abstract class MutableIndexSplitReverseScanIT extends MutableIndexSplitIT { public MutableIndexSplitReverseScanIT(boolean localIndex, boolean multiTenant) { super(localIndex, multiTenant);
phoenix git commit: PHOENIX-4272 Dial down number of threads and repeats in ConcurrentMutationsIT
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 f8454650a -> 0b5ec9ab9 PHOENIX-4272 Dial down number of threads and repeats in ConcurrentMutationsIT Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0b5ec9ab Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0b5ec9ab Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0b5ec9ab Branch: refs/heads/4.x-HBase-1.1 Commit: 0b5ec9ab9ca267f7a575ed5163460a6b8ab43cb8 Parents: f845465 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 13:54:52 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 13:54:52 2017 -0700 -- .../java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/0b5ec9ab/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java index e5f22da..d1f30c6 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java @@ -215,9 +215,9 @@ public class ConcurrentMutationsIT extends ParallelStatsDisabledIT { } @Test -@Repeat(10) +@Repeat(5) public void testConcurrentUpserts() throws Exception { -int nThreads = 8; +int nThreads = 4; final int batchSize = 200; final int nRows = 51; final int nIndexValues = 23;
phoenix git commit: PHOENIX-4272 Dial down number of threads and repeats in ConcurrentMutationsIT
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 57bdb344a -> 587b79b52 PHOENIX-4272 Dial down number of threads and repeats in ConcurrentMutationsIT Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/587b79b5 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/587b79b5 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/587b79b5 Branch: refs/heads/4.x-HBase-0.98 Commit: 587b79b52c72b847ea77b1286f844d91ffbe8610 Parents: 57bdb34 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 13:54:32 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 13:54:32 2017 -0700 -- .../java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/587b79b5/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java index e5f22da..d1f30c6 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java @@ -215,9 +215,9 @@ public class ConcurrentMutationsIT extends ParallelStatsDisabledIT { } @Test -@Repeat(10) +@Repeat(5) public void testConcurrentUpserts() throws Exception { -int nThreads = 8; +int nThreads = 4; final int batchSize = 200; final int nRows = 51; final int nIndexValues = 23;
phoenix git commit: PHOENIX-4272 Dial down number of threads and repeats in ConcurrentMutationsIT
Repository: phoenix Updated Branches: refs/heads/master 119f86e0c -> 54e2bbf83 PHOENIX-4272 Dial down number of threads and repeats in ConcurrentMutationsIT Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/54e2bbf8 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/54e2bbf8 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/54e2bbf8 Branch: refs/heads/master Commit: 54e2bbf83ba3493dc70eb3d68965453475da2f73 Parents: 119f86e Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 13:54:11 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 13:54:11 2017 -0700 -- .../java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/54e2bbf8/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java index e5f22da..d1f30c6 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java @@ -215,9 +215,9 @@ public class ConcurrentMutationsIT extends ParallelStatsDisabledIT { } @Test -@Repeat(10) +@Repeat(5) public void testConcurrentUpserts() throws Exception { -int nThreads = 8; +int nThreads = 4; final int batchSize = 200; final int nRows = 51; final int nIndexValues = 23;
phoenix git commit: PHOENIX-4272 Dial down number of threads and repeats in ConcurrentMutationsIT
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 dd3112d03 -> 94d4716e3 PHOENIX-4272 Dial down number of threads and repeats in ConcurrentMutationsIT Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/94d4716e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/94d4716e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/94d4716e Branch: refs/heads/4.x-HBase-1.2 Commit: 94d4716e386d4ffb2e832f2b68e46794653c77a2 Parents: dd3112d Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 13:53:32 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 13:53:44 2017 -0700 -- .../java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/94d4716e/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java index e5f22da..d1f30c6 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ConcurrentMutationsIT.java @@ -215,9 +215,9 @@ public class ConcurrentMutationsIT extends ParallelStatsDisabledIT { } @Test -@Repeat(10) +@Repeat(5) public void testConcurrentUpserts() throws Exception { -int nThreads = 8; +int nThreads = 4; final int batchSize = 200; final int nRows = 51; final int nIndexValues = 23;
phoenix git commit: PHOENIX-4265 NPE when ROW_TIMESTAMP is SQL timestamp column
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 e5a9c72e3 -> e5c9b2fa8 PHOENIX-4265 NPE when ROW_TIMESTAMP is SQL timestamp column Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/e5c9b2fa Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/e5c9b2fa Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/e5c9b2fa Branch: refs/heads/4.x-HBase-1.2 Commit: e5c9b2fa80e2830806333a7e9d85ee40330a5ca9 Parents: e5a9c72 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 10:38:28 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 10:38:28 2017 -0700 -- .../apache/phoenix/end2end/UpsertSelectIT.java | 66 .../org/apache/phoenix/compile/ScanRanges.java | 14 +++-- .../org/apache/phoenix/schema/types/PLong.java | 6 +- 3 files changed, 80 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/e5c9b2fa/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index 55f2dd0..99cbe47 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -42,10 +42,12 @@ import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Timestamp; import java.util.Properties; import org.apache.phoenix.compile.QueryPlan; import org.apache.phoenix.exception.SQLExceptionCode; +import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.jdbc.PhoenixStatement; import org.apache.phoenix.query.QueryConstants; import org.apache.phoenix.query.QueryServices; @@ -1422,6 +1424,70 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { conn.close(); } +@Test // See https://issues.apache.org/jira/browse/PHOENIX-4265 +public void testLongCodecUsedForRowTimestamp() throws Exception { +String tableName = generateUniqueName(); +String indexName = generateUniqueName(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +conn.createStatement().execute("CREATE IMMUTABLE TABLE " + tableName ++ " (k1 TIMESTAMP not null, k2 bigint not null, v bigint, constraint pk primary key (k1 row_timestamp, k2)) SALT_BUCKETS = 9"); +conn.createStatement().execute( +"CREATE INDEX " + indexName + " ON " + tableName + " (v) INCLUDE (k2)"); +PreparedStatement stmt = +conn.prepareStatement("UPSERT INTO " + tableName + " VALUES (?, ?, ?) "); +stmt.setTimestamp(1, new Timestamp(1000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 1000); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(2000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(3000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(4000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(5000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 10); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(6000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 20); +stmt.executeUpdate(); +conn.commit(); +ResultSet rs = conn.createStatement().executeQuery("SELECT " + +" K2 FROM " + tableName + " WHERE V = 5"); +assertTrue("Index " + indexName + " should have been used", + rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan().getTableRef() +.getTable().getName().getString().equals(indexName)); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertFalse(rs.next()); +rs = +conn.createStatement().executeQuery("SELECT /*
phoenix git commit: PHOENIX-4265 NPE when ROW_TIMESTAMP is SQL timestamp column
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 42fb2fd43 -> acc6f3b5b PHOENIX-4265 NPE when ROW_TIMESTAMP is SQL timestamp column Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/acc6f3b5 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/acc6f3b5 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/acc6f3b5 Branch: refs/heads/4.x-HBase-0.98 Commit: acc6f3b5bb9f34dcfa3ccf16486c6b8e8bdf548c Parents: 42fb2fd Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 10:37:40 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 10:37:40 2017 -0700 -- .../apache/phoenix/end2end/UpsertSelectIT.java | 66 .../org/apache/phoenix/compile/ScanRanges.java | 14 +++-- .../org/apache/phoenix/schema/types/PLong.java | 6 +- 3 files changed, 80 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/acc6f3b5/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index c6ad696..087dadf 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -42,10 +42,12 @@ import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Timestamp; import java.util.Properties; import org.apache.phoenix.compile.QueryPlan; import org.apache.phoenix.exception.SQLExceptionCode; +import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.jdbc.PhoenixStatement; import org.apache.phoenix.query.QueryConstants; import org.apache.phoenix.query.QueryServices; @@ -1420,6 +1422,70 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { conn.close(); } +@Test // See https://issues.apache.org/jira/browse/PHOENIX-4265 +public void testLongCodecUsedForRowTimestamp() throws Exception { +String tableName = generateUniqueName(); +String indexName = generateUniqueName(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +conn.createStatement().execute("CREATE IMMUTABLE TABLE " + tableName ++ " (k1 TIMESTAMP not null, k2 bigint not null, v bigint, constraint pk primary key (k1 row_timestamp, k2)) SALT_BUCKETS = 9"); +conn.createStatement().execute( +"CREATE INDEX " + indexName + " ON " + tableName + " (v) INCLUDE (k2)"); +PreparedStatement stmt = +conn.prepareStatement("UPSERT INTO " + tableName + " VALUES (?, ?, ?) "); +stmt.setTimestamp(1, new Timestamp(1000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 1000); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(2000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(3000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(4000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(5000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 10); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(6000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 20); +stmt.executeUpdate(); +conn.commit(); +ResultSet rs = conn.createStatement().executeQuery("SELECT " + +" K2 FROM " + tableName + " WHERE V = 5"); +assertTrue("Index " + indexName + " should have been used", + rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan().getTableRef() +.getTable().getName().getString().equals(indexName)); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertFalse(rs.next()); +rs = +conn.createStatement().executeQuery(&
phoenix git commit: PHOENIX-4265 NPE when ROW_TIMESTAMP is SQL timestamp column
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 8dfc88db1 -> 8688fa603 PHOENIX-4265 NPE when ROW_TIMESTAMP is SQL timestamp column Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/8688fa60 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/8688fa60 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/8688fa60 Branch: refs/heads/4.x-HBase-1.1 Commit: 8688fa603aee3b994e22ce5dda75af3df89224f5 Parents: 8dfc88d Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 10:38:05 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 10:38:05 2017 -0700 -- .../apache/phoenix/end2end/UpsertSelectIT.java | 66 .../org/apache/phoenix/compile/ScanRanges.java | 14 +++-- .../org/apache/phoenix/schema/types/PLong.java | 6 +- 3 files changed, 80 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/8688fa60/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index 55f2dd0..99cbe47 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -42,10 +42,12 @@ import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Timestamp; import java.util.Properties; import org.apache.phoenix.compile.QueryPlan; import org.apache.phoenix.exception.SQLExceptionCode; +import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.jdbc.PhoenixStatement; import org.apache.phoenix.query.QueryConstants; import org.apache.phoenix.query.QueryServices; @@ -1422,6 +1424,70 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { conn.close(); } +@Test // See https://issues.apache.org/jira/browse/PHOENIX-4265 +public void testLongCodecUsedForRowTimestamp() throws Exception { +String tableName = generateUniqueName(); +String indexName = generateUniqueName(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +conn.createStatement().execute("CREATE IMMUTABLE TABLE " + tableName ++ " (k1 TIMESTAMP not null, k2 bigint not null, v bigint, constraint pk primary key (k1 row_timestamp, k2)) SALT_BUCKETS = 9"); +conn.createStatement().execute( +"CREATE INDEX " + indexName + " ON " + tableName + " (v) INCLUDE (k2)"); +PreparedStatement stmt = +conn.prepareStatement("UPSERT INTO " + tableName + " VALUES (?, ?, ?) "); +stmt.setTimestamp(1, new Timestamp(1000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 1000); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(2000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(3000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(4000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(5000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 10); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(6000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 20); +stmt.executeUpdate(); +conn.commit(); +ResultSet rs = conn.createStatement().executeQuery("SELECT " + +" K2 FROM " + tableName + " WHERE V = 5"); +assertTrue("Index " + indexName + " should have been used", + rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan().getTableRef() +.getTable().getName().getString().equals(indexName)); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertFalse(rs.next()); +rs = +conn.createStatement().executeQuery("SELECT /*
phoenix git commit: PHOENIX-4265 NPE when ROW_TIMESTAMP is SQL timestamp column
Repository: phoenix Updated Branches: refs/heads/master aaa41a33d -> 119f86e0c PHOENIX-4265 NPE when ROW_TIMESTAMP is SQL timestamp column Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/119f86e0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/119f86e0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/119f86e0 Branch: refs/heads/master Commit: 119f86e0c29ed6331df35028d37f6964393f122b Parents: aaa41a3 Author: Samarth Jain <sama...@apache.org> Authored: Tue Oct 3 10:37:15 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Oct 3 10:37:15 2017 -0700 -- .../apache/phoenix/end2end/UpsertSelectIT.java | 66 .../org/apache/phoenix/compile/ScanRanges.java | 14 +++-- .../org/apache/phoenix/schema/types/PLong.java | 6 +- 3 files changed, 80 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/119f86e0/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index fef5a25..275d72d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -42,10 +42,12 @@ import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Timestamp; import java.util.Properties; import org.apache.phoenix.compile.QueryPlan; import org.apache.phoenix.exception.SQLExceptionCode; +import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.jdbc.PhoenixStatement; import org.apache.phoenix.query.QueryConstants; import org.apache.phoenix.query.QueryServices; @@ -1420,6 +1422,70 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { conn.close(); } +@Test // See https://issues.apache.org/jira/browse/PHOENIX-4265 +public void testLongCodecUsedForRowTimestamp() throws Exception { +String tableName = generateUniqueName(); +String indexName = generateUniqueName(); +try (Connection conn = DriverManager.getConnection(getUrl())) { +conn.createStatement().execute("CREATE IMMUTABLE TABLE " + tableName ++ " (k1 TIMESTAMP not null, k2 bigint not null, v bigint, constraint pk primary key (k1 row_timestamp, k2)) SALT_BUCKETS = 9"); +conn.createStatement().execute( +"CREATE INDEX " + indexName + " ON " + tableName + " (v) INCLUDE (k2)"); +PreparedStatement stmt = +conn.prepareStatement("UPSERT INTO " + tableName + " VALUES (?, ?, ?) "); +stmt.setTimestamp(1, new Timestamp(1000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 1000); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(2000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(3000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(4000)); +stmt.setLong(2, 5000); +stmt.setLong(3, 5); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(5000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 10); +stmt.executeUpdate(); +stmt.setTimestamp(1, new Timestamp(6000)); +stmt.setLong(2, 2000); +stmt.setLong(3, 20); +stmt.executeUpdate(); +conn.commit(); +ResultSet rs = conn.createStatement().executeQuery("SELECT " + +" K2 FROM " + tableName + " WHERE V = 5"); +assertTrue("Index " + indexName + " should have been used", + rs.unwrap(PhoenixResultSet.class).getStatement().getQueryPlan().getTableRef() +.getTable().getName().getString().equals(indexName)); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertTrue(rs.next()); +assertEquals(5000, rs.getLong("k2")); +assertFalse(rs.next()); +rs = +conn.createStatement().executeQuery("SELECT /*+ INDEX(&qu
phoenix git commit: PHOENIX-4260 Breakup NotQueryIT into multiple test classes
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 1b643415d -> d5eb0f0e5 PHOENIX-4260 Breakup NotQueryIT into multiple test classes Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d5eb0f0e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d5eb0f0e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d5eb0f0e Branch: refs/heads/4.x-HBase-1.2 Commit: d5eb0f0e5031abba75929b8404dd41896e74c2f4 Parents: 1b64341 Author: Samarth Jain <sama...@apache.org> Authored: Fri Sep 29 13:18:46 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Sep 29 13:18:46 2017 -0700 -- .../org/apache/phoenix/end2end/BaseQueryIT.java | 81 +--- .../apache/phoenix/end2end/CaseStatementIT.java | 2 +- .../apache/phoenix/end2end/CastAndCoerceIT.java | 2 +- .../org/apache/phoenix/end2end/GroupByIT.java | 2 +- .../org/apache/phoenix/end2end/InQueryIT.java | 2 +- .../apache/phoenix/end2end/IntArithmeticIT.java | 2 +- .../org/apache/phoenix/end2end/NotQueryIT.java | 12 +-- .../NotQueryWithGlobalImmutableIndexesIT.java | 43 +++ .../NotQueryWithLocalImmutableIndexesIT.java| 43 +++ .../org/apache/phoenix/end2end/RangeScanIT.java | 2 +- .../org/apache/phoenix/end2end/UngroupedIT.java | 2 +- 11 files changed, 149 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d5eb0f0e/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java index 7f7416b..53391f1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java @@ -51,27 +51,41 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT { protected static final String tenantId = getOrganizationId(); protected static final String ATABLE_INDEX_NAME = "ATABLE_IDX"; protected static final long BATCH_SIZE = 3; -protected static final String[] INDEX_DDLS = new String[] { -"CREATE INDEX %s ON %s (a_integer DESC) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE (" -+ "B_STRING, " + "A_DATE) %s", -"CREATE INDEX %s ON %s (a_integer) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + " B_STRING, " -+ "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"" }; - +protected static final String NO_INDEX = ""; +protected static final String[] GLOBAL_INDEX_DDLS = +new String[] { +"CREATE INDEX %s ON %s (a_integer DESC) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +"CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE (" + "B_STRING, " ++ "A_DATE) %s", +"CREATE INDEX %s ON %s (a_integer) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +NO_INDEX }; +protected static final String[] LOCAL_INDEX_DDLS = +new String[] { +"CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE (" + "A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +"CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + "B_STRING, " ++ "A_DATE) %s", +"CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s" }; +protected static St
phoenix git commit: PHOENIX-4260 Addendum
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 b942c91bc -> fade9b1fa PHOENIX-4260 Addendum Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fade9b1f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fade9b1f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fade9b1f Branch: refs/heads/4.x-HBase-1.1 Commit: fade9b1faaafa517a02faaa1532593b91744bbd0 Parents: b942c91 Author: Samarth Jain <sama...@apache.org> Authored: Fri Sep 29 13:17:59 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Sep 29 13:17:59 2017 -0700 -- .../org/apache/phoenix/end2end/BaseQueryIT.java | 81 +--- .../apache/phoenix/end2end/CaseStatementIT.java | 2 +- .../apache/phoenix/end2end/CastAndCoerceIT.java | 2 +- .../org/apache/phoenix/end2end/GroupByIT.java | 2 +- .../org/apache/phoenix/end2end/InQueryIT.java | 2 +- .../apache/phoenix/end2end/IntArithmeticIT.java | 2 +- .../org/apache/phoenix/end2end/NotQueryIT.java | 12 +-- .../NotQueryWithGlobalImmutableIndexesIT.java | 43 +++ .../NotQueryWithLocalImmutableIndexesIT.java| 43 +++ .../org/apache/phoenix/end2end/RangeScanIT.java | 2 +- .../org/apache/phoenix/end2end/UngroupedIT.java | 2 +- 11 files changed, 149 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/fade9b1f/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java index 7f7416b..53391f1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java @@ -51,27 +51,41 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT { protected static final String tenantId = getOrganizationId(); protected static final String ATABLE_INDEX_NAME = "ATABLE_IDX"; protected static final long BATCH_SIZE = 3; -protected static final String[] INDEX_DDLS = new String[] { -"CREATE INDEX %s ON %s (a_integer DESC) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE (" -+ "B_STRING, " + "A_DATE) %s", -"CREATE INDEX %s ON %s (a_integer) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + " B_STRING, " -+ "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"" }; - +protected static final String NO_INDEX = ""; +protected static final String[] GLOBAL_INDEX_DDLS = +new String[] { +"CREATE INDEX %s ON %s (a_integer DESC) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +"CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE (" + "B_STRING, " ++ "A_DATE) %s", +"CREATE INDEX %s ON %s (a_integer) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +NO_INDEX }; +protected static final String[] LOCAL_INDEX_DDLS = +new String[] { +"CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE (" + "A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +"CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + "B_STRING, " ++ "A_DATE) %s", +"CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s" }; +protected static String[] INDEX_DDLS; +static { +
phoenix git commit: PHOENIX-4260 Addendum
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 686caebff -> d4353e4a5 PHOENIX-4260 Addendum Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d4353e4a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d4353e4a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d4353e4a Branch: refs/heads/4.x-HBase-0.98 Commit: d4353e4a5e2594fa09c84e864801c6450d9e3bb6 Parents: 686caeb Author: Samarth Jain <sama...@apache.org> Authored: Fri Sep 29 13:17:36 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Sep 29 13:17:36 2017 -0700 -- .../NotQueryWithGlobalImmutableIndexesIT.java | 43 .../NotQueryWithLocalImmutableIndexesIT.java| 43 2 files changed, 86 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d4353e4a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithGlobalImmutableIndexesIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithGlobalImmutableIndexesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithGlobalImmutableIndexesIT.java new file mode 100644 index 000..bff741f --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithGlobalImmutableIndexesIT.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.end2end; + +import java.util.Collection; +import java.util.List; + +import org.junit.runners.Parameterized.Parameters; + +import com.google.common.collect.Lists; + +public class NotQueryWithGlobalImmutableIndexesIT extends NotQueryIT { + +public NotQueryWithGlobalImmutableIndexesIT(String indexDDL, boolean mutable, +boolean columnEncoded) throws Exception { +super(indexDDL, mutable, columnEncoded); +} + +@Parameters(name = "globalIndexDDL={0}") +public static Collection globalIndexes() { +List testCases = Lists.newArrayList(); +for (String indexDDL : GLOBAL_INDEX_DDLS) { +testCases.add(new Object[] { indexDDL, false, false }); +} +return testCases; +} + +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/d4353e4a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithLocalImmutableIndexesIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithLocalImmutableIndexesIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithLocalImmutableIndexesIT.java new file mode 100644 index 000..806b396 --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryWithLocalImmutableIndexesIT.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.end2end; + +import java.util.Collection; +import java.util.List; + +import org.junit.runners.Parameterized.Parameters; + +import com.google.common.collect.Lists; + +public class NotQueryWithLocalImmutableIndexesIT extends NotQueryIT { + +public NotQueryWithLocalImmutableIndexesIT(Stri
phoenix git commit: PHOENIX-4260 Breakup NotQueryIT into multiple test classes
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 045653edd -> 686caebff PHOENIX-4260 Breakup NotQueryIT into multiple test classes Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/686caebf Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/686caebf Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/686caebf Branch: refs/heads/4.x-HBase-0.98 Commit: 686caebffa94822dcb32de0e298ddf2bc24eac6a Parents: 045653e Author: Samarth Jain <sama...@apache.org> Authored: Fri Sep 29 13:16:46 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Sep 29 13:16:46 2017 -0700 -- .../org/apache/phoenix/end2end/BaseQueryIT.java | 81 +--- .../apache/phoenix/end2end/CaseStatementIT.java | 2 +- .../apache/phoenix/end2end/CastAndCoerceIT.java | 2 +- .../org/apache/phoenix/end2end/GroupByIT.java | 2 +- .../org/apache/phoenix/end2end/InQueryIT.java | 2 +- .../apache/phoenix/end2end/IntArithmeticIT.java | 2 +- .../org/apache/phoenix/end2end/NotQueryIT.java | 12 +-- .../org/apache/phoenix/end2end/RangeScanIT.java | 2 +- .../org/apache/phoenix/end2end/UngroupedIT.java | 2 +- 9 files changed, 63 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/686caebf/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java index 7f7416b..53391f1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java @@ -51,27 +51,41 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT { protected static final String tenantId = getOrganizationId(); protected static final String ATABLE_INDEX_NAME = "ATABLE_IDX"; protected static final long BATCH_SIZE = 3; -protected static final String[] INDEX_DDLS = new String[] { -"CREATE INDEX %s ON %s (a_integer DESC) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE (" -+ "B_STRING, " + "A_DATE) %s", -"CREATE INDEX %s ON %s (a_integer) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + " B_STRING, " -+ "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"" }; - +protected static final String NO_INDEX = ""; +protected static final String[] GLOBAL_INDEX_DDLS = +new String[] { +"CREATE INDEX %s ON %s (a_integer DESC) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +"CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE (" + "B_STRING, " ++ "A_DATE) %s", +"CREATE INDEX %s ON %s (a_integer) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +NO_INDEX }; +protected static final String[] LOCAL_INDEX_DDLS = +new String[] { +"CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE (" + "A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +"CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + "B_STRING, " ++ "A_DATE) %s", +"CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s" }; +protected static String[] INDEX_DDLS; +static { +INDEX_DDLS = new String[GLOBAL_INDEX_DDLS.length + LOCAL_INDEX_DDLS.length]; +int i =
phoenix git commit: PHOENIX-4260 Breakup NotQueryIT into multiple test classes
Repository: phoenix Updated Branches: refs/heads/master f1b457819 -> cfe4c9356 PHOENIX-4260 Breakup NotQueryIT into multiple test classes Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cfe4c935 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cfe4c935 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cfe4c935 Branch: refs/heads/master Commit: cfe4c9356d0cb9ef16fc297ea1192d35b95862fd Parents: f1b4578 Author: Samarth Jain <sama...@apache.org> Authored: Fri Sep 29 13:16:25 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Fri Sep 29 13:16:25 2017 -0700 -- .../org/apache/phoenix/end2end/BaseQueryIT.java | 81 +--- .../apache/phoenix/end2end/CaseStatementIT.java | 2 +- .../apache/phoenix/end2end/CastAndCoerceIT.java | 2 +- .../org/apache/phoenix/end2end/GroupByIT.java | 2 +- .../org/apache/phoenix/end2end/InQueryIT.java | 2 +- .../apache/phoenix/end2end/IntArithmeticIT.java | 2 +- .../org/apache/phoenix/end2end/NotQueryIT.java | 12 +-- .../NotQueryWithGlobalImmutableIndexesIT.java | 43 +++ .../NotQueryWithLocalImmutableIndexesIT.java| 43 +++ .../org/apache/phoenix/end2end/RangeScanIT.java | 2 +- .../org/apache/phoenix/end2end/UngroupedIT.java | 2 +- 11 files changed, 149 insertions(+), 44 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/cfe4c935/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java index 7f7416b..53391f1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java @@ -51,27 +51,41 @@ public abstract class BaseQueryIT extends ParallelStatsDisabledIT { protected static final String tenantId = getOrganizationId(); protected static final String ATABLE_INDEX_NAME = "ATABLE_IDX"; protected static final long BATCH_SIZE = 3; -protected static final String[] INDEX_DDLS = new String[] { -"CREATE INDEX %s ON %s (a_integer DESC) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE (" -+ "B_STRING, " + "A_DATE) %s", -"CREATE INDEX %s ON %s (a_integer) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + " B_STRING, " -+ "A_DATE) %s", -"CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE (" -+ "A_STRING, " + "B_STRING, " + "A_DATE) %s", -"" }; - +protected static final String NO_INDEX = ""; +protected static final String[] GLOBAL_INDEX_DDLS = +new String[] { +"CREATE INDEX %s ON %s (a_integer DESC) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +"CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE (" + "B_STRING, " ++ "A_DATE) %s", +"CREATE INDEX %s ON %s (a_integer) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +NO_INDEX }; +protected static final String[] LOCAL_INDEX_DDLS = +new String[] { +"CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE (" + "A_STRING, " ++ "B_STRING, " + "A_DATE) %s", +"CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + "B_STRING, " ++ "A_DATE) %s", +"CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE (" + " A_STRING, " ++ "B_STRING, " + "A_DATE) %s" }; +protected static String[] INDEX_DDLS; +
phoenix git commit: PHOENIX-4255 Breakup StatsCollectorIT into several integration tests to limit number of tables created
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 2a1a2b202 -> 38ba41b05 PHOENIX-4255 Breakup StatsCollectorIT into several integration tests to limit number of tables created Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/38ba41b0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/38ba41b0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/38ba41b0 Branch: refs/heads/4.x-HBase-1.1 Commit: 38ba41b0577964642bdebe13161accee98338db0 Parents: 2a1a2b2 Author: Samarth Jain <sama...@apache.org> Authored: Thu Sep 28 23:50:44 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Sep 28 23:50:44 2017 -0700 -- ...mnEncodedImmutableNonTxStatsCollectorIT.java | 38 ...olumnEncodedImmutableTxStatsCollectorIT.java | 38 ...lumnEncodedMutableNonTxStatsCollectorIT.java | 38 .../ColumnEncodedMutableTxStatsCollectorIT.java | 38 ...mnEncodedImmutableNonTxStatsCollectorIT.java | 38 ...olumnEncodedImmutableTxStatsCollectorIT.java | 38 .../phoenix/end2end/StatsCollectorIT.java | 20 ++- ...SysTableNamespaceMappedStatsCollectorIT.java | 21 --- 8 files changed, 247 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/38ba41b0/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java new file mode 100644 index 000..7ef825e --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.end2end; + +import java.util.Arrays; +import java.util.Collection; + +import org.junit.runners.Parameterized.Parameters; + +public class ColumnEncodedImmutableNonTxStatsCollectorIT extends StatsCollectorIT { + +public ColumnEncodedImmutableNonTxStatsCollectorIT(boolean mutable, boolean transactional, +boolean userTableNamespaceMapped, boolean columnEncoded) { +super(mutable, transactional, userTableNamespaceMapped, columnEncoded); +} + +@Parameters(name="columnEncoded = {0}, mutable = {1}, transactional = {2}, isUserTableNamespaceMapped = {3}") +public static Collection<Boolean[]> data() { +return Arrays.asList(new Boolean[][] { +{ true, false, false, false }, { true, false, false, true } +}); +} +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/38ba41b0/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java new file mode 100644 index 000..0c6934b --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicabl
phoenix git commit: PHOENIX-4255 Breakup StatsCollectorIT into several integration tests to limit number of tables created
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 85e455bd1 -> 00e3d29c6 PHOENIX-4255 Breakup StatsCollectorIT into several integration tests to limit number of tables created Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/00e3d29c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/00e3d29c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/00e3d29c Branch: refs/heads/4.x-HBase-0.98 Commit: 00e3d29c6c7b738858558a4f41eecd28dd9c4c88 Parents: 85e455b Author: Samarth Jain <sama...@apache.org> Authored: Thu Sep 28 23:50:20 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Sep 28 23:50:20 2017 -0700 -- ...mnEncodedImmutableNonTxStatsCollectorIT.java | 38 ...olumnEncodedImmutableTxStatsCollectorIT.java | 38 ...lumnEncodedMutableNonTxStatsCollectorIT.java | 38 .../ColumnEncodedMutableTxStatsCollectorIT.java | 38 ...mnEncodedImmutableNonTxStatsCollectorIT.java | 38 ...olumnEncodedImmutableTxStatsCollectorIT.java | 38 .../phoenix/end2end/StatsCollectorIT.java | 20 ++- ...SysTableNamespaceMappedStatsCollectorIT.java | 21 --- 8 files changed, 247 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/00e3d29c/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java new file mode 100644 index 000..7ef825e --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.end2end; + +import java.util.Arrays; +import java.util.Collection; + +import org.junit.runners.Parameterized.Parameters; + +public class ColumnEncodedImmutableNonTxStatsCollectorIT extends StatsCollectorIT { + +public ColumnEncodedImmutableNonTxStatsCollectorIT(boolean mutable, boolean transactional, +boolean userTableNamespaceMapped, boolean columnEncoded) { +super(mutable, transactional, userTableNamespaceMapped, columnEncoded); +} + +@Parameters(name="columnEncoded = {0}, mutable = {1}, transactional = {2}, isUserTableNamespaceMapped = {3}") +public static Collection<Boolean[]> data() { +return Arrays.asList(new Boolean[][] { +{ true, false, false, false }, { true, false, false, true } +}); +} +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/00e3d29c/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java new file mode 100644 index 000..0c6934b --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicabl
phoenix git commit: PHOENIX-4255 Addendum
Repository: phoenix Updated Branches: refs/heads/master 86dae1ed7 -> 7d22ca582 PHOENIX-4255 Addendum Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/7d22ca58 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/7d22ca58 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/7d22ca58 Branch: refs/heads/master Commit: 7d22ca582665facda4d075bc27b64f7c0f8b5821 Parents: 86dae1e Author: Samarth Jain <sama...@apache.org> Authored: Thu Sep 28 23:49:17 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Sep 28 23:49:17 2017 -0700 -- ...mnEncodedImmutableNonTxStatsCollectorIT.java | 38 ...olumnEncodedImmutableTxStatsCollectorIT.java | 38 ...lumnEncodedMutableNonTxStatsCollectorIT.java | 38 .../ColumnEncodedMutableTxStatsCollectorIT.java | 38 ...mnEncodedImmutableNonTxStatsCollectorIT.java | 38 ...olumnEncodedImmutableTxStatsCollectorIT.java | 38 6 files changed, 228 insertions(+) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/7d22ca58/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java new file mode 100644 index 000..7ef825e --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.end2end; + +import java.util.Arrays; +import java.util.Collection; + +import org.junit.runners.Parameterized.Parameters; + +public class ColumnEncodedImmutableNonTxStatsCollectorIT extends StatsCollectorIT { + +public ColumnEncodedImmutableNonTxStatsCollectorIT(boolean mutable, boolean transactional, +boolean userTableNamespaceMapped, boolean columnEncoded) { +super(mutable, transactional, userTableNamespaceMapped, columnEncoded); +} + +@Parameters(name="columnEncoded = {0}, mutable = {1}, transactional = {2}, isUserTableNamespaceMapped = {3}") +public static Collection<Boolean[]> data() { +return Arrays.asList(new Boolean[][] { +{ true, false, false, false }, { true, false, false, true } +}); +} +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/7d22ca58/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java new file mode 100644 index 000..0c6934b --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language gov
phoenix git commit: PHOENIX-4255 Breakup StatsCollectorIT into several integration tests to limit number of tables created
Repository: phoenix Updated Branches: refs/heads/master a4ce14bad -> 86dae1ed7 PHOENIX-4255 Breakup StatsCollectorIT into several integration tests to limit number of tables created Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/86dae1ed Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/86dae1ed Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/86dae1ed Branch: refs/heads/master Commit: 86dae1ed7bc3101aa9fe3f780e31b02cacad02e2 Parents: a4ce14b Author: Samarth Jain <sama...@apache.org> Authored: Thu Sep 28 23:48:08 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Sep 28 23:48:08 2017 -0700 -- .../phoenix/end2end/StatsCollectorIT.java | 20 +++ ...SysTableNamespaceMappedStatsCollectorIT.java | 21 +++- 2 files changed, 19 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/86dae1ed/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java index 19b5275..da8e78d 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java @@ -33,8 +33,6 @@ import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.Arrays; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Properties; @@ -71,12 +69,11 @@ import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; import com.google.common.collect.Maps; @RunWith(Parameterized.class) -public class StatsCollectorIT extends BaseUniqueNamesOwnClusterIT { +public abstract class StatsCollectorIT extends BaseUniqueNamesOwnClusterIT { private final String tableDDLOptions; private final boolean columnEncoded; private String tableName; @@ -86,7 +83,7 @@ public class StatsCollectorIT extends BaseUniqueNamesOwnClusterIT { private final boolean userTableNamespaceMapped; private final boolean mutable; -public StatsCollectorIT(boolean mutable, boolean transactional, boolean userTableNamespaceMapped, boolean columnEncoded) { +protected StatsCollectorIT(boolean mutable, boolean transactional, boolean userTableNamespaceMapped, boolean columnEncoded) { StringBuilder sb = new StringBuilder(); if (transactional) { sb.append("TRANSACTIONAL=true"); @@ -116,18 +113,7 @@ public class StatsCollectorIT extends BaseUniqueNamesOwnClusterIT { this.columnEncoded = columnEncoded; this.mutable = mutable; } - -@Parameters(name="columnEncoded = {0}, mutable = {1}, transactional = {2}, isUserTableNamespaceMapped = {3}") -public static Collection<Boolean[]> data() { -return Arrays.asList(new Boolean[][] { -{ false, false, false, false }, { false, false, false, true }, { false, false, true, false }, { false, false, true, true }, -// no need to test non column encoded mutable case and this is the same as non column encoded immutable -//{ false, true, false, false }, { false, true, false, true }, { false, true, true, false }, { false, true, true, true }, -{ true, false, false, false }, { true, false, false, true }, { true, false, true, false }, { true, false, true, true }, -{ true, true, false, false }, { true, true, false, true }, { true, true, true, false }, { true, true, true, true } - }); -} - + @BeforeClass public static void doSetup() throws Exception { // enable name space mapping at global level on both client and server side http://git-wip-us.apache.org/repos/asf/phoenix/blob/86dae1ed/phoenix-core/src/it/java/org/apache/phoenix/end2end/SysTableNamespaceMappedStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SysTableNamespaceMappedStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SysTableNamespaceMappedStatsCollectorIT.java index f9ef0c2..36779c2 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SysTableNamespaceMappedStatsCollectorIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SysTableNamespaceMappedStatsCollector
phoenix git commit: PHOENIX-4255 Breakup StatsCollectorIT into several integration tests to limit number of tables created
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 acf89db38 -> 219607275 PHOENIX-4255 Breakup StatsCollectorIT into several integration tests to limit number of tables created Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/21960727 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/21960727 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/21960727 Branch: refs/heads/4.x-HBase-1.2 Commit: 219607275f8b7c317bfe553390898d2df791221d Parents: acf89db Author: Samarth Jain <sama...@apache.org> Authored: Thu Sep 28 23:47:38 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Sep 28 23:47:38 2017 -0700 -- ...mnEncodedImmutableNonTxStatsCollectorIT.java | 38 ...olumnEncodedImmutableTxStatsCollectorIT.java | 38 ...lumnEncodedMutableNonTxStatsCollectorIT.java | 38 .../ColumnEncodedMutableTxStatsCollectorIT.java | 38 ...mnEncodedImmutableNonTxStatsCollectorIT.java | 38 ...olumnEncodedImmutableTxStatsCollectorIT.java | 38 .../phoenix/end2end/StatsCollectorIT.java | 20 ++- ...SysTableNamespaceMappedStatsCollectorIT.java | 21 --- 8 files changed, 247 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/21960727/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java new file mode 100644 index 000..7ef825e --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableNonTxStatsCollectorIT.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.end2end; + +import java.util.Arrays; +import java.util.Collection; + +import org.junit.runners.Parameterized.Parameters; + +public class ColumnEncodedImmutableNonTxStatsCollectorIT extends StatsCollectorIT { + +public ColumnEncodedImmutableNonTxStatsCollectorIT(boolean mutable, boolean transactional, +boolean userTableNamespaceMapped, boolean columnEncoded) { +super(mutable, transactional, userTableNamespaceMapped, columnEncoded); +} + +@Parameters(name="columnEncoded = {0}, mutable = {1}, transactional = {2}, isUserTableNamespaceMapped = {3}") +public static Collection<Boolean[]> data() { +return Arrays.asList(new Boolean[][] { +{ true, false, false, false }, { true, false, false, true } +}); +} +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/21960727/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java new file mode 100644 index 000..0c6934b --- /dev/null +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ColumnEncodedImmutableTxStatsCollectorIT.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicabl
phoenix git commit: PHOENIX-4243 Using rowtimestamp column with RVC causes an exception sometimes
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 fc18cd609 -> acf89db38 PHOENIX-4243 Using rowtimestamp column with RVC causes an exception sometimes Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/acf89db3 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/acf89db3 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/acf89db3 Branch: refs/heads/4.x-HBase-1.2 Commit: acf89db38e5b411484603acfa6211d3aaa185c50 Parents: fc18cd6 Author: Samarth Jain <sama...@apache.org> Authored: Thu Sep 28 22:37:51 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Sep 28 22:37:51 2017 -0700 -- .../apache/phoenix/end2end/UpsertSelectIT.java | 25 ++-- .../org/apache/phoenix/compile/ScanRanges.java | 4 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/acf89db3/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index 6bf6be5..55f2dd0 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -1239,19 +1239,18 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { // Verify that the data upserted using the tenant view can now be queried using tenant view try (Connection tenantConn = getTenantConnection(tenantId)) { -//TODO: enable after PHOENIX-4243 is fixed -//// Query the base table -//PreparedStatement stmt = tenantConn.prepareStatement("SELECT * FROM " + tenantView + " WHERE (PK2, PK3) IN ((?, ?), (?, ?)) ORDER BY KV1"); -//stmt.setDate(1, upsertedDate); -//stmt.setInt(2, 33); -//stmt.setDate(3, new Date(upsertedTs)); -//stmt.setInt(4, 44); -//ResultSet rs = stmt.executeQuery(); -//assertTrue(rs.next()); -//assertEquals("KV13", rs.getString("KV1")); -//assertTrue(rs.next()); -//assertEquals("KV14", rs.getString("KV1")); -//assertFalse(rs.next()); +// Query the base table +PreparedStatement stmt = tenantConn.prepareStatement("SELECT * FROM " + tenantView + " WHERE (PK2, PK3) IN ((?, ?), (?, ?)) ORDER BY KV1"); +stmt.setDate(1, upsertedDate); +stmt.setInt(2, 33); +stmt.setDate(3, new Date(upsertedTs)); +stmt.setInt(4, 44); +ResultSet rs = stmt.executeQuery(); +assertTrue(rs.next()); +assertEquals("KV13", rs.getString("KV1")); +assertTrue(rs.next()); +assertEquals("KV14", rs.getString("KV1")); +assertFalse(rs.next()); //TODO: uncomment the code after PHOENIX-2277 is fixed //// Query using the index on the tenantView http://git-wip-us.apache.org/repos/asf/phoenix/blob/acf89db3/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java index 5a1fcb7..a7909fb 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java @@ -650,8 +650,8 @@ public class ScanRanges { //ranges.set(rowTimestampColPos, sortedRange); //TODO: do I really need to do this? Field f = schema.getField(rowTimestampColPos); SortOrder order = f.getSortOrder(); -KeyRange lowestRange = rowTimestampColRange.get(0); -KeyRange highestRange = rowTimestampColRange.get(rowTimestampColRange.size() - 1); +KeyRange lowestRange = sortedRange.get(0); +KeyRange highestRange = sortedRange.get(rowTimestampColRange.size() - 1); if (order == SortOrder.DESC) { return getDescTimeRange(lowestRange, highestRange, f); }
phoenix git commit: PHOENIX-4243 Using rowtimestamp column with RVC causes an exception sometimes
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 388b21ab8 -> 2a1a2b202 PHOENIX-4243 Using rowtimestamp column with RVC causes an exception sometimes Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/2a1a2b20 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/2a1a2b20 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/2a1a2b20 Branch: refs/heads/4.x-HBase-1.1 Commit: 2a1a2b20241840d5b5eab765562df38bccea1ea2 Parents: 388b21a Author: Samarth Jain <sama...@apache.org> Authored: Thu Sep 28 22:37:06 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Sep 28 22:37:06 2017 -0700 -- .../apache/phoenix/end2end/UpsertSelectIT.java | 25 ++-- .../org/apache/phoenix/compile/ScanRanges.java | 4 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/2a1a2b20/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index 6bf6be5..55f2dd0 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -1239,19 +1239,18 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { // Verify that the data upserted using the tenant view can now be queried using tenant view try (Connection tenantConn = getTenantConnection(tenantId)) { -//TODO: enable after PHOENIX-4243 is fixed -//// Query the base table -//PreparedStatement stmt = tenantConn.prepareStatement("SELECT * FROM " + tenantView + " WHERE (PK2, PK3) IN ((?, ?), (?, ?)) ORDER BY KV1"); -//stmt.setDate(1, upsertedDate); -//stmt.setInt(2, 33); -//stmt.setDate(3, new Date(upsertedTs)); -//stmt.setInt(4, 44); -//ResultSet rs = stmt.executeQuery(); -//assertTrue(rs.next()); -//assertEquals("KV13", rs.getString("KV1")); -//assertTrue(rs.next()); -//assertEquals("KV14", rs.getString("KV1")); -//assertFalse(rs.next()); +// Query the base table +PreparedStatement stmt = tenantConn.prepareStatement("SELECT * FROM " + tenantView + " WHERE (PK2, PK3) IN ((?, ?), (?, ?)) ORDER BY KV1"); +stmt.setDate(1, upsertedDate); +stmt.setInt(2, 33); +stmt.setDate(3, new Date(upsertedTs)); +stmt.setInt(4, 44); +ResultSet rs = stmt.executeQuery(); +assertTrue(rs.next()); +assertEquals("KV13", rs.getString("KV1")); +assertTrue(rs.next()); +assertEquals("KV14", rs.getString("KV1")); +assertFalse(rs.next()); //TODO: uncomment the code after PHOENIX-2277 is fixed //// Query using the index on the tenantView http://git-wip-us.apache.org/repos/asf/phoenix/blob/2a1a2b20/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java index 5a1fcb7..a7909fb 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java @@ -650,8 +650,8 @@ public class ScanRanges { //ranges.set(rowTimestampColPos, sortedRange); //TODO: do I really need to do this? Field f = schema.getField(rowTimestampColPos); SortOrder order = f.getSortOrder(); -KeyRange lowestRange = rowTimestampColRange.get(0); -KeyRange highestRange = rowTimestampColRange.get(rowTimestampColRange.size() - 1); +KeyRange lowestRange = sortedRange.get(0); +KeyRange highestRange = sortedRange.get(rowTimestampColRange.size() - 1); if (order == SortOrder.DESC) { return getDescTimeRange(lowestRange, highestRange, f); }
phoenix git commit: PHOENIX-4243 Using rowtimestamp column with RVC causes an exception sometimes
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 1dc408e07 -> 85e455bd1 PHOENIX-4243 Using rowtimestamp column with RVC causes an exception sometimes Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/85e455bd Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/85e455bd Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/85e455bd Branch: refs/heads/4.x-HBase-0.98 Commit: 85e455bd14bd11b72720c22789f160bc48a14214 Parents: 1dc408e Author: Samarth Jain <sama...@apache.org> Authored: Thu Sep 28 22:25:58 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Sep 28 22:25:58 2017 -0700 -- .../apache/phoenix/end2end/UpsertSelectIT.java | 56 +--- .../org/apache/phoenix/compile/ScanRanges.java | 4 +- 2 files changed, 28 insertions(+), 32 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/85e455bd/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index f358b41..c6ad696 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -1127,7 +1127,6 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { assertEquals("KV2", rs.getString("KV2")); assertEquals("KV3", rs.getString("KV3")); assertFalse(rs.next()); - // Query using the index on base table stmt = conn.prepareStatement("SELECT KV1 FROM " + baseTable + " WHERE PK2 >= ? AND PK2 <= ? AND KV3 = ?"); stmt.setDate(1, new Date(startTime)); @@ -1220,39 +1219,36 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { assertEquals("KV24", rs.getString("KV2")); assertEquals("KV34", rs.getString("KV3")); assertFalse(rs.next()); - -// TODO: enable after PHOENIX-4243 is fixed -//// Query using the index on base table -//stmt = conn.prepareStatement("SELECT KV1 FROM " + baseTable + " WHERE (PK2, KV3) IN ((?, ?), (?, ?)) ORDER BY KV1"); -//stmt.setDate(1, upsertedDate); -//stmt.setString(2, "KV33"); -//stmt.setDate(3, new Date(upsertedTs)); -//stmt.setString(4, "KV34"); -//rs = stmt.executeQuery(); -//QueryPlan plan = stmt.unwrap(PhoenixStatement.class).getQueryPlan(); -// assertTrue(plan.getTableRef().getTable().getName().getString().equals(baseTableIdx)); -//assertTrue(rs.next()); -//assertEquals("KV13", rs.getString("KV1")); -//assertTrue(rs.next()); -//assertEquals("KV14", rs.getString("KV1")); -//assertFalse(rs.next()); +// Query using the index on base table +stmt = conn.prepareStatement("SELECT KV1 FROM " + baseTable + " WHERE (PK2, KV3) IN ((?, ?), (?, ?)) ORDER BY KV1"); +stmt.setDate(1, upsertedDate); +stmt.setString(2, "KV33"); +stmt.setDate(3, new Date(upsertedTs)); +stmt.setString(4, "KV34"); +rs = stmt.executeQuery(); +QueryPlan plan = stmt.unwrap(PhoenixStatement.class).getQueryPlan(); + assertTrue(plan.getTableRef().getTable().getName().getString().equals(baseTableIdx)); +assertTrue(rs.next()); +assertEquals("KV13", rs.getString("KV1")); +assertTrue(rs.next()); +assertEquals("KV14", rs.getString("KV1")); +assertFalse(rs.next()); } // Verify that the data upserted using the tenant view can now be queried using tenant view try (Connection tenantConn = getTenantConnection(tenantId)) { -//TODO: enable after PHOENIX-4243 is fixed -//// Query the base table -//PreparedStatement stmt = tenantConn.prepareStatement("SELECT * FROM " + tenantView + " WHERE (PK2, PK3) IN ((?, ?), (?, ?)) ORDER BY KV1"); -//stmt.setDate(1, upsertedDate); -//stmt.setInt(2, 33); -//stmt.setDate(3, new Date(upsertedTs)); -//stmt.setInt(4, 44); -//ResultSet rs = stmt.executeQuery(); -//assertTrue(rs.next()); -//
phoenix git commit: PHOENIX-4243 Using rowtimestamp column with RVC causes an exception sometimes
Repository: phoenix Updated Branches: refs/heads/master d76a4f4e5 -> a4ce14bad PHOENIX-4243 Using rowtimestamp column with RVC causes an exception sometimes Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a4ce14ba Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a4ce14ba Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a4ce14ba Branch: refs/heads/master Commit: a4ce14badb00eb51c34059c602e33e1a889877e5 Parents: d76a4f4 Author: Samarth Jain <sama...@apache.org> Authored: Thu Sep 28 22:25:32 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Thu Sep 28 22:25:32 2017 -0700 -- .../apache/phoenix/end2end/UpsertSelectIT.java | 56 +--- .../org/apache/phoenix/compile/ScanRanges.java | 4 +- 2 files changed, 28 insertions(+), 32 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a4ce14ba/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java index 2dbb00b..fef5a25 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java @@ -1127,7 +1127,6 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { assertEquals("KV2", rs.getString("KV2")); assertEquals("KV3", rs.getString("KV3")); assertFalse(rs.next()); - // Query using the index on base table stmt = conn.prepareStatement("SELECT KV1 FROM " + baseTable + " WHERE PK2 >= ? AND PK2 <= ? AND KV3 = ?"); stmt.setDate(1, new Date(startTime)); @@ -1220,39 +1219,36 @@ public class UpsertSelectIT extends ParallelStatsDisabledIT { assertEquals("KV24", rs.getString("KV2")); assertEquals("KV34", rs.getString("KV3")); assertFalse(rs.next()); - -// TODO: enable after PHOENIX-4243 is fixed -//// Query using the index on base table -//stmt = conn.prepareStatement("SELECT KV1 FROM " + baseTable + " WHERE (PK2, KV3) IN ((?, ?), (?, ?)) ORDER BY KV1"); -//stmt.setDate(1, upsertedDate); -//stmt.setString(2, "KV33"); -//stmt.setDate(3, new Date(upsertedTs)); -//stmt.setString(4, "KV34"); -//rs = stmt.executeQuery(); -//QueryPlan plan = stmt.unwrap(PhoenixStatement.class).getQueryPlan(); -// assertTrue(plan.getTableRef().getTable().getName().getString().equals(baseTableIdx)); -//assertTrue(rs.next()); -//assertEquals("KV13", rs.getString("KV1")); -//assertTrue(rs.next()); -//assertEquals("KV14", rs.getString("KV1")); -//assertFalse(rs.next()); +// Query using the index on base table +stmt = conn.prepareStatement("SELECT KV1 FROM " + baseTable + " WHERE (PK2, KV3) IN ((?, ?), (?, ?)) ORDER BY KV1"); +stmt.setDate(1, upsertedDate); +stmt.setString(2, "KV33"); +stmt.setDate(3, new Date(upsertedTs)); +stmt.setString(4, "KV34"); +rs = stmt.executeQuery(); +QueryPlan plan = stmt.unwrap(PhoenixStatement.class).getQueryPlan(); + assertTrue(plan.getTableRef().getTable().getName().getString().equals(baseTableIdx)); +assertTrue(rs.next()); +assertEquals("KV13", rs.getString("KV1")); +assertTrue(rs.next()); +assertEquals("KV14", rs.getString("KV1")); +assertFalse(rs.next()); } // Verify that the data upserted using the tenant view can now be queried using tenant view try (Connection tenantConn = getTenantConnection(tenantId)) { -//TODO: enable after PHOENIX-4243 is fixed -//// Query the base table -//PreparedStatement stmt = tenantConn.prepareStatement("SELECT * FROM " + tenantView + " WHERE (PK2, PK3) IN ((?, ?), (?, ?)) ORDER BY KV1"); -//stmt.setDate(1, upsertedDate); -//stmt.setInt(2, 33); -//stmt.setDate(3, new Date(upsertedTs)); -//stmt.setInt(4, 44); -//ResultSet rs = stmt.executeQuery(); -//assertTrue(rs.next()); -//assertEqual
[2/2] phoenix git commit: PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output
PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fd2b064a Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fd2b064a Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fd2b064a Branch: refs/heads/4.x-HBase-1.1 Commit: fd2b064a01f2ef91eca5f0b4fddb3be6b898277c Parents: 3d2f269 Author: Samarth Jain <sama...@apache.org> Authored: Tue Sep 26 23:14:18 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Sep 26 23:14:18 2017 -0700 -- .../org/apache/phoenix/end2end/ArrayIT.java | 3 +- .../end2end/BaseUniqueNamesOwnClusterIT.java| 1 - .../end2end/ExplainPlanWithStatsDisabledIT.java | 64 ++- .../end2end/ExplainPlanWithStatsEnabledIT.java | 413 --- .../phoenix/end2end/ParallelStatsEnabledIT.java | 1 + .../phoenix/end2end/QueryWithOffsetIT.java | 10 +- .../phoenix/end2end/StatsCollectorIT.java | 45 +- .../phoenix/compile/BaseMutationPlan.java | 5 + .../phoenix/compile/DelegateMutationPlan.java | 5 + .../apache/phoenix/compile/DeleteCompiler.java | 48 ++- .../phoenix/compile/ListJarsQueryPlan.java | 5 + .../apache/phoenix/compile/StatementPlan.java | 6 + .../apache/phoenix/compile/TraceQueryPlan.java | 5 + .../apache/phoenix/compile/UpsertCompiler.java | 15 +- .../coprocessor/BaseScannerRegionObserver.java | 1 - .../UngroupedAggregateRegionObserver.java | 14 +- .../apache/phoenix/execute/AggregatePlan.java | 1 + .../apache/phoenix/execute/BaseQueryPlan.java | 12 + .../phoenix/execute/DelegateQueryPlan.java | 5 + .../apache/phoenix/execute/HashJoinPlan.java| 30 +- .../execute/LiteralResultIterationPlan.java | 5 + .../org/apache/phoenix/execute/ScanPlan.java| 12 +- .../phoenix/execute/SortMergeJoinPlan.java | 34 +- .../org/apache/phoenix/execute/UnionPlan.java | 27 +- .../phoenix/iterate/BaseResultIterators.java| 75 +++- .../apache/phoenix/jdbc/PhoenixStatement.java | 53 ++- .../stats/DefaultStatisticsCollector.java | 52 ++- .../phoenix/schema/stats/GuidePostsInfo.java| 59 ++- .../schema/stats/GuidePostsInfoBuilder.java | 48 ++- .../phoenix/schema/stats/StatisticsScanner.java | 2 +- .../phoenix/schema/stats/StatisticsUtil.java| 62 +-- .../phoenix/schema/stats/StatisticsWriter.java | 60 ++- .../schema/tuple/MultiKeyValueTuple.java| 7 +- .../org/apache/phoenix/util/NumberUtil.java | 18 + .../org/apache/phoenix/util/PhoenixRuntime.java | 7 + .../phoenix/filter/SkipScanBigFilterTest.java | 3 +- .../query/ParallelIteratorsSplitTest.java | 5 + .../schema/stats/StatisticsScannerTest.java | 4 +- 38 files changed, 961 insertions(+), 261 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd2b064a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java index d05a200..cf86614 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java @@ -131,8 +131,7 @@ public class ArrayIT extends ParallelStatsDisabledIT { String query = "SELECT a_double_array, /* comment ok? */ b_string, a_float FROM " + tableName + " WHERE ?=organization_id and ?=a_float"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); -//TODO: samarth do we need this - analyzeTable(conn, tableName); +analyzeTable(conn, tableName); try { PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, tenantId); http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd2b064a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java index 9401b2c..7ccbaaf 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java @@ -18,7 +18,6 @@ package org.apache.phoenix.end2end; import org.apache.phoenix.query.BaseTe
[1/2] phoenix git commit: PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 3d2f26966 -> fd2b064a0 http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd2b064a/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 a3a9762..f037a20 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 @@ -66,7 +66,6 @@ import org.apache.hadoop.hbase.filter.PageFilter; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; -import org.apache.phoenix.cache.ServerCacheClient; import org.apache.phoenix.cache.ServerCacheClient.ServerCache; import org.apache.phoenix.compile.QueryPlan; import org.apache.phoenix.compile.RowProjector; @@ -149,6 +148,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result private final List0) { stream = new ByteArrayInputStream(guidePosts.get(), guidePosts.getOffset(), guidePosts.getLength()); @@ -728,11 +735,21 @@ public abstract class BaseResultIterators extends ExplainTable implements Result try { while (currentKey.compareTo(currentGuidePost = PrefixByteCodec.decode(decoder, input)) >= 0 && currentKey.getLength() != 0) { +minGuidePostTimestamp = Math.min(estimateTs, +gps.getGuidePostTimestamps()[guideIndex]); guideIndex++; } -} catch (EOFException e) {} +} catch (EOFException e) { +// expected. Thrown when we have decoded all guide posts. +} } byte[] currentKeyBytes = currentKey.copyBytes(); +boolean intersectWithGuidePosts = guideIndex < gpsSize; +if (!intersectWithGuidePosts) { +// If there are no guide posts within the query range, we use the estimateInfoTimestamp +// as the minimum time across all guideposts +estimateTs = minGuidePostTimestamp; +} // Merge bisect with guideposts for all but the last region while (regionIndex <= stopIndex) { HRegionLocation regionLocation = regionLocations.get(regionIndex); @@ -748,25 +765,37 @@ public abstract class BaseResultIterators extends ExplainTable implements Result endRegionKey = regionInfo.getEndKey(); keyOffset = ScanUtil.getRowKeyOffset(regionInfo.getStartKey(), endRegionKey); } -try { -while (guideIndex < gpsSize && (endKey.length == 0 || currentGuidePost.compareTo(endKey) <= 0)) { -Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, currentGuidePostBytes, keyOffset, -false); -if (newScan != null) { -ScanUtil.setLocalIndexAttributes(newScan, keyOffset, regionInfo.getStartKey(), -regionInfo.getEndKey(), newScan.getStartRow(), newScan.getStopRow()); -estimatedRows +=
[1/2] phoenix git commit: PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.2 cf4f7ea0a -> 6f923a419 http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f923a41/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 a3a9762..f037a20 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 @@ -66,7 +66,6 @@ import org.apache.hadoop.hbase.filter.PageFilter; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; -import org.apache.phoenix.cache.ServerCacheClient; import org.apache.phoenix.cache.ServerCacheClient.ServerCache; import org.apache.phoenix.compile.QueryPlan; import org.apache.phoenix.compile.RowProjector; @@ -149,6 +148,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result private final List0) { stream = new ByteArrayInputStream(guidePosts.get(), guidePosts.getOffset(), guidePosts.getLength()); @@ -728,11 +735,21 @@ public abstract class BaseResultIterators extends ExplainTable implements Result try { while (currentKey.compareTo(currentGuidePost = PrefixByteCodec.decode(decoder, input)) >= 0 && currentKey.getLength() != 0) { +minGuidePostTimestamp = Math.min(estimateTs, +gps.getGuidePostTimestamps()[guideIndex]); guideIndex++; } -} catch (EOFException e) {} +} catch (EOFException e) { +// expected. Thrown when we have decoded all guide posts. +} } byte[] currentKeyBytes = currentKey.copyBytes(); +boolean intersectWithGuidePosts = guideIndex < gpsSize; +if (!intersectWithGuidePosts) { +// If there are no guide posts within the query range, we use the estimateInfoTimestamp +// as the minimum time across all guideposts +estimateTs = minGuidePostTimestamp; +} // Merge bisect with guideposts for all but the last region while (regionIndex <= stopIndex) { HRegionLocation regionLocation = regionLocations.get(regionIndex); @@ -748,25 +765,37 @@ public abstract class BaseResultIterators extends ExplainTable implements Result endRegionKey = regionInfo.getEndKey(); keyOffset = ScanUtil.getRowKeyOffset(regionInfo.getStartKey(), endRegionKey); } -try { -while (guideIndex < gpsSize && (endKey.length == 0 || currentGuidePost.compareTo(endKey) <= 0)) { -Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, currentGuidePostBytes, keyOffset, -false); -if (newScan != null) { -ScanUtil.setLocalIndexAttributes(newScan, keyOffset, regionInfo.getStartKey(), -regionInfo.getEndKey(), newScan.getStartRow(), newScan.getStopRow()); -estimatedRows +=
[2/2] phoenix git commit: PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output
PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6f923a41 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6f923a41 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6f923a41 Branch: refs/heads/4.x-HBase-1.2 Commit: 6f923a4196efc16831c01ec59e5675d433cd9615 Parents: cf4f7ea Author: Samarth Jain <sama...@apache.org> Authored: Tue Sep 26 23:11:05 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Sep 26 23:11:05 2017 -0700 -- .../org/apache/phoenix/end2end/ArrayIT.java | 3 +- .../end2end/BaseUniqueNamesOwnClusterIT.java| 1 - .../end2end/ExplainPlanWithStatsDisabledIT.java | 64 ++- .../end2end/ExplainPlanWithStatsEnabledIT.java | 413 --- .../phoenix/end2end/ParallelStatsEnabledIT.java | 1 + .../phoenix/end2end/QueryWithOffsetIT.java | 10 +- .../phoenix/end2end/StatsCollectorIT.java | 45 +- .../phoenix/compile/BaseMutationPlan.java | 5 + .../phoenix/compile/DelegateMutationPlan.java | 5 + .../apache/phoenix/compile/DeleteCompiler.java | 48 ++- .../phoenix/compile/ListJarsQueryPlan.java | 5 + .../apache/phoenix/compile/StatementPlan.java | 6 + .../apache/phoenix/compile/TraceQueryPlan.java | 5 + .../apache/phoenix/compile/UpsertCompiler.java | 15 +- .../coprocessor/BaseScannerRegionObserver.java | 1 - .../UngroupedAggregateRegionObserver.java | 14 +- .../apache/phoenix/execute/AggregatePlan.java | 1 + .../apache/phoenix/execute/BaseQueryPlan.java | 12 + .../phoenix/execute/DelegateQueryPlan.java | 5 + .../apache/phoenix/execute/HashJoinPlan.java| 30 +- .../execute/LiteralResultIterationPlan.java | 5 + .../org/apache/phoenix/execute/ScanPlan.java| 12 +- .../phoenix/execute/SortMergeJoinPlan.java | 34 +- .../org/apache/phoenix/execute/UnionPlan.java | 27 +- .../phoenix/iterate/BaseResultIterators.java| 75 +++- .../apache/phoenix/jdbc/PhoenixStatement.java | 53 ++- .../stats/DefaultStatisticsCollector.java | 52 ++- .../phoenix/schema/stats/GuidePostsInfo.java| 59 ++- .../schema/stats/GuidePostsInfoBuilder.java | 48 ++- .../phoenix/schema/stats/StatisticsScanner.java | 2 +- .../phoenix/schema/stats/StatisticsUtil.java| 62 +-- .../phoenix/schema/stats/StatisticsWriter.java | 60 ++- .../schema/tuple/MultiKeyValueTuple.java| 7 +- .../org/apache/phoenix/util/NumberUtil.java | 18 + .../org/apache/phoenix/util/PhoenixRuntime.java | 7 + .../phoenix/filter/SkipScanBigFilterTest.java | 3 +- .../query/ParallelIteratorsSplitTest.java | 5 + .../schema/stats/StatisticsScannerTest.java | 4 +- 38 files changed, 961 insertions(+), 261 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f923a41/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java index d05a200..cf86614 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java @@ -131,8 +131,7 @@ public class ArrayIT extends ParallelStatsDisabledIT { String query = "SELECT a_double_array, /* comment ok? */ b_string, a_float FROM " + tableName + " WHERE ?=organization_id and ?=a_float"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); -//TODO: samarth do we need this - analyzeTable(conn, tableName); +analyzeTable(conn, tableName); try { PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, tenantId); http://git-wip-us.apache.org/repos/asf/phoenix/blob/6f923a41/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java index 9401b2c..7ccbaaf 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java @@ -18,7 +18,6 @@ package org.apache.phoenix.end2end; import org.apache.phoenix.query.BaseTe
[2/2] phoenix git commit: PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output
PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f8df6899 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f8df6899 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f8df6899 Branch: refs/heads/4.x-HBase-0.98 Commit: f8df6899726669df44e12552d245264ebee8612f Parents: df1c7e4 Author: Samarth Jain <sama...@apache.org> Authored: Tue Sep 26 23:02:33 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Sep 26 23:02:33 2017 -0700 -- .../org/apache/phoenix/end2end/ArrayIT.java | 3 +- .../end2end/BaseUniqueNamesOwnClusterIT.java| 1 - .../end2end/ExplainPlanWithStatsDisabledIT.java | 64 ++- .../end2end/ExplainPlanWithStatsEnabledIT.java | 413 --- .../phoenix/end2end/ParallelStatsEnabledIT.java | 1 + .../phoenix/end2end/QueryWithOffsetIT.java | 10 +- .../phoenix/end2end/StatsCollectorIT.java | 45 +- .../phoenix/compile/BaseMutationPlan.java | 5 + .../phoenix/compile/DelegateMutationPlan.java | 5 + .../apache/phoenix/compile/DeleteCompiler.java | 48 ++- .../phoenix/compile/ListJarsQueryPlan.java | 5 + .../apache/phoenix/compile/StatementPlan.java | 6 + .../apache/phoenix/compile/TraceQueryPlan.java | 5 + .../apache/phoenix/compile/UpsertCompiler.java | 15 +- .../UngroupedAggregateRegionObserver.java | 31 +- .../apache/phoenix/execute/AggregatePlan.java | 1 + .../apache/phoenix/execute/BaseQueryPlan.java | 12 + .../phoenix/execute/DelegateQueryPlan.java | 5 + .../apache/phoenix/execute/HashJoinPlan.java| 30 +- .../execute/LiteralResultIterationPlan.java | 5 + .../org/apache/phoenix/execute/ScanPlan.java| 12 +- .../phoenix/execute/SortMergeJoinPlan.java | 34 +- .../org/apache/phoenix/execute/UnionPlan.java | 27 +- .../phoenix/iterate/BaseResultIterators.java| 74 +++- .../apache/phoenix/jdbc/PhoenixStatement.java | 53 ++- .../stats/DefaultStatisticsCollector.java | 52 ++- .../phoenix/schema/stats/GuidePostsInfo.java| 59 ++- .../schema/stats/GuidePostsInfoBuilder.java | 48 ++- .../phoenix/schema/stats/StatisticsScanner.java | 2 +- .../phoenix/schema/stats/StatisticsUtil.java| 62 +-- .../phoenix/schema/stats/StatisticsWriter.java | 60 ++- .../schema/tuple/MultiKeyValueTuple.java| 7 +- .../org/apache/phoenix/util/NumberUtil.java | 18 + .../org/apache/phoenix/util/PhoenixRuntime.java | 7 + .../phoenix/filter/SkipScanBigFilterTest.java | 3 +- .../query/ParallelIteratorsSplitTest.java | 5 + .../schema/stats/StatisticsScannerTest.java | 8 +- 37 files changed, 971 insertions(+), 270 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/f8df6899/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java index d05a200..cf86614 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java @@ -131,8 +131,7 @@ public class ArrayIT extends ParallelStatsDisabledIT { String query = "SELECT a_double_array, /* comment ok? */ b_string, a_float FROM " + tableName + " WHERE ?=organization_id and ?=a_float"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); -//TODO: samarth do we need this - analyzeTable(conn, tableName); +analyzeTable(conn, tableName); try { PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, tenantId); http://git-wip-us.apache.org/repos/asf/phoenix/blob/f8df6899/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java index 9401b2c..7ccbaaf 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java @@ -18,7 +18,6 @@ package org.apache.phoenix.end2end; import org.apache.phoenix.query.BaseTest; -import org.junit.AfterClass; import org.junit.
[1/2] phoenix git commit: PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 df1c7e4b9 -> f8df68997 http://git-wip-us.apache.org/repos/asf/phoenix/blob/f8df6899/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 4b50ea9..a64778f 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 @@ -150,6 +150,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result private final List0) { stream = new ByteArrayInputStream(guidePosts.get(), guidePosts.getOffset(), guidePosts.getLength()); @@ -729,11 +737,21 @@ public abstract class BaseResultIterators extends ExplainTable implements Result try { while (currentKey.compareTo(currentGuidePost = PrefixByteCodec.decode(decoder, input)) >= 0 && currentKey.getLength() != 0) { +minGuidePostTimestamp = Math.min(estimateTs, +gps.getGuidePostTimestamps()[guideIndex]); guideIndex++; } -} catch (EOFException e) {} +} catch (EOFException e) { +// expected. Thrown when we have decoded all guide posts. +} } byte[] currentKeyBytes = currentKey.copyBytes(); +boolean intersectWithGuidePosts = guideIndex < gpsSize; +if (!intersectWithGuidePosts) { +// If there are no guide posts within the query range, we use the estimateInfoTimestamp +// as the minimum time across all guideposts +estimateTs = minGuidePostTimestamp; +} // Merge bisect with guideposts for all but the last region while (regionIndex <= stopIndex) { HRegionLocation regionLocation = regionLocations.get(regionIndex); @@ -749,25 +767,37 @@ public abstract class BaseResultIterators extends ExplainTable implements Result endRegionKey = regionInfo.getEndKey(); keyOffset = ScanUtil.getRowKeyOffset(regionInfo.getStartKey(), endRegionKey); } -try { -while (guideIndex < gpsSize && (endKey.length == 0 || currentGuidePost.compareTo(endKey) <= 0)) { -Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, currentGuidePostBytes, keyOffset, -false); -if (newScan != null) { -ScanUtil.setLocalIndexAttributes(newScan, keyOffset, regionInfo.getStartKey(), -regionInfo.getEndKey(), newScan.getStartRow(), newScan.getStopRow()); -estimatedRows += gps.getRowCounts()[guideIndex]; -estimatedSize += gps.getByteCounts()[guideIndex]; -} -if (useStatsForParallelization) { -scans = addNewScan(parallelScans, scans, newScan, currentGuidePostBytes, false, regionLocation); -} -currentKeyBytes = currentGuidePostBytes; +
phoenix git commit: PHOENIX-4007 Addendum to add null check when closing statsWriter
Repository: phoenix Updated Branches: refs/heads/master 6d8357e90 -> 84dc1d44a PHOENIX-4007 Addendum to add null check when closing statsWriter Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/84dc1d44 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/84dc1d44 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/84dc1d44 Branch: refs/heads/master Commit: 84dc1d44ad8cdee9e89bf0a63c411669dc3ec2fd Parents: 6d8357e Author: Samarth Jain <sama...@apache.org> Authored: Tue Sep 26 22:33:19 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Sep 26 22:33:19 2017 -0700 -- .../apache/phoenix/schema/stats/DefaultStatisticsCollector.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/84dc1d44/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java index 6e56229..daf7c70 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/stats/DefaultStatisticsCollector.java @@ -169,7 +169,9 @@ class DefaultStatisticsCollector implements StatisticsCollector { @Override public void close() throws IOException { -this.statsWriter.close(); +if (statsWriter != null) { +this.statsWriter.close(); +} } @Override
[2/2] phoenix git commit: PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output
PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6d8357e9 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6d8357e9 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6d8357e9 Branch: refs/heads/master Commit: 6d8357e9029e639de952d76493203e161e237adb Parents: 176f541 Author: Samarth Jain <sama...@apache.org> Authored: Tue Sep 26 19:21:00 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Tue Sep 26 19:21:00 2017 -0700 -- .../org/apache/phoenix/end2end/ArrayIT.java | 3 +- .../end2end/BaseUniqueNamesOwnClusterIT.java| 1 - .../end2end/ExplainPlanWithStatsDisabledIT.java | 64 ++- .../end2end/ExplainPlanWithStatsEnabledIT.java | 413 --- .../phoenix/end2end/ParallelStatsEnabledIT.java | 1 + .../phoenix/end2end/QueryWithOffsetIT.java | 10 +- .../phoenix/end2end/StatsCollectorIT.java | 45 +- .../phoenix/compile/BaseMutationPlan.java | 5 + .../phoenix/compile/DelegateMutationPlan.java | 5 + .../apache/phoenix/compile/DeleteCompiler.java | 48 ++- .../phoenix/compile/ListJarsQueryPlan.java | 5 + .../apache/phoenix/compile/StatementPlan.java | 6 + .../apache/phoenix/compile/TraceQueryPlan.java | 5 + .../apache/phoenix/compile/UpsertCompiler.java | 15 +- .../coprocessor/BaseScannerRegionObserver.java | 1 - .../UngroupedAggregateRegionObserver.java | 14 +- .../apache/phoenix/execute/AggregatePlan.java | 1 + .../apache/phoenix/execute/BaseQueryPlan.java | 12 + .../phoenix/execute/DelegateQueryPlan.java | 5 + .../apache/phoenix/execute/HashJoinPlan.java| 30 +- .../execute/LiteralResultIterationPlan.java | 5 + .../org/apache/phoenix/execute/ScanPlan.java| 12 +- .../phoenix/execute/SortMergeJoinPlan.java | 34 +- .../org/apache/phoenix/execute/UnionPlan.java | 27 +- .../phoenix/iterate/BaseResultIterators.java| 75 +++- .../apache/phoenix/jdbc/PhoenixStatement.java | 53 ++- .../stats/DefaultStatisticsCollector.java | 48 +-- .../phoenix/schema/stats/GuidePostsInfo.java| 59 ++- .../schema/stats/GuidePostsInfoBuilder.java | 48 ++- .../phoenix/schema/stats/StatisticsScanner.java | 2 +- .../phoenix/schema/stats/StatisticsUtil.java| 62 +-- .../phoenix/schema/stats/StatisticsWriter.java | 60 ++- .../schema/tuple/MultiKeyValueTuple.java| 7 +- .../org/apache/phoenix/util/NumberUtil.java | 18 + .../org/apache/phoenix/util/PhoenixRuntime.java | 7 + .../phoenix/filter/SkipScanBigFilterTest.java | 3 +- .../query/ParallelIteratorsSplitTest.java | 5 + .../schema/stats/StatisticsScannerTest.java | 4 +- 38 files changed, 958 insertions(+), 260 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6d8357e9/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java index d05a200..cf86614 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayIT.java @@ -131,8 +131,7 @@ public class ArrayIT extends ParallelStatsDisabledIT { String query = "SELECT a_double_array, /* comment ok? */ b_string, a_float FROM " + tableName + " WHERE ?=organization_id and ?=a_float"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); -//TODO: samarth do we need this - analyzeTable(conn, tableName); +analyzeTable(conn, tableName); try { PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, tenantId); http://git-wip-us.apache.org/repos/asf/phoenix/blob/6d8357e9/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java -- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java index 9401b2c..7ccbaaf 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseUniqueNamesOwnClusterIT.java @@ -18,7 +18,6 @@ package org.apache.phoenix.end2end; import org.apache.phoenix.query.BaseTest; -impo
[1/2] phoenix git commit: PHOENIX-4007 Surface time at which byte/row estimate information was computed in explain plan output
Repository: phoenix Updated Branches: refs/heads/master 176f541ce -> 6d8357e90 http://git-wip-us.apache.org/repos/asf/phoenix/blob/6d8357e9/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 a3a9762..f037a20 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 @@ -66,7 +66,6 @@ import org.apache.hadoop.hbase.filter.PageFilter; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; -import org.apache.phoenix.cache.ServerCacheClient; import org.apache.phoenix.cache.ServerCacheClient.ServerCache; import org.apache.phoenix.compile.QueryPlan; import org.apache.phoenix.compile.RowProjector; @@ -149,6 +148,7 @@ public abstract class BaseResultIterators extends ExplainTable implements Result private final List0) { stream = new ByteArrayInputStream(guidePosts.get(), guidePosts.getOffset(), guidePosts.getLength()); @@ -728,11 +735,21 @@ public abstract class BaseResultIterators extends ExplainTable implements Result try { while (currentKey.compareTo(currentGuidePost = PrefixByteCodec.decode(decoder, input)) >= 0 && currentKey.getLength() != 0) { +minGuidePostTimestamp = Math.min(estimateTs, +gps.getGuidePostTimestamps()[guideIndex]); guideIndex++; } -} catch (EOFException e) {} +} catch (EOFException e) { +// expected. Thrown when we have decoded all guide posts. +} } byte[] currentKeyBytes = currentKey.copyBytes(); +boolean intersectWithGuidePosts = guideIndex < gpsSize; +if (!intersectWithGuidePosts) { +// If there are no guide posts within the query range, we use the estimateInfoTimestamp +// as the minimum time across all guideposts +estimateTs = minGuidePostTimestamp; +} // Merge bisect with guideposts for all but the last region while (regionIndex <= stopIndex) { HRegionLocation regionLocation = regionLocations.get(regionIndex); @@ -748,25 +765,37 @@ public abstract class BaseResultIterators extends ExplainTable implements Result endRegionKey = regionInfo.getEndKey(); keyOffset = ScanUtil.getRowKeyOffset(regionInfo.getStartKey(), endRegionKey); } -try { -while (guideIndex < gpsSize && (endKey.length == 0 || currentGuidePost.compareTo(endKey) <= 0)) { -Scan newScan = scanRanges.intersectScan(scan, currentKeyBytes, currentGuidePostBytes, keyOffset, -false); -if (newScan != null) { -ScanUtil.setLocalIndexAttributes(newScan, keyOffset, regionInfo.getStartKey(), -regionInfo.getEndKey(), newScan.getStartRow(), newScan.getStopRow()); -estimatedRows +=
phoenix git commit: PHOENIX-4202 Clear client side cache in ConnectionQueryServicesImpl#clearCache()
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 67aa5da88 -> fe0d0bb3b PHOENIX-4202 Clear client side cache in ConnectionQueryServicesImpl#clearCache() Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fe0d0bb3 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fe0d0bb3 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fe0d0bb3 Branch: refs/heads/4.x-HBase-0.98 Commit: fe0d0bb3b729f2d0d10adaf47e2b79ef588b64f0 Parents: 67aa5da Author: Samarth Jain <sama...@apache.org> Authored: Wed Sep 13 15:45:19 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Sep 13 15:45:19 2017 -0700 -- .../query/ConnectionQueryServicesImpl.java | 64 1 file changed, 25 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/fe0d0bb3/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index aca0904..81e12af 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -3373,60 +3373,46 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement */ @Override public long clearCache() throws SQLException { -try { -SQLException sqlE = null; -HTableInterface htable = this.getTable(SchemaUtil - .getPhysicalName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES, this.getProps()).getName()); -try { -tableStatsCache.invalidateAll(); -final Map<byte[], Long> results = -htable.coprocessorService(MetaDataService.class, HConstants.EMPTY_START_ROW, -HConstants.EMPTY_END_ROW, new Batch.Call<MetaDataService, Long>() { +synchronized (latestMetaDataLock) { +latestMetaData = newEmptyMetaData(); +} +tableStatsCache.invalidateAll(); +try (HTableInterface htable = +this.getTable( + SchemaUtil.getPhysicalName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES, +this.getProps()).getName())) { +final Map<byte[], Long> results = +htable.coprocessorService(MetaDataService.class, HConstants.EMPTY_START_ROW, +HConstants.EMPTY_END_ROW, new Batch.Call<MetaDataService, Long>() { @Override public Long call(MetaDataService instance) throws IOException { ServerRpcController controller = new ServerRpcController(); BlockingRpcCallback rpcCallback = new BlockingRpcCallback(); ClearCacheRequest.Builder builder = ClearCacheRequest.newBuilder(); - builder.setClientVersion(VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER)); +builder.setClientVersion( + VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, +PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER)); instance.clearCache(controller, builder.build(), rpcCallback); -if(controller.getFailedOn() != null) { +if (controller.getFailedOn() != null) { throw controller.getFailedOn(); } return rpcCallback.get().getUnfreedBytes(); } }); -long unfreedBytes = 0; -for (Map.Entry<byte[],Long> result : results.entrySet()) { -if (result.getValue() != null) { -unfreedBytes += result.getValue(); -} -} -return unfreedBytes; -} catch (IOException e) { -throw ServerUtil.parseServerException(e); -} catch (Throwable e) { -sqlE = new SQLException(e); -} finally { -try { -tableStatsCache.invalidateAll(); -htable.clo
phoenix git commit: PHOENIX-4202 Clear client side cache in ConnectionQueryServicesImpl#clearCache()
Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.1 e46d3d3dc -> 83ad82d7d PHOENIX-4202 Clear client side cache in ConnectionQueryServicesImpl#clearCache() Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/83ad82d7 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/83ad82d7 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/83ad82d7 Branch: refs/heads/4.x-HBase-1.1 Commit: 83ad82d7d38c08e405497a7551bcc90e11ef57b4 Parents: e46d3d3 Author: Samarth Jain <sama...@apache.org> Authored: Wed Sep 13 15:45:55 2017 -0700 Committer: Samarth Jain <sama...@apache.org> Committed: Wed Sep 13 15:45:55 2017 -0700 -- .../query/ConnectionQueryServicesImpl.java | 64 1 file changed, 25 insertions(+), 39 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/83ad82d7/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 2d8395f..12b2c41 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -3377,60 +3377,46 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement */ @Override public long clearCache() throws SQLException { -try { -SQLException sqlE = null; -HTableInterface htable = this.getTable(SchemaUtil - .getPhysicalName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES, this.getProps()).getName()); -try { -tableStatsCache.invalidateAll(); -final Map<byte[], Long> results = -htable.coprocessorService(MetaDataService.class, HConstants.EMPTY_START_ROW, -HConstants.EMPTY_END_ROW, new Batch.Call<MetaDataService, Long>() { +synchronized (latestMetaDataLock) { +latestMetaData = newEmptyMetaData(); +} +tableStatsCache.invalidateAll(); +try (HTableInterface htable = +this.getTable( + SchemaUtil.getPhysicalName(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES, +this.getProps()).getName())) { +final Map<byte[], Long> results = +htable.coprocessorService(MetaDataService.class, HConstants.EMPTY_START_ROW, +HConstants.EMPTY_END_ROW, new Batch.Call<MetaDataService, Long>() { @Override public Long call(MetaDataService instance) throws IOException { ServerRpcController controller = new ServerRpcController(); BlockingRpcCallback rpcCallback = new BlockingRpcCallback(); ClearCacheRequest.Builder builder = ClearCacheRequest.newBuilder(); - builder.setClientVersion(VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER)); +builder.setClientVersion( + VersionUtil.encodeVersion(PHOENIX_MAJOR_VERSION, +PHOENIX_MINOR_VERSION, PHOENIX_PATCH_NUMBER)); instance.clearCache(controller, builder.build(), rpcCallback); -if(controller.getFailedOn() != null) { +if (controller.getFailedOn() != null) { throw controller.getFailedOn(); } return rpcCallback.get().getUnfreedBytes(); } }); -long unfreedBytes = 0; -for (Map.Entry<byte[],Long> result : results.entrySet()) { -if (result.getValue() != null) { -unfreedBytes += result.getValue(); -} -} -return unfreedBytes; -} catch (IOException e) { -throw ServerUtil.parseServerException(e); -} catch (Throwable e) { -sqlE = new SQLException(e); -} finally { -try { -tableStatsCache.invalidateAll(); -htable.clo