diff --git a/lib/lib/flinkParser.js b/lib/lib/flinkParser.js index 8fd8ccd..2312fa5 100644 --- a/lib/lib/flinkParser.js +++ b/lib/lib/flinkParser.js @@ -20,6 +20,9 @@ class SqlErrorListener extends error_1.ErrorListener { } } function parserSingle(sql) { + if (!sql || !sql.trim()) { + return null; + } const inputStream = new antlr4.InputStream(sql.toUpperCase()); const lexer = new sqlLexer_1.sqlLexer(inputStream); const tokenStream = new antlr4.CommonTokenStream(lexer); diff --git a/lib/lib/parser.js b/lib/lib/parser.js index 170f1eb..86d9c0e 100644 --- a/lib/lib/parser.js +++ b/lib/lib/parser.js @@ -9,6 +9,7 @@ var sqlType; sqlType["None"] = "sql"; sqlType["Impala"] = "impala"; })(sqlType || (sqlType = {})); +exports.sqlType = sqlType; function sqlToParserArgs(sql) { let preSql = '', sufSql = ''; if (Object.prototype.toString.call(sql) == '[object Array]') { diff --git a/package.json b/package.json index b0e625a..64110be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dt-sql-parser", - "version": "1.2.1", + "version": "2.0.0", "description": "sql,hive,parser ", "keywords": [ "hive",