You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "e-mhui (via GitHub)" <gi...@apache.org> on 2023/04/05 08:08:07 UTC

[GitHub] [inlong] e-mhui opened a new pull request, #7788: [INLONG-7787][Sort] Fix cannot output drop statement

e-mhui opened a new pull request, #7788:
URL: https://github.com/apache/inlong/pull/7788

   ### Prepare a Pull Request
   
   [INLONG-7787][Sort] Fix cannot output drop statement
   
   - Fixes #7787 
   
   ### Motivation
   
   The `tableChanges` of the drop ddl statement is empty, so it cannot enter the `outputDdlElement()` method. We need to check below whether the drop ddl statement belongs to the currently captured table. If so, output the DDL element.
   
   <img width="1816" alt="image" src="https://user-images.githubusercontent.com/111486498/230014752-bf50e20b-37d2-4726-a4c2-7df3b96095de.png">
   
   ### Modifications
   
   1. Get the ddl statement from `historyRecord` and determine if it is a drop statement.
   2. Obtain its `tableId` and query in the state to check if it belongs to the captured tables.
   
   ```java
               // For drop table ddl, there's no table change events.
               if (tableChanges.isEmpty()) {
                   String ddl = historyRecord.document().getString(Fields.DDL_STATEMENTS);
                   if (ddl.toUpperCase().startsWith(DDL_OP_DROP)) {
                       String tableName = org.apache.inlong.sort.cdc.mysql.source.utils.RecordUtils.getTableName(element);
                       String dbName = org.apache.inlong.sort.cdc.mysql.source.utils.RecordUtils.getDbName(element);
                       TableId tableId = org.apache.inlong.sort.cdc.mysql.source.utils.RecordUtils.getTabelId(dbName, tableName);
                       // If this table is one of the captured tables, output the ddl element.
                       if (splitState.getMySQLSplit().getTableSchemas().containsKey(tableId)) {
                           outputDdlElement(element, output, splitState, null);
                       }
                   }
               }
   ```


-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [inlong] dockerzhang merged pull request #7788: [INLONG-7787][Sort] Fix cannot output drop statement

Posted by "dockerzhang (via GitHub)" <gi...@apache.org>.
dockerzhang merged PR #7788:
URL: https://github.com/apache/inlong/pull/7788


-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org