JSqlParser
JSqlParser copied to clipboard
I use it to analyze clickhouse sql,But there is a problem,Can you show me
select b.name, a.pay_amount, a.partner_team_id from order_pay a GLOBAL join team b on a.partner_team_id = b.id
error net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "GLOBAL" "GLOBAL" at line 1, column 73.
Was expecting one of:
","
";"
"APPLY"
"CONNECT"
"CROSS"
"EXCEPT"
"FOR"
"FULL"
"GROUP"
"HAVING"
"INNER"
"INTERSECT"
"JOIN"
"LEFT"
"MINUS"
"NATURAL"
"ORDER"
"OUTER"
"PIVOT"
"RIGHT"
"START"
"STRAIGHT_JOIN"
"UNION"
"WHERE"
"WINDOW"
<EOF>
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:165)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:59)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parse(CCJSqlParserUtil.java:37)
Because Clickhouse distributed tables need to use global join syntax version:jsqlparser 4.0 jdk:1.8
Greetings!
Clickhouse's specific GLOBAL JOIN is not supported yet, but your contribution/PR will be very welcome.
Thank you for your reply. Can you give me an idea to modify it? It helped me a lot
- Start in grammar JSqlParserCC.jjt production
JoinerExpression()line 2583. - introduce in class
Joinyour global flag - adapt
toStringand deparser to reproduce this join construct - add tests in
SelectTestsusingassertSqlCanBeParsedAndDeparsed(stmt);
4. assertSqlCanBeParsedAndDeparsed
Thank you. I'll try when I have time