版本是1.2.5 也试过1.1.23 都不行 sql语句hive可以正常执行的 已验证 String s7 = "WITH A AS (\r\n"
" WITH A1 AS (\r\n" " SELECT *\r\n" " FROMaaa1226.123\r\n"
" LIMIT 1\r\n"
" )\r\n"
" SELECT *\r\n"
" FROM A1\r\n"
" ), \r\n"
" B AS (\r\n"
" SELECT *\r\n"
" FROM aaa1226.123\r\n"
" LIMIT 1\r\n"
" )\r\n"
"SELECT *\r\n"
"FROM A, B";
Assert.assertEquals(s7, SQLUtils.formatHive(s7));
警告: format error
com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'(
WITH A1 AS (
SELECT *
', expect RPAREN, actual WITH pos 19, line 1, column 12, token WITH
at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:344)
at com.alibaba.druid.sql.parser.SQLParser.accept(SQLParser.java:352)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseWithQuery(SQLStatementParser.java:3311)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseWith(SQLStatementParser.java:3327)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:242)
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:171)
at com.alibaba.druid.sql.SQLUtils.format(SQLUtils.java:280)
at com.alibaba.druid.sql.SQLUtils.format(SQLUtils.java:266)
at com.alibaba.druid.sql.SQLUtils.formatHive(SQLUtils.java:161)
at DruidTestSql.main(DruidTestSql.java:79)