Skip to content

[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

@fudianchn

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 6c726d8 and current master ("the corpus parsed fine on 6c726d8"). That was wrong: my probe back then did not check the return value of parseStatements, and on 6c726d8 it silently returns null for this corpus (the exact bug reported in #2576), which my probe misread as success. The statement with the @Prompt macros fails to parse on both commits at the same position. The only real change is that #2568 / #2594 fixed the silent null, 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.sql contains BusinessObjects @Prompt(...) macros that JSQLParser cannot parse (and, as far as I can tell, never could: the statement fails at the same position on 6c726d8 and 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: parseStatements silently returned null when a statement failed. As a consequence JSQLParserBenchmark.parseSQLStatements produced timing numbers while the corpus was not fully parsed (the null result was simply consumed). With the fix, the benchmark now correctly fails fast with the ParseException below.
  • 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 @Prompt statement 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 JSQLParserException

Software Information:

  • JSqlParser version: 5.4-SNAPSHOT (master 7cc86386; same parse failure on 6c726d8)
  • Database: Oracle (BusinessObjects @Prompt macros)

Tips:

  • Standalone forms such as x IN @Prompt(p1) or SELECT @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 6c726d8 the JMH score described an incomplete parse of the corpus.

Activity

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