Repository: phoenix Updated Branches: refs/heads/master 7601d5942 -> 2d27179b3
http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java index 35e1c62..425e84c 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java @@ -58,16 +58,17 @@ public class ViewIT extends BaseViewIT { super(transactional); } - @Test - public void testReadOnlyView() throws Exception { + @Test + public void testReadOnlyOnReadOnlyView() throws Exception { Connection earlierCon = DriverManager.getConnection(getUrl()); Connection conn = DriverManager.getConnection(getUrl()); - String ddl = "CREATE TABLE " + fullTableName + " (k INTEGER NOT NULL PRIMARY KEY, v1 DATE) "+ tableDDLOptions; + String ddl = "CREATE TABLE " + fullTableName + " (k INTEGER NOT NULL PRIMARY KEY, v1 DATE) "+ tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v (v2 VARCHAR) AS SELECT * FROM " + tableName + " WHERE k > 5"; + String fullParentViewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullParentViewName + " (v2 VARCHAR) AS SELECT * FROM " + tableName + " WHERE k > 5"; conn.createStatement().execute(ddl); try { - conn.createStatement().execute("UPSERT INTO v VALUES(1)"); + conn.createStatement().execute("UPSERT INTO " + fullParentViewName + " VALUES(1)"); fail(); } catch (ReadOnlyTableException e) { @@ -77,42 +78,37 @@ public class ViewIT extends BaseViewIT { } conn.commit(); - analyzeTable(conn, "v", transactional); + analyzeTable(conn, fullParentViewName, transactional); - List<KeyRange> splits = getAllSplits(conn, "v"); + List<KeyRange> splits = getAllSplits(conn, fullParentViewName); assertEquals(4, splits.size()); int count = 0; - ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM " + tableName); + ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM " + fullTableName); while (rs.next()) { assertEquals(count++, rs.getInt(1)); } assertEquals(10, count); count = 0; - rs = conn.createStatement().executeQuery("SELECT k FROM v"); + rs = conn.createStatement().executeQuery("SELECT k FROM " + fullParentViewName); while (rs.next()) { count++; assertEquals(count + 5, rs.getInt(1)); } assertEquals(4, count); count = 0; - rs = earlierCon.createStatement().executeQuery("SELECT k FROM v"); + rs = earlierCon.createStatement().executeQuery("SELECT k FROM " + fullParentViewName); while (rs.next()) { count++; assertEquals(count + 5, rs.getInt(1)); } assertEquals(4, count); - } - - @Test - public void testReadOnlyOnReadOnlyView() throws Exception { - testReadOnlyView(); - Connection conn = DriverManager.getConnection(getUrl()); - String ddl = "CREATE VIEW v2 AS SELECT * FROM v WHERE k < 9"; + String fullViewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName + " AS SELECT * FROM " + fullParentViewName + " WHERE k < 9"; conn.createStatement().execute(ddl); try { - conn.createStatement().execute("UPSERT INTO v2 VALUES(1)"); + conn.createStatement().execute("UPSERT INTO " + fullViewName + " VALUES(1)"); fail(); } catch (ReadOnlyTableException e) { @@ -121,8 +117,8 @@ public class ViewIT extends BaseViewIT { } conn = DriverManager.getConnection(getUrl()); - int count = 0; - ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM v2"); + count = 0; + rs = conn.createStatement().executeQuery("SELECT k FROM " + fullViewName); while (rs.next()) { count++; assertEquals(count + 5, rs.getInt(1)); @@ -142,20 +138,21 @@ public class ViewIT extends BaseViewIT { @Test public void testUpdatableOnUpdatableView() throws Exception { - testUpdatableView(null); + String viewName = testUpdatableView(null); Connection conn = DriverManager.getConnection(getUrl()); - String ddl = "CREATE VIEW v2 AS SELECT * FROM v WHERE k3 = 2"; + String fullViewName = "V_" + generateRandomString(); + String ddl = "CREATE VIEW " + fullViewName + " AS SELECT * FROM " + viewName + " WHERE k3 = 2"; conn.createStatement().execute(ddl); - ResultSet rs = conn.createStatement().executeQuery("SELECT k1, k2, k3 FROM v2"); + ResultSet rs = conn.createStatement().executeQuery("SELECT k1, k2, k3 FROM " + fullViewName); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(109, rs.getInt(2)); assertEquals(2, rs.getInt(3)); assertFalse(rs.next()); - conn.createStatement().execute("UPSERT INTO v2(k2) VALUES(122)"); + conn.createStatement().execute("UPSERT INTO " + fullViewName + "(k2) VALUES(122)"); conn.commit(); - rs = conn.createStatement().executeQuery("SELECT k1, k2, k3 FROM v2 WHERE k2 >= 120"); + rs = conn.createStatement().executeQuery("SELECT k1, k2, k3 FROM " + fullViewName + " WHERE k2 >= 120"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(122, rs.getInt(2)); @@ -163,14 +160,14 @@ public class ViewIT extends BaseViewIT { assertFalse(rs.next()); try { - conn.createStatement().execute("UPSERT INTO v2(k2,k3) VALUES(123,3)"); + conn.createStatement().execute("UPSERT INTO " + fullViewName + "(k2,k3) VALUES(123,3)"); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.CANNOT_UPDATE_VIEW_COLUMN.getErrorCode(), e.getErrorCode()); } try { - conn.createStatement().execute("UPSERT INTO v2(k2,k3) select k2, 3 from v2"); + conn.createStatement().execute("UPSERT INTO " + fullViewName + "(k2,k3) select k2, 3 from " + fullViewName); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.CANNOT_UPDATE_VIEW_COLUMN.getErrorCode(), e.getErrorCode()); @@ -179,11 +176,12 @@ public class ViewIT extends BaseViewIT { @Test public void testReadOnlyOnUpdatableView() throws Exception { - testUpdatableView(null); + String viewName = testUpdatableView(null); Connection conn = DriverManager.getConnection(getUrl()); - String ddl = "CREATE VIEW v2 AS SELECT * FROM v WHERE k3 > 1 and k3 < 50"; + String fullViewName = "V_" + generateRandomString(); + String ddl = "CREATE VIEW " + fullViewName + " AS SELECT * FROM " + viewName + " WHERE k3 > 1 and k3 < 50"; conn.createStatement().execute(ddl); - ResultSet rs = conn.createStatement().executeQuery("SELECT k1, k2, k3 FROM v2"); + ResultSet rs = conn.createStatement().executeQuery("SELECT k1, k2, k3 FROM " + fullViewName); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(109, rs.getInt(2)); @@ -191,7 +189,7 @@ public class ViewIT extends BaseViewIT { assertFalse(rs.next()); try { - conn.createStatement().execute("UPSERT INTO v2 VALUES(1)"); + conn.createStatement().execute("UPSERT INTO " + fullViewName + " VALUES(1)"); fail(); } catch (ReadOnlyTableException e) { @@ -199,7 +197,7 @@ public class ViewIT extends BaseViewIT { conn.createStatement().execute("UPSERT INTO " + fullTableName + "(k1, k2,k3) VALUES(1, 122, 5)"); conn.commit(); - rs = conn.createStatement().executeQuery("SELECT k1, k2, k3 FROM v2 WHERE k2 >= 120"); + rs = conn.createStatement().executeQuery("SELECT k1, k2, k3 FROM " + fullViewName + " WHERE k2 >= 120"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(122, rs.getInt(2)); @@ -212,32 +210,34 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, v1 DECIMAL, CONSTRAINT pk PRIMARY KEY (k1, k2))" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v1(v2 VARCHAR, v3 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; + String fullViewName1 = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName1 + "(v2 VARCHAR, v3 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; conn.createStatement().execute(ddl); try { - conn.createStatement().execute("ALTER VIEW v1 DROP COLUMN v1"); + conn.createStatement().execute("ALTER VIEW " + fullViewName1 + " DROP COLUMN v1"); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode()); } - ddl = "CREATE VIEW v2 AS SELECT * FROM v1 WHERE v2 != 'foo'"; + String fullViewName2 = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName2 + " AS SELECT * FROM " + fullViewName1 + " WHERE v2 != 'foo'"; conn.createStatement().execute(ddl); try { - conn.createStatement().execute("ALTER VIEW v2 DROP COLUMN v1"); + conn.createStatement().execute("ALTER VIEW " + fullViewName2 + " DROP COLUMN v1"); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode()); } try { - conn.createStatement().execute("ALTER VIEW v2 DROP COLUMN v2"); + conn.createStatement().execute("ALTER VIEW " + fullViewName2 + " DROP COLUMN v2"); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.CANNOT_MUTATE_TABLE.getErrorCode(), e.getErrorCode()); } - conn.createStatement().execute("ALTER VIEW v2 DROP COLUMN v3"); + conn.createStatement().execute("ALTER VIEW " + fullViewName2 + " DROP COLUMN v3"); } @@ -245,13 +245,14 @@ public class ViewIT extends BaseViewIT { public void testReadOnlyViewWithCaseSensitiveTableNames() throws Exception { Connection earlierCon = DriverManager.getConnection(getUrl()); Connection conn = DriverManager.getConnection(getUrl()); - String caseSensitiveTableName = "\"case_SENSITIVE_table" + tableSuffix + "\"" ; + String caseSensitiveTableName = "\"t_" + generateRandomString() + "\"" ; String ddl = "CREATE TABLE " + caseSensitiveTableName + " (k INTEGER NOT NULL PRIMARY KEY, v1 DATE)" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW \"v\" (v2 VARCHAR) AS SELECT * FROM " + caseSensitiveTableName + " WHERE k > 5"; + String caseSensitiveViewName = "\"v_" + generateRandomString() + "\"" ; + ddl = "CREATE VIEW " + caseSensitiveViewName + " (v2 VARCHAR) AS SELECT * FROM " + caseSensitiveTableName + " WHERE k > 5"; conn.createStatement().execute(ddl); try { - conn.createStatement().execute("UPSERT INTO \"v\" VALUES(1)"); + conn.createStatement().execute("UPSERT INTO " + caseSensitiveViewName + " VALUES(1)"); fail(); } catch (ReadOnlyTableException e) { @@ -262,14 +263,14 @@ public class ViewIT extends BaseViewIT { conn.commit(); int count = 0; - ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM \"v\""); + ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM " + caseSensitiveViewName); while (rs.next()) { count++; assertEquals(count + 5, rs.getInt(1)); } assertEquals(4, count); count = 0; - rs = earlierCon.createStatement().executeQuery("SELECT k FROM \"v\""); + rs = earlierCon.createStatement().executeQuery("SELECT k FROM " + caseSensitiveViewName); while (rs.next()) { count++; assertEquals(count + 5, rs.getInt(1)); @@ -282,10 +283,11 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (\"k\" INTEGER NOT NULL PRIMARY KEY, \"v1\" INTEGER, \"a\".v2 VARCHAR)" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v (v VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE \"k\" > 5 and \"v1\" > 1"; + String viewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + viewName + " (v VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE \"k\" > 5 and \"v1\" > 1"; conn.createStatement().execute(ddl); try { - conn.createStatement().execute("UPSERT INTO v VALUES(1)"); + conn.createStatement().execute("UPSERT INTO " + viewName + " VALUES(1)"); fail(); } catch (ReadOnlyTableException e) { @@ -296,7 +298,7 @@ public class ViewIT extends BaseViewIT { conn.commit(); int count = 0; - ResultSet rs = conn.createStatement().executeQuery("SELECT \"k\", \"v1\",\"a\".v2 FROM v"); + ResultSet rs = conn.createStatement().executeQuery("SELECT \"k\", \"v1\",\"a\".v2 FROM " + viewName); while (rs.next()) { count++; assertEquals(count + 5, rs.getInt(1)); @@ -309,10 +311,11 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (k INTEGER NOT NULL PRIMARY KEY, v1 INTEGER, v2 DATE)" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v (v VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE v2 > CURRENT_DATE()-5 AND v2 > DATE '2010-01-01'"; + String viewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + viewName + " (v VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE v2 > CURRENT_DATE()-5 AND v2 > DATE '2010-01-01'"; conn.createStatement().execute(ddl); try { - conn.createStatement().execute("UPSERT INTO v VALUES(1)"); + conn.createStatement().execute("UPSERT INTO " + viewName + " VALUES(1)"); fail(); } catch (ReadOnlyTableException e) { @@ -323,7 +326,7 @@ public class ViewIT extends BaseViewIT { conn.commit(); int count = 0; - ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM v"); + ResultSet rs = conn.createStatement().executeQuery("SELECT k FROM " + viewName); while (rs.next()) { assertEquals(count, rs.getInt(1)); count++; @@ -347,40 +350,45 @@ public class ViewIT extends BaseViewIT { Properties props = new Properties(); props.setProperty(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, Boolean.toString(isNamespaceMapped)); Connection conn = DriverManager.getConnection(getUrl(),props); - String fullTableName = "s1.t" + tableSuffix + (isNamespaceMapped ? "_N" : ""); + String schemaName1 = "S_" + generateRandomString(); + String fullTableName1 = SchemaUtil.getTableName(schemaName1, tableName); if (isNamespaceMapped) { - conn.createStatement().execute("CREATE SCHEMA IF NOT EXISTS s1"); + conn.createStatement().execute("CREATE SCHEMA IF NOT EXISTS " + schemaName1); } - String ddl = "CREATE TABLE " + fullTableName + " (k INTEGER NOT NULL PRIMARY KEY, v1 DATE)" + tableDDLOptions; + String ddl = "CREATE TABLE " + fullTableName1 + " (k INTEGER NOT NULL PRIMARY KEY, v1 DATE)" + tableDDLOptions; HBaseAdmin admin = conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin(); conn.createStatement().execute(ddl); - assertTrue(admin.tableExists(SchemaUtil.getPhysicalTableName(SchemaUtil.normalizeIdentifier(fullTableName), + assertTrue(admin.tableExists(SchemaUtil.getPhysicalTableName(SchemaUtil.normalizeIdentifier(fullTableName1), conn.unwrap(PhoenixConnection.class).getQueryServices().getProps()))); - ddl = "CREATE VIEW s2.v1 (v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 5"; + String viewName = "V_" + generateRandomString(); + String viewSchemaName = "S_" + generateRandomString(); + String fullViewName1 = SchemaUtil.getTableName(viewSchemaName, viewName); + ddl = "CREATE VIEW " + fullViewName1 + " (v2 VARCHAR) AS SELECT * FROM " + fullTableName1 + " WHERE k > 5"; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v2 (v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 5"; + String fullViewName2 = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName2 + " (v2 VARCHAR) AS SELECT * FROM " + fullTableName1 + " WHERE k > 5"; conn.createStatement().execute(ddl); - conn.createStatement().executeQuery("SELECT * FROM s2.v1"); - conn.createStatement().executeQuery("SELECT * FROM v2"); - ddl = "DROP VIEW v1"; + conn.createStatement().executeQuery("SELECT * FROM " + fullViewName1); + conn.createStatement().executeQuery("SELECT * FROM " + fullViewName2); + ddl = "DROP VIEW " + viewName; try { conn.createStatement().execute(ddl); fail(); } catch (TableNotFoundException ignore) { } - ddl = "DROP VIEW s2.v1"; + ddl = "DROP VIEW " + fullViewName1; conn.createStatement().execute(ddl); - ddl = "DROP VIEW s2.v2"; + ddl = "DROP VIEW " + SchemaUtil.getTableName(viewSchemaName, generateRandomString()); try { conn.createStatement().execute(ddl); fail(); } catch (TableNotFoundException ignore) { } - ddl = "DROP TABLE " + fullTableName; - validateCannotDropTableWithChildViewsWithoutCascade(conn, fullTableName); - ddl = "DROP VIEW v2"; + ddl = "DROP TABLE " + fullTableName1; + validateCannotDropTableWithChildViewsWithoutCascade(conn, fullTableName1); + ddl = "DROP VIEW " + fullViewName2; conn.createStatement().execute(ddl); - ddl = "DROP TABLE " + fullTableName; + ddl = "DROP TABLE " + fullTableName1; conn.createStatement().execute(ddl); } @@ -390,7 +398,8 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, v1 DECIMAL, CONSTRAINT pk PRIMARY KEY (k1, k2))" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v1(v2 VARCHAR, v3 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; + String viewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + viewName + "(v2 VARCHAR, v3 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; conn.createStatement().execute(ddl); try { @@ -404,15 +413,18 @@ public class ViewIT extends BaseViewIT { @Test public void testViewAndTableAndDropCascade() throws Exception { // Setup - String fullTableName = "s2.t"+tableSuffix; Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (k INTEGER NOT NULL PRIMARY KEY, v1 DATE)" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW s2.v1 (v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 5"; + String viewName = "V_" + generateRandomString(); + String viewSchemaName = "S_" + generateRandomString(); + String fullViewName1 = SchemaUtil.getTableName(viewSchemaName, viewName); + ddl = "CREATE VIEW " + fullViewName1 + " (v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 5"; conn.createStatement().execute(ddl); - ddl = "CREATE LOCAL INDEX idx on s2.v1(v2)"; + ddl = "CREATE LOCAL INDEX idx on " + fullViewName1 + "(v2)"; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW s2.v2 (v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 10"; + String fullViewName2 = SchemaUtil.getTableName(viewSchemaName, "V_" + generateRandomString()); + ddl = "CREATE VIEW " + fullViewName2 + "(v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 10"; conn.createStatement().execute(ddl); validateCannotDropTableWithChildViewsWithoutCascade(conn, fullTableName); @@ -420,8 +432,8 @@ public class ViewIT extends BaseViewIT { // Execute DROP...CASCADE conn.createStatement().execute("DROP TABLE " + fullTableName + " CASCADE"); - validateViewDoesNotExist(conn, "s2.v1"); - validateViewDoesNotExist(conn, "s2.v2"); + validateViewDoesNotExist(conn, fullViewName1); + validateViewDoesNotExist(conn, fullViewName2); } @Test @@ -429,21 +441,26 @@ public class ViewIT extends BaseViewIT { // Setup - Tables and Views with Indexes Connection conn = DriverManager.getConnection(getUrl()); - String fullTableName = "s3.t"+tableSuffix; if (tableDDLOptions.length()!=0) tableDDLOptions+=","; tableDDLOptions+="IMMUTABLE_ROWS=true"; String ddl = "CREATE TABLE " + fullTableName + " (k INTEGER NOT NULL PRIMARY KEY, v1 DATE)" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE INDEX IDX1 ON " + fullTableName + " (v1)"; + String viewSchemaName = "S_" + generateRandomString(); + String fullViewName1 = SchemaUtil.getTableName(viewSchemaName, "V_" + generateRandomString()); + String fullViewName2 = SchemaUtil.getTableName(viewSchemaName, "V_" + generateRandomString()); + String indexName1 = "I_" + generateRandomString(); + String indexName2 = "I_" + generateRandomString(); + String indexName3 = "I_" + generateRandomString(); + ddl = "CREATE INDEX " + indexName1 + " ON " + fullTableName + " (v1)"; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW s3.v1 (v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 5"; + ddl = "CREATE VIEW " + fullViewName1 + " (v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 5"; conn.createStatement().execute(ddl); - ddl = "CREATE INDEX IDX2 ON s3.v1 (v2)"; + ddl = "CREATE INDEX " + indexName2 + " ON " + fullViewName1 + " (v2)"; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW s3.v2 (v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 10"; + ddl = "CREATE VIEW " + fullViewName2 + " (v2 VARCHAR) AS SELECT * FROM " + fullTableName + " WHERE k > 10"; conn.createStatement().execute(ddl); - ddl = "CREATE INDEX IDX3 ON s3.v2 (v2)"; + ddl = "CREATE INDEX " + indexName3 + " ON " + fullViewName2 + " (v2)"; conn.createStatement().execute(ddl); validateCannotDropTableWithChildViewsWithoutCascade(conn, fullTableName); @@ -452,8 +469,8 @@ public class ViewIT extends BaseViewIT { conn.createStatement().execute("DROP TABLE " + fullTableName + " CASCADE"); // Validate Views were deleted - Try and delete child views, should throw TableNotFoundException - validateViewDoesNotExist(conn, "s3.v1"); - validateViewDoesNotExist(conn, "s3.v2"); + validateViewDoesNotExist(conn, fullViewName1); + validateViewDoesNotExist(conn, fullViewName2); } @@ -469,11 +486,11 @@ public class ViewIT extends BaseViewIT { } - private void validateViewDoesNotExist(Connection conn, String viewName) throws SQLException { + private void validateViewDoesNotExist(Connection conn, String fullViewName) throws SQLException { try { - String ddl1 = "DROP VIEW " + viewName; + String ddl1 = "DROP VIEW " + fullViewName; conn.createStatement().execute(ddl1); - fail("View s3.v1 should have been deleted when parent was dropped"); + fail("View " + fullViewName + " should have been deleted when parent was dropped"); } catch (TableNotFoundException e) { //Expected } @@ -498,10 +515,14 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, k3 DECIMAL, s1 VARCHAR, s2 VARCHAR CONSTRAINT pk PRIMARY KEY (k1, k2, k3))" + tableDDLOptions; conn.createStatement().execute(ddl); - conn.createStatement().execute("CREATE " + (localIndex ? "LOCAL " : "") + " INDEX i1 ON " + fullTableName + "(k3, k2) INCLUDE(s1, s2)"); - conn.createStatement().execute("CREATE INDEX i2 ON " + fullTableName + "(k3, k2, s2)"); + String indexName1 = "I_" + generateRandomString(); + String fullIndexName1 = SchemaUtil.getTableName(schemaName, indexName1); + conn.createStatement().execute("CREATE " + (localIndex ? "LOCAL " : "") + " INDEX " + indexName1 + " ON " + fullTableName + "(k3, k2) INCLUDE(s1, s2)"); + String indexName2 = "I_" + generateRandomString(); + conn.createStatement().execute("CREATE INDEX " + indexName2 + " ON " + fullTableName + "(k3, k2, s2)"); - ddl = "CREATE VIEW v AS SELECT * FROM " + fullTableName + " WHERE s1 = 'foo'"; + String fullViewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName + " AS SELECT * FROM " + fullTableName + " WHERE s1 = 'foo'"; conn.createStatement().execute(ddl); String[] s1Values = {"foo","bar"}; for (int i = 0; i < 10; i++) { @@ -509,14 +530,15 @@ public class ViewIT extends BaseViewIT { } conn.commit(); - rs = conn.createStatement().executeQuery("SELECT count(*) FROM v"); + rs = conn.createStatement().executeQuery("SELECT count(*) FROM " + fullViewName); assertTrue(rs.next()); assertEquals(5, rs.getLong(1)); assertFalse(rs.next()); - conn.createStatement().execute("CREATE INDEX vi1 on v(k2)"); + String viewIndexName = "I_" + generateRandomString(); + conn.createStatement().execute("CREATE INDEX " + viewIndexName + " on " + fullViewName + "(k2)"); - String query = "SELECT k2 FROM v WHERE k2 IN (100,109) AND k3 IN (1,2) AND s2='bas'"; + String query = "SELECT k2 FROM " + fullViewName + " WHERE k2 IN (100,109) AND k3 IN (1,2) AND s2='bas'"; rs = conn.createStatement().executeQuery(query); assertTrue(rs.next()); assertEquals(100, rs.getInt(1)); @@ -530,7 +552,7 @@ public class ViewIT extends BaseViewIT { "CLIENT MERGE SORT", queryPlan); } else { assertEquals( - "CLIENT PARALLEL 1-WAY SKIP SCAN ON 4 KEYS OVER I1 [1,100] - [2,109]\n" + + "CLIENT PARALLEL 1-WAY SKIP SCAN ON 4 KEYS OVER " + fullIndexName1 + " [1,100] - [2,109]\n" + " SERVER FILTER BY (\"S2\" = 'bas' AND \"S1\" = 'foo')", queryPlan); } } @@ -540,16 +562,17 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, v1 DECIMAL, CONSTRAINT pk PRIMARY KEY (k1, k2))" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v1(v2 VARCHAR, k3 VARCHAR PRIMARY KEY) AS SELECT * FROM " + fullTableName + " WHERE K1 = 1"; + String fullViewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName + "(v2 VARCHAR, k3 VARCHAR PRIMARY KEY) AS SELECT * FROM " + fullTableName + " WHERE K1 = 1"; conn.createStatement().execute(ddl); // assert PK metadata - ResultSet rs = conn.getMetaData().getPrimaryKeys(null, null, "V1"); + ResultSet rs = conn.getMetaData().getPrimaryKeys(null, null, fullViewName); assertPKs(rs, new String[] {"K1", "K2", "K3"}); // sanity check upserts into base table and view conn.createStatement().executeUpdate("upsert into " + fullTableName + " (k1, k2, v1) values (1, 1, 1)"); - conn.createStatement().executeUpdate("upsert into v1 (k1, k2, k3, v2) values (1, 1, 'abc', 'def')"); + conn.createStatement().executeUpdate("upsert into " + fullViewName + " (k1, k2, k3, v2) values (1, 1, 'abc', 'def')"); conn.commit(); // expect 2 rows in the base table @@ -558,7 +581,7 @@ public class ViewIT extends BaseViewIT { assertEquals(2, rs.getInt(1)); // expect 2 row in the view - rs = conn.createStatement().executeQuery("select count(*) from v1"); + rs = conn.createStatement().executeQuery("select count(*) from " + fullViewName); assertTrue(rs.next()); assertEquals(2, rs.getInt(1)); } @@ -568,11 +591,12 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, v1 DECIMAL, CONSTRAINT pk PRIMARY KEY (k1, k2))" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v1(v2 VARCHAR, k3 VARCHAR, k4 INTEGER NOT NULL, CONSTRAINT PKVEW PRIMARY KEY (k3, k4)) AS SELECT * FROM " + fullTableName + " WHERE K1 = 1"; + String fullViewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName + "(v2 VARCHAR, k3 VARCHAR, k4 INTEGER NOT NULL, CONSTRAINT PKVEW PRIMARY KEY (k3, k4)) AS SELECT * FROM " + fullTableName + " WHERE K1 = 1"; conn.createStatement().execute(ddl); // assert PK metadata - ResultSet rs = conn.getMetaData().getPrimaryKeys(null, null, "V1"); + ResultSet rs = conn.getMetaData().getPrimaryKeys(null, null, fullViewName); assertPKs(rs, new String[] {"K1", "K2", "K3", "K4"}); } @@ -582,13 +606,14 @@ public class ViewIT extends BaseViewIT { String fullTableName2 = fullTableName; String ddl = "CREATE TABLE " + fullTableName2 + " (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, v1 DECIMAL, CONSTRAINT pk PRIMARY KEY (k1, k2))" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v1 AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; + String fullViewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName + " AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; conn.createStatement().execute(ddl); - ddl = "ALTER VIEW V1 ADD k3 VARCHAR PRIMARY KEY, k4 VARCHAR PRIMARY KEY, v2 INTEGER"; + ddl = "ALTER VIEW " + fullViewName + " ADD k3 VARCHAR PRIMARY KEY, k4 VARCHAR PRIMARY KEY, v2 INTEGER"; conn.createStatement().execute(ddl); // assert PK metadata - ResultSet rs = conn.getMetaData().getPrimaryKeys(null, null, "V1"); + ResultSet rs = conn.getMetaData().getPrimaryKeys(null, null, fullViewName); assertPKs(rs, new String[] {"K1", "K2", "K3", "K4"}); } @@ -597,16 +622,18 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (k1 INTEGER NOT NULL, k2 VARCHAR NOT NULL, v1 DECIMAL, CONSTRAINT pk PRIMARY KEY (k1, k2))" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v1 AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; + String fullViewName1 = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName1 + " AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; conn.createStatement().execute(ddl); - ddl = "ALTER VIEW V1 ADD k3 VARCHAR PRIMARY KEY, k4 VARCHAR PRIMARY KEY, v2 INTEGER"; + ddl = "ALTER VIEW " + fullViewName1 + " ADD k3 VARCHAR PRIMARY KEY, k4 VARCHAR PRIMARY KEY, v2 INTEGER"; try { conn.createStatement().execute(ddl); fail("View cannot extend PK if parent's last PK is variable length. See https://issues.apache.org/jira/browse/PHOENIX-978."); } catch (SQLException e) { assertEquals(CANNOT_MODIFY_VIEW_PK.getErrorCode(), e.getErrorCode()); } - ddl = "CREATE VIEW v2 (k3 VARCHAR PRIMARY KEY) AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; + String fullViewName2 = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName2 + " (k3 VARCHAR PRIMARY KEY) AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; try { conn.createStatement().execute(ddl); } catch (SQLException e) { @@ -619,9 +646,10 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, v1 DECIMAL, CONSTRAINT pk PRIMARY KEY (k1, k2))" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v1 AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; + String fullViewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName + " AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; conn.createStatement().execute(ddl); - ddl = "ALTER VIEW V1 ADD k3 VARCHAR PRIMARY KEY, k2 VARCHAR PRIMARY KEY, v2 INTEGER"; + ddl = "ALTER VIEW " + fullViewName + " ADD k3 VARCHAR PRIMARY KEY, k2 VARCHAR PRIMARY KEY, v2 INTEGER"; conn.createStatement().execute(ddl); } @@ -630,10 +658,11 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String ddl = "CREATE TABLE " + fullTableName + " (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, v1 DECIMAL, CONSTRAINT pk PRIMARY KEY (k1, k2))" + tableDDLOptions; conn.createStatement().execute(ddl); - ddl = "CREATE VIEW v1 AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; + String fullViewName = "V_" + generateRandomString(); + ddl = "CREATE VIEW " + fullViewName + " AS SELECT * FROM " + fullTableName + " WHERE v1 = 1.0"; conn.createStatement().execute(ddl); try { - ddl = "ALTER VIEW V1 ADD k3 VARCHAR NOT NULL PRIMARY KEY"; + ddl = "ALTER VIEW " + fullViewName + " ADD k3 VARCHAR NOT NULL PRIMARY KEY"; conn.createStatement().execute(ddl); fail("can only add nullable PKs via ALTER VIEW/TABLE"); } catch (SQLException e) { @@ -646,17 +675,19 @@ public class ViewIT extends BaseViewIT { Connection conn = DriverManager.getConnection(getUrl()); String sql = "CREATE TABLE " + fullTableName + " (k1 INTEGER NOT NULL, k2 INTEGER NOT NULL, v1 DECIMAL, CONSTRAINT pk PRIMARY KEY (k1, k2))" + tableDDLOptions; conn.createStatement().execute(sql); - sql = "CREATE VIEW v1 AS SELECT * FROM " + fullTableName; + String fullViewName1 = "V_" + generateRandomString(); + sql = "CREATE VIEW " + fullViewName1 + " AS SELECT * FROM " + fullTableName; conn.createStatement().execute(sql); - sql = "CREATE VIEW v2 AS SELECT * FROM " + fullTableName + " WHERE k1 = 1.0"; + String fullViewName2 = "V_" + generateRandomString(); + sql = "CREATE VIEW " + fullViewName2 + " AS SELECT * FROM " + fullTableName + " WHERE k1 = 1.0"; conn.createStatement().execute(sql); - sql = "SELECT * FROM v1 order by k1, k2"; + sql = "SELECT * FROM " + fullViewName1 + " order by k1, k2"; PreparedStatement stmt = conn.prepareStatement(sql); QueryPlan plan = PhoenixRuntime.getOptimizedQueryPlan(stmt); assertEquals(0, plan.getOrderBy().getOrderByExpressions().size()); - sql = "SELECT * FROM v2 order by k1, k2"; + sql = "SELECT * FROM " + fullViewName2 + " order by k1, k2"; stmt = conn.prepareStatement(sql); plan = PhoenixRuntime.getOptimizedQueryPlan(stmt); assertEquals(0, plan.getOrderBy().getOrderByExpressions().size()); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexWithStatsIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexWithStatsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexWithStatsIT.java index 32f272d..d03b6fa 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexWithStatsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ImmutableIndexWithStatsIT.java @@ -25,39 +25,25 @@ import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.util.Map; import java.util.Properties; -import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; -import org.apache.phoenix.query.QueryServices; +import org.apache.phoenix.end2end.ParallelStatsEnabledIT; import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; -import org.apache.phoenix.util.ReadOnlyProps; -import org.apache.phoenix.util.TestUtil; -import org.junit.BeforeClass; import org.junit.Test; -import com.google.common.collect.Maps; - -public class ImmutableIndexWithStatsIT extends BaseOwnClusterHBaseManagedTimeIT { +public class ImmutableIndexWithStatsIT extends ParallelStatsEnabledIT { - @BeforeClass - public static void doSetup() throws Exception { - Map<String,String> props = Maps.newHashMapWithExpectedSize(5); - props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, Long.toString(1)); - setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator())); - } - @Test public void testIndexCreationDeadlockWithStats() throws Exception { String query; ResultSet rs; + String tableName = generateRandomString(); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(false); - String tableName = TestUtil.DEFAULT_DATA_TABLE_FULL_NAME; conn.createStatement().execute("CREATE TABLE " + tableName + " (k VARCHAR NOT NULL PRIMARY KEY, v VARCHAR) IMMUTABLE_ROWS=TRUE"); query = "SELECT * FROM " + tableName; rs = conn.createStatement().executeQuery(query); @@ -65,8 +51,8 @@ public class ImmutableIndexWithStatsIT extends BaseOwnClusterHBaseManagedTimeIT PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + tableName + " VALUES(?,?)"); for (int i=0; i<6;i++) { - stmt.setString(1,"k" + i); - stmt.setString(2, "v" + i ); + stmt.setString(1, "kkkkkkkkkk" + i); + stmt.setString(2, "vvvvvvvvvv" + i ); stmt.execute(); } conn.commit(); @@ -76,7 +62,7 @@ public class ImmutableIndexWithStatsIT extends BaseOwnClusterHBaseManagedTimeIT rs = conn.createStatement().executeQuery("EXPLAIN " + query); assertTrue(QueryUtil.getExplainPlan(rs).startsWith("CLIENT PARALLEL 1-WAY FULL SCAN")); - String indexName = TestUtil.DEFAULT_INDEX_TABLE_NAME; + String indexName = "I_" + generateRandomString(); conn.createStatement().execute("CREATE INDEX " + indexName + " ON " + tableName + " (v)"); query = "SELECT * FROM " + indexName; http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java index ff74dc8..0657d54 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexFailureIT.java @@ -43,7 +43,7 @@ import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver; import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; +import org.apache.phoenix.end2end.BaseOwnClusterIT; import org.apache.phoenix.end2end.NeedsOwnMiniClusterTest; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.query.QueryConstants; @@ -74,7 +74,7 @@ import com.google.common.collect.Maps; @Category(NeedsOwnMiniClusterTest.class) @RunWith(Parameterized.class) -public class MutableIndexFailureIT extends BaseOwnClusterHBaseManagedTimeIT { +public class MutableIndexFailureIT extends BaseOwnClusterIT { public static volatile boolean FAIL_WRITE = false; public static final String INDEX_NAME = "IDX"; http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ReadOnlyIndexFailureIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ReadOnlyIndexFailureIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ReadOnlyIndexFailureIT.java index 1dae126..a2213ea 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ReadOnlyIndexFailureIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ReadOnlyIndexFailureIT.java @@ -43,7 +43,7 @@ import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver; import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; +import org.apache.phoenix.end2end.BaseOwnClusterIT; import org.apache.phoenix.end2end.NeedsOwnMiniClusterTest; import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.hbase.index.Indexer; @@ -77,7 +77,7 @@ import com.google.common.collect.Maps; @Category(NeedsOwnMiniClusterTest.class) @RunWith(Parameterized.class) -public class ReadOnlyIndexFailureIT extends BaseOwnClusterHBaseManagedTimeIT { +public class ReadOnlyIndexFailureIT extends BaseOwnClusterIT { public static volatile boolean FAIL_WRITE = false; public static final String INDEX_NAME = "IDX"; http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/TxWriteFailureIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/TxWriteFailureIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/TxWriteFailureIT.java index 0202128..03990c1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/TxWriteFailureIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/TxWriteFailureIT.java @@ -41,7 +41,7 @@ import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment; import org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver; import org.apache.hadoop.hbase.regionserver.wal.WALEdit; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; +import org.apache.phoenix.end2end.BaseOwnClusterIT; import org.apache.phoenix.hbase.index.Indexer; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.util.PropertiesUtil; @@ -57,7 +57,7 @@ import org.junit.runners.Parameterized.Parameters; import com.google.common.collect.Maps; @RunWith(Parameterized.class) -public class TxWriteFailureIT extends BaseOwnClusterHBaseManagedTimeIT { +public class TxWriteFailureIT extends BaseOwnClusterIT { private static final String SCHEMA_NAME = "S"; private static final String DATA_TABLE_NAME = "T"; http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java index 6758abc..a5555f3 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java @@ -56,6 +56,7 @@ import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.query.QueryServices; import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.util.ReadOnlyProps; +import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -81,6 +82,10 @@ public class PartialCommitIT extends BaseOwnClusterIT { private static final byte[] ROW_TO_FAIL_DELETE_BYTES = Bytes.toBytes("fail me delete"); private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); + @Override + @After + public void cleanUpAfterTest() throws Exception {} + @BeforeClass public static void doSetup() throws Exception { Map<String, String> serverProps = Maps.newHashMapWithExpectedSize(10); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/iterate/RoundRobinResultIteratorWithStatsIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/iterate/RoundRobinResultIteratorWithStatsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/iterate/RoundRobinResultIteratorWithStatsIT.java index ddf17ba..c7c0b39 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/iterate/RoundRobinResultIteratorWithStatsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/iterate/RoundRobinResultIteratorWithStatsIT.java @@ -29,7 +29,7 @@ import java.util.List; import java.util.Map; import org.apache.phoenix.compile.StatementContext; -import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; +import org.apache.phoenix.end2end.BaseOwnClusterIT; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.jdbc.PhoenixStatement; @@ -41,7 +41,7 @@ import org.junit.Test; import com.google.common.collect.Maps; -public class RoundRobinResultIteratorWithStatsIT extends BaseOwnClusterHBaseManagedTimeIT { +public class RoundRobinResultIteratorWithStatsIT extends BaseOwnClusterIT { @BeforeClass public static void doSetup() throws Exception { http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java index eed0e48..fd6f91a 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixMetricsIT.java @@ -46,7 +46,7 @@ import java.util.Properties; import java.util.Set; import org.apache.phoenix.compile.StatementContext; -import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; +import org.apache.phoenix.end2end.BaseOwnClusterIT; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.jdbc.PhoenixResultSet; import org.apache.phoenix.query.QueryServices; @@ -61,7 +61,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -public class PhoenixMetricsIT extends BaseOwnClusterHBaseManagedTimeIT { +public class PhoenixMetricsIT extends BaseOwnClusterIT { private static final List<String> mutationMetricsToSkip = Lists .newArrayList(MetricType.MUTATION_COMMIT_TIME.name()); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixClientRpcIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixClientRpcIT.java b/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixClientRpcIT.java index 2ccf490..c015f66 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixClientRpcIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixClientRpcIT.java @@ -23,7 +23,7 @@ import java.util.Properties; import org.apache.hadoop.hbase.ipc.CallRunner; import org.apache.hadoop.hbase.regionserver.RSRpcServices; -import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; +import org.apache.phoenix.end2end.BaseOwnClusterIT; import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; @@ -33,7 +33,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; -public class PhoenixClientRpcIT extends BaseOwnClusterHBaseManagedTimeIT { +public class PhoenixClientRpcIT extends BaseOwnClusterIT { private static final String SCHEMA_NAME = "S"; private static final String INDEX_TABLE_NAME = "I"; http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java b/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java index 75eebc2..6605f16 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/rpc/PhoenixServerRpcIT.java @@ -43,7 +43,7 @@ import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.regionserver.RSRpcServices; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.phoenix.end2end.BaseOwnClusterHBaseManagedTimeIT; +import org.apache.phoenix.end2end.BaseOwnClusterIT; import org.apache.phoenix.util.PropertiesUtil; import org.apache.phoenix.util.QueryUtil; import org.apache.phoenix.util.ReadOnlyProps; @@ -53,7 +53,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; -public class PhoenixServerRpcIT extends BaseOwnClusterHBaseManagedTimeIT { +public class PhoenixServerRpcIT extends BaseOwnClusterIT { private static final String SCHEMA_NAME = "S"; private static final String INDEX_TABLE_NAME = "I"; http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java index 18a0b23..c72e404 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java @@ -334,6 +334,10 @@ public class MetaDataUtil { public static String getViewIndexSchemaName(String schemaName) { return schemaName; } + + public static String getViewIndexName(String schemaName, String tableName) { + return SchemaUtil.getTableName(getViewIndexSchemaName(schemaName), getViewIndexTableName(tableName)); + } public static byte[] getIndexPhysicalName(byte[] physicalTableName, String indexPrefix) { return getIndexPhysicalName(Bytes.toString(physicalTableName), indexPrefix).getBytes(); http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java index 57df138..74fa3fa 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java @@ -49,7 +49,6 @@ import static org.apache.phoenix.util.TestUtil.JOIN_CUSTOMER_TABLE_FULL_NAME; import static org.apache.phoenix.util.TestUtil.JOIN_ITEM_TABLE_FULL_NAME; import static org.apache.phoenix.util.TestUtil.JOIN_ORDER_TABLE_FULL_NAME; import static org.apache.phoenix.util.TestUtil.JOIN_SUPPLIER_TABLE_FULL_NAME; -import static org.apache.phoenix.util.TestUtil.KEYONLY_NAME; import static org.apache.phoenix.util.TestUtil.MDTEST_NAME; import static org.apache.phoenix.util.TestUtil.MULTI_CF_NAME; import static org.apache.phoenix.util.TestUtil.PARENTID1; @@ -337,9 +336,6 @@ public abstract class BaseTest { " \"1\".\"value\" integer,\n" + " \"1\".\"_blah^\" varchar)" ); - builder.put(KEYONLY_NAME,"create table " + KEYONLY_NAME + - " (i1 integer not null, i2 integer not null\n" + - " CONSTRAINT pk PRIMARY KEY (i1,i2))"); builder.put(MDTEST_NAME,"create table " + MDTEST_NAME + " (id char(1) primary key,\n" + " a.col1 integer,\n" + http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java index cddd762..5500e7a 100644 --- a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java +++ b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java @@ -569,14 +569,6 @@ public class TestUtil { return tableStats.getGuidePosts().values(); } - public static List<KeyRange> getSplits(Connection conn, byte[] lowerRange, byte[] upperRange) throws SQLException { - return getSplits(conn, STABLE_NAME, STABLE_PK_NAME, lowerRange, upperRange, null, "COUNT(*)"); - } - - public static List<KeyRange> getAllSplits(Connection conn) throws SQLException { - return getAllSplits(conn, STABLE_NAME); - } - public static void analyzeTable(Connection conn, String tableName) throws IOException, SQLException { analyzeTable(conn, tableName, false); } @@ -593,13 +585,8 @@ public class TestUtil { conn.createStatement().execute(query); } - public static void analyzeTableColumns(Connection conn) throws IOException, SQLException { - String query = "UPDATE STATISTICS " + STABLE_NAME+ " COLUMNS"; - conn.createStatement().execute(query); - } - - public static void analyzeTable(Connection conn) throws IOException, SQLException { - String query = "UPDATE STATISTICS " + STABLE_NAME; + public static void analyzeTableColumns(Connection conn, String tableName) throws IOException, SQLException { + String query = "UPDATE STATISTICS " + tableName + " COLUMNS"; conn.createStatement().execute(query); } http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 3c000e2..825c0d7 100644 --- a/pom.xml +++ b/pom.xml @@ -250,9 +250,6 @@ <execution> <id>ParallelStatsDisabledTest</id> <configuration> - <!--includes> - <include>TenantIdTypeIT</include> - </includes--> <encoding>UTF-8</encoding> <forkCount>${numForkedIT}</forkCount> <runOrder>alphabetical</runOrder>