Skip to content

Add support for function parameter clauses#2381

Open
davyboyhayes wants to merge 1 commit intoJSQLParser:masterfrom
davyboyhayes:fix/2368
Open

Add support for function parameter clauses#2381
davyboyhayes wants to merge 1 commit intoJSQLParser:masterfrom
davyboyhayes:fix/2368

Conversation

@davyboyhayes
Copy link
Contributor

Adding support for clauses in function parameters. Fixes #2368

Before:
Result "net.sf.jsqlparser.benchmark.JSQLParserBenchmark.parseSQLStatements":
33.555 ±(99.9%) 2.650 ms/op [Average]
(min, avg, max) = (31.657, 33.555, 37.077), stdev = 2.479
CI (99.9%): [30.905, 36.205] (assumes normal distribution)

After:
Result "net.sf.jsqlparser.benchmark.JSQLParserBenchmark.parseSQLStatements":
33.814 ±(99.9%) 1.761 ms/op [Average]
(min, avg, max) = (31.568, 33.814, 37.126), stdev = 2.351
CI (99.9%): [32.053, 35.575] (assumes normal distribution)

Adding support for clauses in function parameters. Fixes JSQLParser#2368

Before:
Result "net.sf.jsqlparser.benchmark.JSQLParserBenchmark.parseSQLStatements":
  33.555 ±(99.9%) 2.650 ms/op [Average]
  (min, avg, max) = (31.657, 33.555, 37.077), stdev = 2.479
  CI (99.9%): [30.905, 36.205] (assumes normal distribution)

After:
Result "net.sf.jsqlparser.benchmark.JSQLParserBenchmark.parseSQLStatements":
  33.814 ±(99.9%) 1.761 ms/op [Average]
  (min, avg, max) = (31.568, 33.814, 37.126), stdev = 2.351
  CI (99.9%): [32.053, 35.575] (assumes normal distribution)
Copy link
Contributor

@manticore-projects manticore-projects left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not look too deeply into this, when I saw a few of our Standard Tests failing now.

In summary, I am not sure if this generic approach can solve this problem.
I do understand your JSON function as a special function (based on the parameter keywords) that needs a specific implementation, like we did already for Extract and a few other String functions.

--@FAILURE: Encountered: <OPENING_BRACKET> / "(", at line 21, column 12, in lexical state DEFAULT. recorded first on 13 Feb 2026, 12:31:35
--@FAILURE: Encountered: "+" / "+", at line 24, column 34, in lexical state DEFAULT. recorded first on 13 Feb 2026, 12:40:36
--@SUCCESSFULLY_PARSED_AND_DEPARSED first on 13 Feb 2026, 12:43:01
--@FAILURE: Encountered: <K_USING> / "using", at line 36, column 45, in lexical state DEFAULT. recorded first on 13 Feb 2026, 12:47:04 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing now, which is not acceptable.

--@FAILURE: select "a3"."r_id" "r_id" from "pe" "a3","me" "a2" where "a3"."m_id"="a2"."m_id" and "a2"."mi_t"=any((select "a4"."sys$"."id" from the(select "qa"."u_pkg"."getchartable"("qa"."u_pkg"."glist"(cursor(select "qa"."u_pkg"."glist"(cursor(select "a6"."mi_t" "mi_t" from "me" "a6" connect by "a6"."mi_uid"=prior "a6"."mi_id" start with "a6"."mi_t"=:b1))"lst" from "sys"."dual" "a5")))from dual)"a4")) recorded first on Aug 3, 2021, 7:20:08 AM
--@SUCCESSFULLY_PARSED_AND_DEPARSED first on Mar 25, 2023, 9:18:30 AM No newline at end of file
--@SUCCESSFULLY_PARSED_AND_DEPARSED first on Mar 25, 2023, 9:18:30 AM
--@FAILURE: Encountered: <OPENING_BRACKET> / "(", at line 22, column 3, in lexical state DEFAULT. recorded first on 13 Feb 2026, 12:31:35 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing now, which is not acceptable.

--@FAILURE: Encountered: <OPENING_BRACKET> / "(", at line 31, column 36, in lexical state DEFAULT. recorded first on 9 Jul 2025, 17:09:17
--@FAILURE: Encountered: <OPENING_BRACKET> / "(", at line 18, column 13, in lexical state DEFAULT. recorded first on 13 Feb 2026, 12:31:35
--@SUCCESSFULLY_PARSED_AND_DEPARSED first on 13 Feb 2026, 12:40:35
--@FAILURE: Encountered: <K_USING> / "using", at line 31, column 66, in lexical state DEFAULT. recorded first on 13 Feb 2026, 12:47:04 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing now, which is not acceptable.


--@SUCCESSFULLY_PARSED_AND_DEPARSED first on Aug 3, 2021, 7:20:08 AM No newline at end of file
--@SUCCESSFULLY_PARSED_AND_DEPARSED first on Aug 3, 2021, 7:20:08 AM
--@FAILURE: Encountered: "+" / "+", at line 12, column 44, in lexical state DEFAULT. recorded first on 13 Feb 2026, 12:40:36 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing now, which is not acceptable.


--@SUCCESSFULLY_PARSED_AND_DEPARSED first on Aug 3, 2021, 7:20:08 AM No newline at end of file
--@SUCCESSFULLY_PARSED_AND_DEPARSED first on Aug 3, 2021, 7:20:08 AM
--@FAILURE: Encountered: "+" / "+", at line 32, column 38, in lexical state DEFAULT. recorded first on 13 Feb 2026, 12:40:36 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing now, which is not acceptable.


--@SUCCESSFULLY_PARSED_AND_DEPARSED first on Aug 3, 2021, 7:20:08 AM No newline at end of file
--@SUCCESSFULLY_PARSED_AND_DEPARSED first on Aug 3, 2021, 7:20:08 AM
--@FAILURE: Encountered: "+" / "+", at line 14, column 19, in lexical state DEFAULT. recorded first on 13 Feb 2026, 12:40:36 No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing now, which is not acceptable.

@manticore-projects
Copy link
Contributor

One more concern: While I am a big fan of LLM Tools myself, I am not sure if this is the right tool for this particular problem. But I stay open minded and won't rule it out. You may want at least cross check your approach against other LLMs (Claude, Gemini).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] JSQLParser Version : Trino : additional clauses in function parameters unsupported

2 participants