phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/master ef48ad2ea -> a9e212e41


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a9e212e4
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a9e212e4
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a9e212e4

Branch: refs/heads/master
Commit: a9e212e41de71dbba82f27ab467ef36974cd6c87
Parents: ef48ad2
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:24:45 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a9e212e4/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 f13510b..f369be9 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,6 +17,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;
@@ -34,7 +35,9 @@ 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.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   PhoenixConfigurationUtil
+  

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 82ba1417f -> fa7ff4f4e


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fa7ff4f4
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fa7ff4f4
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fa7ff4f4

Branch: refs/heads/4.x-HBase-1.3
Commit: fa7ff4f4ea87deaf1fc194d4013318102777a8f4
Parents: 82ba141
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:24:07 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fa7ff4f4/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 f13510b..f369be9 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,6 +17,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;
@@ -34,7 +35,9 @@ 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.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/5.x-HBase-2.0 ea628b4bc -> 0d80b3131


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0d80b313
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0d80b313
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0d80b313

Branch: refs/heads/5.x-HBase-2.0
Commit: 0d80b313117652fe425e9b756d90ed44a26db777
Parents: ea628b4
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:24:32 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0d80b313/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 5fb0184..c227b48 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,6 +17,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;
@@ -35,7 +36,9 @@ import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixResultSet;
+import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1107,4 +1110,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   PhoenixConfigurationUtil
+ 

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 1b14b6215 -> 65f82a9d3


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/65f82a9d
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/65f82a9d
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/65f82a9d

Branch: refs/heads/4.x-cdh5.11.2
Commit: 65f82a9d3c9472104eacf874f0da9efedefc3444
Parents: 1b14b62
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:24:20 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/65f82a9d/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 f13510b..f369be9 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,6 +17,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;
@@ -34,7 +35,9 @@ 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.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 5e56ab47f -> 27d57de73


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/27d57de7
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/27d57de7
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/27d57de7

Branch: refs/heads/4.x-HBase-1.1
Commit: 27d57de736278f074200a9f7a9cd448c9355deb5
Parents: 5e56ab4
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:22:30 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/27d57de7/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 49efa97..a342206 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,6 +17,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;
@@ -34,7 +35,9 @@ 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.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 e4b63d8c8 -> c6a10dc69


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/c6a10dc6
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/c6a10dc6
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/c6a10dc6

Branch: refs/heads/4.x-HBase-1.2
Commit: c6a10dc698133f339731ccade68231e9704cd1a0
Parents: e4b63d8
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:22:40 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c6a10dc6/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 f13510b..f369be9 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,6 +17,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;
@@ -34,7 +35,9 @@ 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.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+   

phoenix git commit: PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use retry looking up the table without tenantId if cannot find the table using the tenantId

2018-02-16 Thread tdsilva
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 770b9e410 -> ac8c9ee97


PHOENIX-4592 BaseResultIterators.getStatsForParallelizationProp() should use 
retry looking up the table without tenantId if cannot find the table using the 
tenantId


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ac8c9ee9
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ac8c9ee9
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ac8c9ee9

Branch: refs/heads/4.x-HBase-0.98
Commit: ac8c9ee970f8c776d3e8cd269e98d50c679e5c38
Parents: 770b9e4
Author: Thomas D'Silva 
Authored: Tue Feb 13 14:31:42 2018 -0800
Committer: Thomas D'Silva 
Committed: Fri Feb 16 10:22:19 2018 -0800

--
 .../end2end/ExplainPlanWithStatsEnabledIT.java  | 32 +
 .../coprocessor/MetaDataEndpointImpl.java   |  9 ++--
 .../phoenix/iterate/BaseResultIterators.java| 41 ++---
 .../util/PhoenixConfigurationUtil.java  | 48 
 4 files changed, 89 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ac8c9ee9/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 c15641d..03cb484 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,6 +17,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;
@@ -34,7 +35,9 @@ 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.mapreduce.util.PhoenixConfigurationUtil;
 import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.apache.phoenix.schema.TableNotFoundException;
 import org.apache.phoenix.util.EnvironmentEdge;
@@ -1104,4 +1107,33 @@ public class ExplainPlanWithStatsEnabledIT extends 
ParallelStatsEnabledIT {
 assertEquals("B", rs.getString(1));
 }
 
+   @Test
+   public void testUseStatsForParallelizationProperyOnViewIndex() throws 
SQLException {
+   String tableName = generateUniqueName();
+   String viewName = generateUniqueName();
+   String tenantViewName = generateUniqueName();
+   String viewIndexName = generateUniqueName();
+   boolean useStats = !DEFAULT_USE_STATS_FOR_PARALLELIZATION;
+   try (Connection conn = DriverManager.getConnection(getUrl())) {
+   conn.createStatement()
+   .execute("create table " + tableName
+   + "(tenantId CHAR(15) 
NOT NULL, pk1 integer NOT NULL, v varchar CONSTRAINT PK PRIMARY KEY "
+   + "(tenantId, pk1)) 
MULTI_TENANT=true");
+   try (Connection tenantConn = 
getTenantConnection("tenant1")) {
+   conn.createStatement().execute("CREATE VIEW " + 
viewName + " AS SELECT * FROM " + tableName);
+   conn.createStatement().execute("CREATE INDEX " 
+ viewIndexName + " on " + viewName + " (v) ");
+   tenantConn.createStatement().execute("CREATE 
VIEW " + tenantViewName + " AS SELECT * FROM " + viewName);
+   conn.createStatement()
+   .execute("ALTER TABLE " + 
tableName + " set USE_STATS_FOR_PARALLELIZATION=" + useStats);
+   // fetch the latest view ptable 
+   PhoenixRuntime.getTableNoCache(tenantConn, 
viewName);
+   PhoenixConnection phxConn = 
conn.unwrap(PhoenixConnection.class);
+   PTable viewIndex = phxConn.getTable(new 
PTableKey(phxConn.getTenantId(), viewIndexName));
+   assertEquals("USE_STATS_FOR_PARALLELIZATION 
property set incorrectly", useStats,
+