我使用 CCJSqlParser 来解析 sql。我会遇到致命的问题。
我的java代码如下
String sqlStr = "SELECT t1.Key as Key1, t2.Key as Key2 FROM tabel1 as t1, tabel2 as t2 WHERE t1.Key = t2.Key";
Statement statement = CCJSqlParserUtil.parse(sqlStr);
例外情况如下:
12:11:27,608 INFO ParseSqlUtil:29 - start to parse SQL: SELECT t1.Key as Key1, t2.Key as Key2 FROM tabel1 as t1, tabel2 as t2 WHERE t1.Key = t2.Key
net.sf.jsqlparser.JSQLParserException12:11:27,650 INFO SparkTest:347 - excetption:null
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:51)
at com.spark.ml.query.ParseSqlUtil.parseSqlToSparkQueryDto(ParseSqlUtil.java:30)
at com.spark.ml.query.SparkTest.main(SparkTest.java:342)
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered " "." ". "" at line 1, column 10.
Was expecting one of:
<EOF>
"AS" ...
"DO" ...
"INTO" ...
"FROM" ...