virajjasani commented on code in PR #2196: URL: https://github.com/apache/phoenix/pull/2196#discussion_r2155690013
########## phoenix-core/src/it/java/org/apache/phoenix/end2end/CDCDefinitionIT.java: ########## @@ -303,6 +306,44 @@ public void testDropCDCIndex () throws SQLException { } } + @Test + public void testDropTable () throws SQLException { + Properties props = new Properties(); + Connection conn = DriverManager.getConnection(getUrl(), props); + String tableName = generateUniqueName(); + conn.createStatement().execute( + "CREATE TABLE " + tableName + " ( k INTEGER PRIMARY KEY," + " v1 INTEGER," + + " v2 DATE)"); + String cdcName = generateUniqueName(); + String cdc_sql = "CREATE CDC " + cdcName + " ON " + tableName; + conn.createStatement().execute(cdc_sql); + + String drop_table_sql = "DROP TABLE " + tableName; + conn.createStatement().execute(drop_table_sql); + + // index should have been dropped + try (ResultSet rs = conn.createStatement().executeQuery("SELECT index_type FROM " + + "system.catalog WHERE table_name = '" + CDCUtil.getCDCIndexName(cdcName) + + "' AND column_name IS NULL and column_family IS NULL")) { + assertEquals(false, rs.next()); + } + //cdc object should have been dropped + try (ResultSet rs = conn.createStatement().executeQuery("SELECT cdc_include FROM " + + "system.catalog WHERE table_name = '" + cdcName + + "' AND column_name IS NULL and column_family IS NULL")) { + assertEquals(false, rs.next()); + } + + String drop_cdc_sql = "DROP CDC " + cdcName + " ON " + tableName; + try { + conn.createStatement().execute(drop_cdc_sql); + fail("Expected to fail as cdc table doesn't exist"); Review Comment: Nice, one more test with schema and table name, or schema + table name with `"` for case-sensitive table names would also be helpful -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@phoenix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org