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

Labeled create procedure's body is not parsed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.4.1.Final
    • 1.4.0.Final
    • mysql-connector
    • None
    • False
    • False
    • Undefined
    • Hide

      1. Execute the following sql:

      CREATE PROCEDURE `p1`()
      lbl:BEGIN
      END
      

      2. See the connector failure:

      DDL statement couldn't be parsed. Please open a Jira issue with the statement 'CREATE PROCEDURE `p1`()
      lbl:BEGIN
      END'
      no viable alternative at input 'CREATE PROCEDURE `p1`()\nlbl:BE'
        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:1158)
        at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:886)
        at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:68)
        at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:41)
        at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80)
        at io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:326)
        at io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:810)
        at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:590)
        ... 5 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:960)
        ... 12 more
      
      Show
      1. Execute the following sql: CREATE PROCEDURE `p1`() lbl: BEGIN END 2. See the connector failure: DDL statement couldn 't be parsed. Please open a Jira issue with the statement ' CREATE PROCEDURE `p1`() lbl:BEGIN END' no viable alternative at input 'CREATE PROCEDURE `p1`()\nlbl:BE' 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:1158) at io.debezium.ddl.parser.mysql.generated.MySqlParser.root(MySqlParser.java:886) at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:68) at io.debezium.connector.mysql.antlr.MySqlAntlrDdlParser.parseTree(MySqlAntlrDdlParser.java:41) at io.debezium.antlr.AntlrDdlParser.parse(AntlrDdlParser.java:80) at io.debezium.connector.mysql.MySqlSchema.applyDdl(MySqlSchema.java:326) at io.debezium.connector.mysql.BinlogReader.handleQueryEvent(BinlogReader.java:810) at io.debezium.connector.mysql.BinlogReader.handleEvent(BinlogReader.java:590) ... 5 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:960) ... 12 more

      The create procedure statements couldn't be parsed if BEGIN is prefixed with a label. This wasn't the case for v1.2.4. Here is an example of an sql statement that couldn't be parsed:

      CREATE PROCEDURE `p1`()
      lbl:BEGIN
      END
      

      If I insert a space after the column it starts to work:

      CREATE PROCEDURE `p1`()
      lbl: BEGIN
      END
      

      Also if I remove the label it works as well:

      CREATE PROCEDURE `p1`()
      BEGIN
      END
      

      There is the support of this case in the parser grammar, but it's not clear why it doesn't work anymore. It's suspissios that the parser consumes the first two letters of 'BEGIN': no viable alternative at input 'CREATE PROCEDURE `p1`()\nlbl:BE' and then fails. Maybe it's going down a wrong decision tree.

              jpechane Jiri Pechanec
              ramanenka Vadzim Ramanenka (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: