You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your statement should be invalid though because you should be able to use ON only in conjunction with JOIN, otherwise you would need to use WHERE (at least this is my understanding).
Please double check and close this issue, when confirmed.
It could be, like using parseExpression, that JSqlParser parses as far as it is able to interpret your sql and stops then. How to you parse this statement actually?
If you do not use CCJSqlParserUtil.parse but directly use the parses SingleStatement method, this one could happen.
However this seems like a bug to me, as @manticore-projects already mentioned, this on should only be valid with a corresponding join.
I try to parse it as follows : String sql = "select t1.column1,t1.column2,t2.field1,t2.field2 from T_DT_ytb_01 t1 , T_DT_ytb_02 t2 on t1.column1 = t2.field1"; Statement parse = CCJSqlParserUtil.parse(sql); return parse.toString();
This sql is equivalent to “select t1.column1,t1.column2,t2.field1,t2.field2 from T_DT_ytb_01 t1 inner join T_DT_ytb_02 t2 on t1.column1 = t2.field1”
I don't understand what simple join means .
The debug screenshot is as follows:
Activity
manticore-projects commentedon Jun 16, 2021
Greetings.
You can also test it online here
ONonly in conjunction withJOIN, otherwise you would need to useWHERE(at least this is my understanding).Please double check and close this issue, when confirmed.
wumpz commentedon Jun 16, 2021
It could be, like using
parseExpression, that JSqlParser parses as far as it is able to interpret your sql and stops then. How to you parse this statement actually?If you do not use
CCJSqlParserUtil.parsebut directly use the parsesSingleStatementmethod, this one could happen.However this seems like a bug to me, as @manticore-projects already mentioned, this
onshould only be valid with a correspondingjoin.zhang245606 commentedon Jun 16, 2021
Thank you for your reply!
I try to parse it as follows :
String sql = "select t1.column1,t1.column2,t2.field1,t2.field2 from T_DT_ytb_01 t1 , T_DT_ytb_02 t2 on t1.column1 = t2.field1";Statement parse = CCJSqlParserUtil.parse(sql);return parse.toString();This sql is equivalent to “select t1.column1,t1.column2,t2.field1,t2.field2 from T_DT_ytb_01 t1 inner join T_DT_ytb_02 t2 on t1.column1 = t2.field1”
I don't understand what simple join means .

The debug screenshot is as follows:
wumpz commentedon Jun 16, 2021
The problem is in production
JoinerExpression. Simple means a comma list of table names likebut in the grammar is no check when this
onpart is parsed, if there was a non simple joinSo the solution should be a semantic Lookahead here with the check
!join.isSimple().Fixes JSQLParser#1229
Implement Joins with multiple trailing ON Expressions (#1303)