Skip to content

I use it to analyze clickhouse sql,But there is a problem,Can you show me #1535

Closed

Description

@lif123456

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

Activity

  1. manticore-projects commented on May 13, 2022

    @manticore-projects
    Contributor

    Greetings!
    Clickhouse's specific GLOBAL JOIN is not supported yet, but your contribution/PR will be very welcome.

  2. lif123456 commented on May 13, 2022

    @lif123456
    Author

    Thank you for your reply. Can you give me an idea to modify it? It helped me a lot

  3. wumpz commented on May 15, 2022

    @wumpz
    Member
    1. Start in grammar JSqlParserCC.jjt production JoinerExpression() line 2583.
    2. introduce in class Join your global flag
    3. adapt toStringand deparser to reproduce this join construct
    4. add tests in SelectTests using assertSqlCanBeParsedAndDeparsed(stmt);
  4. lif123456 commented on May 16, 2022

    @lif123456
    Author

    4. assertSqlCanBeParsedAndDeparsed

    Thank you. I'll try when I have time

  5. added a commit that references this issue on Nov 28, 2022
    7086f18
  6. added a commit that references this issue on Dec 22, 2022
    8d9db70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions