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

Antlr parser fails on column names that are keywords

    XMLWordPrintable

    Details

      Description

      Getting no viable alternative at input, after upgrading from 0.8.0 to 0.9.1.

      no viable alternative at input 'CREATE TABLE my_table (\\n  user_id varchar(64) NOT NULL,\\n  device_id varchar(256) NOT NULL,\\n  item_id varchar(64),\\n  state varchar(256),\\n  reason varchar(256),\\n  status varchar(256),\\n  medium'",
      

      org.antlr.v4.runtime.NoViableAltException: null
              at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2023) ~[antlr4-runtime-4.7.jar:4.7]
              at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467) ~[antlr4-runtime-4.7.jar:4.7]
              at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393) ~[antlr4-runtime-4.7.jar:4.7]
              at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:883) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
              at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:809) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
              at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:71) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
              at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:44) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
              at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
              at io.debezium.relational.history.AbstractDatabaseHistory.lambda$recover$1(AbstractDatabaseHistory.java:104) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
              at com.tg.debezium_kinesis.S3DatabaseHistory$recoverRecords$1.run(S3DatabaseHistory.kt:137) ~[svc-debezium-kinesis.jar:?]
              at io.debezium.util.FunctionalReadWriteLock.write(FunctionalReadWriteLock.java:96) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
              at com.tg.debezium_kinesis.S3DatabaseHistory.recoverRecords(S3DatabaseHistory.kt:131) ~[svc-debezium-kinesis.jar:?]
              at io.debezium.relational.history.AbstractDatabaseHistory.recover(AbstractDatabaseHistory.java:73) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
              at io.debezium.connector.mysql.MySqlSchema.loadHistory(MySqlSchema.java:251) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
              at io.debezium.connector.mysql.MySqlTaskContext.loadHistory(MySqlTaskContext.java:165) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
              at io.debezium.connector.mysql.MySqlConnectorTask.start(MySqlConnectorTask.java:105) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      

      io.debezium.text.ParsingException: no viable alternative at input 'CREATE TABLE my_table (\
        user_id varchar(64) NOT NULL,\
        device_id varchar(256) NOT NULL,\
        item_id varchar(64),\
        state varchar(256),\
        state_reason varchar(256),\
        status varchar(256),\
        medium'
      	at io.debezium.antlr.ParsingErrorListener.syntaxError(ParsingErrorListener.java:40) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41) ~[antlr4-runtime-4.7.jar:4.7]
      	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544) ~[antlr4-runtime-4.7.jar:4.7]
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:282) ~[antlr4-runtime-4.7.jar:4.7]
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:121) ~[antlr4-runtime-4.7.jar:4.7]
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:1075) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:809) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:71) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:44) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.relational.history.AbstractDatabaseHistory.lambda$recover$1(AbstractDatabaseHistory.java:104) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at com.tg.debezium_kinesis.S3DatabaseHistory$recoverRecords$1.run(S3DatabaseHistory.kt:137) ~[svc-debezium-kinesis.jar:?]
      	at io.debezium.util.FunctionalReadWriteLock.write(FunctionalReadWriteLock.java:96) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at com.tg.debezium_kinesis.S3DatabaseHistory.recoverRecords(S3DatabaseHistory.kt:131) ~[svc-debezium-kinesis.jar:?]
      	at io.debezium.relational.history.AbstractDatabaseHistory.recover(AbstractDatabaseHistory.java:73) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlSchema.loadHistory(MySqlSchema.java:251) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlTaskContext.loadHistory(MySqlTaskContext.java:165) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlConnectorTask.start(MySqlConnectorTask.java:105) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      Caused by: org.antlr.v4.runtime.NoViableAltException
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2023) ~[antlr4-runtime-4.7.jar:4.7]
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467) ~[antlr4-runtime-4.7.jar:4.7]
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393) ~[antlr4-runtime-4.7.jar:4.7]
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:883) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:809) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:71) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:44) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.relational.history.AbstractDatabaseHistory.lambda$recover$1(AbstractDatabaseHistory.java:104) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at com.tg.debezium_kinesis.S3DatabaseHistory$recoverRecords$1.run(S3DatabaseHistory.kt:137) ~[svc-debezium-kinesis.jar:?]
      	at io.debezium.util.FunctionalReadWriteLock.write(FunctionalReadWriteLock.java:96) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at com.tg.debezium_kinesis.S3DatabaseHistory.recoverRecords(S3DatabaseHistory.kt:131) ~[svc-debezium-kinesis.jar:?]
      	at io.debezium.relational.history.AbstractDatabaseHistory.recover(AbstractDatabaseHistory.java:73) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlSchema.loadHistory(MySqlSchema.java:251) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlTaskContext.loadHistory(MySqlTaskContext.java:165) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlConnectorTask.start(MySqlConnectorTask.java:105) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	... 5 more
      

      org.apache.kafka.connect.errors.ConnectException: io.debezium.text.ParsingException: no viable alternative at input 'CREATE TABLE my_table (\\n  user_id varchar(64) NOT NULL,\\n  device_id varchar(256) NOT NULL,\\n  item_id varchar(64),\\n  state varchar(256),\\n  reason varchar(256),\\n  status varchar(256),\\n  medium'",
      	at io.debezium.connector.mysql.MySqlConnectorTask.start(MySqlConnectorTask.java:273) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.common.BaseSourceTask.start(BaseSourceTask.java:47) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.embedded.EmbeddedEngine.run(EmbeddedEngine.java:786) [debezium-embedded-0.9.1.Final.jar:0.9.1.Final]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_191]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]
      	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
      Caused by: io.debezium.text.ParsingException: no viable alternative at input 'no viable alternative at input 'CREATE TABLE my_table (\\n  user_id varchar(64) NOT NULL,\\n  device_id varchar(256) NOT NULL,\\n  item_id varchar(64),\\n  state varchar(256),\\n  reason varchar(256),\\n  status varchar(256),\\n  medium'"'
      	at io.debezium.antlr.ParsingErrorListener.syntaxError(ParsingErrorListener.java:40) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41) ~[antlr4-runtime-4.7.jar:4.7]
      	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544) ~[antlr4-runtime-4.7.jar:4.7]
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportNoViableAlternative(DefaultErrorStrategy.java:282) ~[antlr4-runtime-4.7.jar:4.7]
      	at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:121) ~[antlr4-runtime-4.7.jar:4.7]
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:1075) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:809) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:71) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:44) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.relational.history.AbstractDatabaseHistory.lambda$recover$1(AbstractDatabaseHistory.java:104) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at com.tg.debezium_kinesis.S3DatabaseHistory$recoverRecords$1.run(S3DatabaseHistory.kt:137) ~[svc-debezium-kinesis.jar:?]
      	at io.debezium.util.FunctionalReadWriteLock.write(FunctionalReadWriteLock.java:96) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at com.tg.debezium_kinesis.S3DatabaseHistory.recoverRecords(S3DatabaseHistory.kt:131) ~[svc-debezium-kinesis.jar:?]
      	at io.debezium.relational.history.AbstractDatabaseHistory.recover(AbstractDatabaseHistory.java:73) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlSchema.loadHistory(MySqlSchema.java:251) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlTaskContext.loadHistory(MySqlTaskContext.java:165) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlConnectorTask.start(MySqlConnectorTask.java:105) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	... 5 more
      Caused by: org.antlr.v4.runtime.NoViableAltException
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.noViableAlt(ParserATNSimulator.java:2023) ~[antlr4-runtime-4.7.jar:4.7]
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.execATN(ParserATNSimulator.java:467) ~[antlr4-runtime-4.7.jar:4.7]
      	at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:393) ~[antlr4-runtime-4.7.jar:4.7]
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.sqlStatements(MySqlParser.java:883) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:809) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:71) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:44) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80) ~[debezium-ddl-parser-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.relational.history.AbstractDatabaseHistory.lambda$recover$1(AbstractDatabaseHistory.java:104) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at com.tg.debezium_kinesis.S3DatabaseHistory$recoverRecords$1.run(S3DatabaseHistory.kt:137) ~[svc-debezium-kinesis.jar:?]
      	at io.debezium.util.FunctionalReadWriteLock.write(FunctionalReadWriteLock.java:96) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at com.tg.debezium_kinesis.S3DatabaseHistory.recoverRecords(S3DatabaseHistory.kt:131) ~[svc-debezium-kinesis.jar:?]
      	at io.debezium.relational.history.AbstractDatabaseHistory.recover(AbstractDatabaseHistory.java:73) ~[debezium-core-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlSchema.loadHistory(MySqlSchema.java:251) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlTaskContext.loadHistory(MySqlTaskContext.java:165) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	at io.debezium.connector.mysql.MySqlConnectorTask.start(MySqlConnectorTask.java:105) ~[debezium-connector-mysql-0.9.1.Final.jar:0.9.1.Final]
      	... 5 more
      

      Table DDL

      CREATE TABLE my_table (
        user_id varchar(64) NOT NULL,
        device_id varchar(256) NOT NULL,
        item_id varchar(64),
        state varchar(256),
        state_reason varchar(256),
        status varchar(256),
        medium varchar(256),
        timestamp datetime(3),
        updated_at datetime(3) NOT NULL,
        UNIQUE KEY call_states_userid (user_id)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jpechanec Jiri Pechanec
                Reporter:
                oripwk Ori Popowski
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: