Alex Ramos created CALCITE-4412: ----------------------------------- Summary: SqlParser MySQL mode fails to parse "INT(11)" type Key: CALCITE-4412 URL: https://issues.apache.org/jira/browse/CALCITE-4412 Project: Calcite Issue Type: Bug Components: server Affects Versions: 1.26.0 Environment: Java 11
Windows 10 Reporter: Alex Ramos I am trying to use Calcite to parse some MySQL-style DDL. The parse fails on MySQL-style type declarations that include a display size e.g. int(11). Here is my test code: {code:java} public class SqlParserMysqlTest { private static final Config CONFIG = SqlParser.Config.DEFAULT .withLex(Lex.MYSQL).withConformance(SqlConformanceEnum.MYSQL_5) .withParserFactory(SqlDdlParserImpl.FACTORY); @Test public void testMysqlCreate() throws SqlParseException { SqlParser sqlParser = SqlParser.create( new SourceStringReader("create table `t1` (x int(11))"), CONFIG); SqlNode sqlNode = sqlParser.parseQuery(); Assert.assertEquals(SqlKind.CREATE_TABLE, sqlNode.getKind()); SqlCreateTable create = (SqlCreateTable) sqlNode; Assert.assertEquals("T1", create.name.getSimple()); final SqlColumnDeclaration sqlColumnDeclaration = (SqlColumnDeclaration) create.columnList .get(0); Assert.assertEquals("X", sqlColumnDeclaration.name.getSimple()); Assert.assertEquals("INTEGER", sqlColumnDeclaration.dataType.getTypeName().getSimple()); } } {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)