You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sa...@apache.org on 2016/11/08 07:54:49 UTC

[02/13] phoenix git commit: PHOENIX-3463 ViewIndexIT#testUpdateOnTenantViewWithGlobalView doesn't test namespace mapping correctly

PHOENIX-3463 ViewIndexIT#testUpdateOnTenantViewWithGlobalView doesn't test namespace mapping correctly


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

Branch: refs/heads/encodecolumns2
Commit: b1063479ccdc2e6e088c00b34bf2704732da0e24
Parents: c030eed
Author: Samarth <sa...@salesforce.com>
Authored: Mon Nov 7 16:48:47 2016 -0800
Committer: Samarth <sa...@salesforce.com>
Committed: Mon Nov 7 16:48:47 2016 -0800

----------------------------------------------------------------------
 .../apache/phoenix/end2end/index/ViewIndexIT.java  | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b1063479/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
index 46aefff..25cb632 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
@@ -317,8 +317,7 @@ public class ViewIndexIT extends ParallelStatsDisabledIT {
 
     @Test
     public void testUpdateOnTenantViewWithGlobalView() throws Exception {
-        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(getUrl(), props);
+        Connection conn = getConnection();
         String baseSchemaName = "PLATFORM_ENTITY";
         String baseTableName = generateUniqueName();
         String baseFullName = SchemaUtil.getTableName(baseSchemaName, baseTableName);
@@ -328,6 +327,9 @@ public class ViewIndexIT extends ParallelStatsDisabledIT {
         String tsViewTableName = "TSV_" + generateUniqueName();
         String tsViewFullName = SchemaUtil.getTableName(baseSchemaName, tsViewTableName);
         try {
+            if (isNamespaceMapped) {
+                conn.createStatement().execute("CREATE SCHEMA IF NOT EXISTS " + baseSchemaName);
+            }
             conn.createStatement().execute(
                     "CREATE TABLE " + baseFullName + "(\n" + "    ORGANIZATION_ID CHAR(15) NOT NULL,\n"
                             + "    KEY_PREFIX CHAR(3) NOT NULL,\n" + "    CREATED_DATE DATE,\n"
@@ -360,21 +362,22 @@ public class ViewIndexIT extends ParallelStatsDisabledIT {
             tsConn.createStatement().execute("UPSERT INTO " + tsViewFullName + "(INT1,DOUBLE1,IS_BOOLEAN,TEXT1) VALUES (10,10.0, true, 'j')");
             tsConn.commit();
             
-            assertRowCount(tsConn, tsViewFullName, baseFullName, 10);
+            String basePhysicalName = SchemaUtil.getPhysicalHBaseTableName(baseFullName, isNamespaceMapped, PTableType.TABLE).getString();
+            assertRowCount(tsConn, tsViewFullName, basePhysicalName, 10);
             
             tsConn.createStatement().execute("DELETE FROM " + tsViewFullName + " WHERE TEXT1='d'");
             tsConn.commit();
-            assertRowCount(tsConn, tsViewFullName, baseFullName, 9);
+            assertRowCount(tsConn, tsViewFullName, basePhysicalName, 9);
 
             tsConn.createStatement().execute("DELETE FROM " + tsViewFullName + " WHERE INT1=2");
             tsConn.commit();
-            assertRowCount(tsConn, tsViewFullName, baseFullName, 8);
+            assertRowCount(tsConn, tsViewFullName, basePhysicalName, 8);
             
             // Use different connection for delete
             Connection tsConn2 = DriverManager.getConnection(getUrl(), tsProps);
             tsConn2.createStatement().execute("DELETE FROM " + tsViewFullName + " WHERE DOUBLE1 > 7.5 AND DOUBLE1 < 9.5");
             tsConn2.commit();
-            assertRowCount(tsConn2, tsViewFullName, baseFullName, 6);
+            assertRowCount(tsConn2, tsViewFullName, basePhysicalName, 6);
             
             tsConn2.createStatement().execute("DROP VIEW " + tsViewFullName);
             // Should drop view and index and remove index data
@@ -400,7 +403,7 @@ public class ViewIndexIT extends ParallelStatsDisabledIT {
             conn.createStatement().execute(
                     "CREATE INDEX " + indexName + " \n" + "ON " + viewFullName + " (TEXT1 DESC, INT1)\n"
                             + "INCLUDE (CREATED_BY, DOUBLE1, IS_BOOLEAN, CREATED_DATE)");
-            assertRowCount(tsConn3, tsViewFullName, baseFullName, 0);
+            assertRowCount(tsConn3, tsViewFullName, basePhysicalName, 0);
             
             tsConn.close();
             tsConn2.close();