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

ASF subversion and git services commented on NIFI-7190:
-------------------------------------------------------

Commit 83feb0a02d90c3bdb97f453c4248311a615bb4d9 in nifi's branch 
refs/heads/main from Vasily Makarov
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=83feb0a02d ]

NIFI-7190 CaptureChangeMySQL processor remove comments from normalized query

This closes #6711

Co-authored-by: Vasily Makarov <[email protected]>
Co-authored-by: Matt Burgess <[email protected]>
Signed-off-by: David Handermann <[email protected]>


> CaptureChangeMySQL processor doesn't emit DDL events if SQL statement begins 
> with a comment
> -------------------------------------------------------------------------------------------
>
>                 Key: NIFI-7190
>                 URL: https://issues.apache.org/jira/browse/NIFI-7190
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 1.11.2
>            Reporter: Przemyslaw Dubaniewicz
>            Assignee: Makarov Vasiliy Nicolaevich
>            Priority: Minor
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> The existing check for DDL Events doesn't take into account SQL statements 
> that begin with a comment, in file: 
> _nifi/nifi-nar-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java:821_
> {code:java}
> // Check for DDL events (alter table, e.g.). Normalize the query to do string 
> matching on the type of change
> String normalizedQuery = sql.toLowerCase().trim().replaceAll(" {2,}", " ");
> if (normalizedQuery.startsWith("alter table")
>     || normalizedQuery.startsWith("alter ignore table")
>     || normalizedQuery.startsWith("create table")
>     || normalizedQuery.startsWith("truncate table")
>     || normalizedQuery.startsWith("rename table")
>     || normalizedQuery.startsWith("drop table")
>     || normalizedQuery.startsWith("drop database")) {code}
> SQL commands such as:
> {code:sql}
> /* ApplicationName=DataGrip 2019.2.4 */ alter table test_table
>     drop column test_column
> {code}
> won't evaluate to true.



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

Reply via email to