HaydenOrz / dt-sql-parser

SQL Parsers for BigData, built with antlr4.
https://dtstack.github.io/monaco-sql-languages/
MIT License
0 stars 0 forks source link

[Bug]: issue test 5 #3

Closed HaydenOrz closed 10 months ago

HaydenOrz commented 10 months ago

version

v5.0.5

Which SQL?

MySQL

SQL content

CREATE TABLE th (id INT, name VARCHAR(30), adate DATE) PARTITION BY LIST(YEAR(adate)) (
  PARTITION p1999 VALUES IN (1995, 1999, 2003)
    DATA DIRECTORY = '/var/appdata/95/data'
    INDEX DIRECTORY = '/var/appdata/95/idx',
  PARTITION p2000 VALUES IN (1996, 2000, 2004)
    DATA DIRECTORY = '/var/appdata/96/data'
    INDEX DIRECTORY = '/var/appdata/96/idx',
  PARTITION p2001 VALUES IN (1997, 2001, 2005)
    DATA DIRECTORY = '/var/appdata/97/data'
    INDEX DIRECTORY = '/var/appdata/97/idx',
  PARTITION p2002 VALUES IN (1998, 2002, 2006)
    DATA DIRECTORY = '/var/appdata/98/data'
    INDEX DIRECTORY = '/var/appdata/98/idx'
);

JavaScript/TypeScript code

const sql = [inValidSQL, validSQL1, validSQL2].join('\n');
        // parse with empty errorListener
        const parseTree = mysql.parse(sql, () => {});
        const splitListener = new MysqlSplitListener();
        mysql.listen(splitListener as MySqlParserListener, parseTree);

        const statementCount = splitListener.statementsContext.length;
        splitListener.statementsContext.map((item, index) => {
            if (index !== statementCount - 1 && index !== statementCount - 2) {
                expect(item.exception).not.toBe(undefined);
            } else {
                expect(item.exception).toBe(undefined);
            }
        });

What happened?

fnjfdsj

const a = 1

Relevant log output

No response