Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-3559

Implement support for JSON function in MySQL parser

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 1.6.0.Beta2
    • None
    • mysql-connector
    • None

      Debezium version: 1.5.0.Final

      Connector failed on init on io.debezium.DebeziumException: io.debezium.text.ParsingException: DDL statement couldn't be parsed

      This is the full created table statement as it exists in the DB (I renamed some fields for security purposes)

       

      CREATE TABLE `_my_fake_table` (
       `something_fake_with_id` varbinary(16) NOT NULL,
       `another_fake_thing_with_id` varchar(36) COLLATE utf8mb4_bin GENERATED ALWAYS AS (json_value(`another_fake_thing`, _utf8mb4'$._somefield' returning char(36) character set latin1)) STORED NOT NULL,
       `another_fake_thing` json NOT NULL,
       PRIMARY KEY (`something_fake_with_id`,`another_fake_thing_with_id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED
      

      This is the error we get from the connector

      org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped. at io.debezium.pipeline.ErrorHandler.setProducerThrowable(ErrorHandler.java:42) at io.debezium.pipeline.ChangeEventSourceCoordinator.lambda$start$0(ChangeEventSourceCoordinator.java:121) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: io.debezium.DebeziumException: io.debezium.text.ParsingException: DDL statement couldn't be parsed. Please open a Jira issue with the statement 'CREATE TABLE `_my_fake_table` ( `something_fake_with_id` varbinary(16) NOT NULL, `another_fake_thing_with_id` varchar(36) COLLATE utf8mb4_bin GENERATED ALWAYS AS (json_value(`another_fake_thing`, _utf8mb4'$._somefield' returning char(36) character set latin1)) STORED NOT NULL, `another_fake_thing` json NOT NULL, PRIMARY KEY (`something_fake_with_id`,`another_fake_thing_with_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED' no viable alternative at input 'CREATE TABLE `_my_fake_table` (\n `something_fake_with_id` varbinary(16) NOT NULL,\n `another_fake_thing_with_id` varchar(36) COLLATE utf8mb4_bin GENERATED ALWAYS AS (json_value(`another_fake_thing`, _utf8mb4'$._somefield' returning' at io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.execute(AbstractSnapshotChangeEventSource.java:82) at io.debezium.pipeline.ChangeEventSourceCoordinator.lambda$start$0(ChangeEventSourceCoordinator.java:105) ... 5 more Caused by: io.debezium.text.ParsingException: DDL statement couldn't be parsed. Please open a Jira issue with the statement 'CREATE TABLE `_my_fake_table` ( `something_fake_with_id` varbinary(16) NOT NULL, `another_fake_thing_with_id` varchar(36) COLLATE utf8mb4_bin GENERATED ALWAYS AS (json_value(`another_fake_thing`, _utf8mb4'$._somefield' returning char(36) character set latin1)) STORED NOT NULL, `another_fake_thing` json NOT NULL, PRIMARY KEY (`something_fake_with_id`,`another_fake_thing_with_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED' no viable alternative at input 'CREATE TABLE `_my_fake_table` (\n `something_fake_with_id` varbinary(16) NOT NULL,\n `another_fake_thing_with_id` varchar(36) COLLATE utf8mb4_bin GENERATED ALWAYS AS (json_value(`another_fake_thing`, _utf8mb4'$._somefield' returning' at io.debezium.antlr.ParsingErrorListener.syntaxError(ParsingErrorListener.java:43) at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41) at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544) at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:310) at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:136) at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:1157) at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:885) at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:72) at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:45) at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80) at io.debezium.connector.mysql.MySqlDatabaseSchema.parseDdl(MySqlDatabaseSchema.java:210) at io.debezium.connector.mysql.MySqlDatabaseSchema.parseSnapshotDdl(MySqlDatabaseSchema.java:192) at io.debezium.connector.mysql.MySqlSnapshotChangeEventSource.addSchemaEvent(MySqlSnapshotChangeEventSource.java:301) at io.debezium.connector.mysql.MySqlSnapshotChangeEventSource.lambda$createSchemaEventsForTables$5(MySqlSnapshotChangeEventSource.java:366) at io.debezium.jdbc.JdbcConnection.query(JdbcConnection.java:557) at io.debezium.jdbc.JdbcConnection.query(JdbcConnection.java:498) at io.debezium.connector.mysql.MySqlSnapshotChangeEventSource.createSchemaEventsForTables(MySqlSnapshotChangeEventSource.java:364) at io.debezium.connector.mysql.MySqlSnapshotChangeEventSource.readTableStructure(MySqlSnapshotChangeEventSource.java:355) at io.debezium.relational.RelationalSnapshotChangeEventSource.doExecute(RelationalSnapshotChangeEventSource.java:122) at io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.execute(AbstractSnapshotChangeEventSource.java:71) ... 6 more Caused by: org.antlr.v4.runtime.NoViableAltException at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2026) at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467) at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393) at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:959) ... 20 more

       

              jpechane Jiri Pechanec
              dmitryc-wix Dmitry Chait (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: