[ 
https://issues.apache.org/jira/browse/PHOENIX-7074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17776786#comment-17776786
 ] 

ASF GitHub Bot commented on PHOENIX-7074:
-----------------------------------------

TheNamesRai commented on code in PR #1713:
URL: https://github.com/apache/phoenix/pull/1713#discussion_r1364194387


##########
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java:
##########
@@ -3545,6 +3545,18 @@ public MutationState dropIndex(DropIndexStatement 
statement) throws SQLException
                return dropTable(schemaName, tableName, parentTableName, 
PTableType.INDEX, statement.ifExists(), false, false);
     }
 
+    public MutationState dropCDC(DropCDCStatement statement) throws 
SQLException {
+        String schemaName = statement.getTableName().getSchemaName();
+        String cdcTableName = statement.getCdcObjName().getName();
+        String parentTableName = statement.getTableName().getTableName();
+        // Dropping the virtual CDC Table
+        dropTable(schemaName, cdcTableName, parentTableName, PTableType.CDC, 
statement.ifExists(), false, false);
+
+        String indexName = 
CDCUtil.getCDCIndexName(statement.getCdcObjName().getName());
+        // Dropping the uncovered index associated with the CDC Table
+        return dropTable(schemaName, indexName, parentTableName, 
PTableType.INDEX, statement.ifExists(), false, false);

Review Comment:
   Updated: Handled the SQLExceptions from dropping the Index and created a CDC 
Wrapper Exception on it.
   
   I think we need not worry about dropping the CDC index directly as we are 
creating the index with the 2 underscores in the beginning which is preventing 
the index to be dropped directly.
   I tried doing the same but was getting parser exceptions - 
   
   `0: jdbc:phoenix:localhost> DROP INDEX __CDC__CDCTABLE ON DATATABLE;
   Error: ERROR 601 (42P00): Syntax error. Unexpected char: '_' 
(state=42P00,code=601)
   org.apache.phoenix.exception.PhoenixParserException: ERROR 601 (42P00): 
Syntax error. Unexpected char: '_'
        at 
org.apache.phoenix.exception.PhoenixParserException.newException(PhoenixParserException.java:33)`





> Drop CDC implementation
> -----------------------
>
>                 Key: PHOENIX-7074
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7074
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Viraj Jasani
>            Assignee: Saurabh Rai
>            Priority: Major
>
> The implementation of the drop CDC on the CDC object should clean up CDC 
> object entry and also uncovered index created on the data table.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to