[BUG] JSQLParser 5.4-SNAPSHOT : performance.sql contains unparseable @Prompt macros; parseStatements used to hide this by returning null (JSQLParserBenchmark measured incomplete parses) #2599
Description
AI disclosure: this issue was prepared with AI coding agents, reviewed and revised line by line by me.
Correction (2026-09-11, same day): the original report below described this as a regression introduced between
6c726d8and current master ("the corpus parsed fine on 6c726d8"). That was wrong: my probe back then did not check the return value ofparseStatements, and on6c726d8it silently returnsnullfor this corpus (the exact bug reported in #2576), which my probe misread as success. The statement with the@Promptmacros fails to parse on both commits at the same position. The only real change is that #2568 / #2594 fixed the silentnull, so the long-standing corpus damage is now visible. The original text is kept below with the wrong claim struck through.
Failing SQL Feature:
src/test/resources/net/sf/jsqlparser/performance.sqlcontains BusinessObjects@Prompt(...)macros that JSQLParser cannot parse (and, as far as I can tell, never could: the statement fails at the same position on6c726d8and on current master, standalone or as part of the file).- Until Fix parseStatements failure propagation and executor cleanup #2568 / Align empty input handling for statement parsing #2594 this was invisible:
parseStatementssilently returnednullwhen a statement failed. As a consequenceJSQLParserBenchmark.parseSQLStatementsproduced timing numbers while the corpus was not fully parsed (thenullresult was simply consumed). With the fix, the benchmark now correctly fails fast with theParseExceptionbelow. - Open questions for the maintainers: should the benchmark assert corpus integrity (non-null result, expected statement count) so incomplete-parse timings cannot happen silently, and should the
@Promptstatement be repaired or supported?
SQL Example:
Excerpt of the failing spot (corpus line 497):
SELECT ... FROM ... WHERE ( COALESCE(CLM.WORKFLOW_C,0) IN @Prompt(P_WorkflowTypeInclude)
AND COALESCE(CLM_TRAIT_4.NAME,'CCA') IN @Prompt(P_CCA-TPMG) ... )net.sf.jsqlparser.parser.ParseException: Encountered: <OPENING_BRACKET> / "(", at line 497, column 40, in lexical state DEFAULT.
Repro on both commits (statement alone, corpus lines 196-1688):
CCJSqlParserUtil.parse(content); // 6c726d8: THROWS at 302:40; 7cc86386: THROWS at 302:40 (same position)
CCJSqlParserUtil.parseStatements(corpus); // 6c726d8: returns null silently; 7cc86386: throws JSQLParserExceptionSoftware Information:
- JSqlParser version: 5.4-SNAPSHOT (master
7cc86386; same parse failure on6c726d8) - Database: Oracle (BusinessObjects
@Promptmacros)
Tips:
- Standalone forms such as
x IN @Prompt(p1)orSELECT @f(1)fail on both commits; the corpus statement is the only place this surfaces in the repo. - The timing impact is real but predates the current master: on
6c726d8the JMH score described an incomplete parse of the corpus.
Activity
[-][BUG] JSQLParser 5.4-SNAPSHOT : benchmark corpus no longer parses (IN @Prompt(...)), JSQLParserBenchmark fails on master[/-][+][BUG] JSQLParser 5.4-SNAPSHOT : performance.sql contains unparseable @Prompt macros; parseStatements used to hide this by returning null (JSQLParserBenchmark measured incomplete parses)[/+]fudianchn commentedon Sep 11, 2026
Correction after re-verifying with a probe that checks the return value: the corpus statement with the
@Promptmacros fails at the same position on both6c726d8and current master. The only change is that #2568 / #2594 replaced the silentnullreturn ofparseStatementswith a proper exception, so the benchmark now fails instead of silently timing an incomplete parse. Title and description are updated accordingly.manticore-projects commentedon Sep 11, 2026
Thank you for bisecting this, in my opinion we should go this route: "should the @prompt statement be repaired".
manticore-projects commentedon Sep 11, 2026
Thank you, fixed -- with interesting outcome:
test: fix the benchmark query
fudianchn commentedon Sep 12, 2026
The 5.1 and 5.3 numbers measure incomplete parses and cannot be compared with latest: both versions still return null silently from
parseStatementswhen a statement fails (#2576), and the repaired corpus still fails on them.WITH)c7f8ff89: complete, 54 statements, ~35 ms (consistent with the 32.1 above)TimeoutException: that is the super-linear lookahead from [BUG] Parse time grows super-linearly on long dotted-name chains and nested parentheses (phase-2 lookahead), StackOverflowError at nesting depth ~2000 #2519. 5.2 parses it fine, so the cliff landed between 5.2 and 5.3, not gradually.manticore-projects commentedon Sep 12, 2026
Thank you, noted, but almost irrelevant now:
The fact, that there is even more story to tell about the details does not matter for most of the users.