Skip to content

fix: preserve lambda grouping and dialect JSON arrows - #2646

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/lambda-roundtrip
Sep 20, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/lambda-roundtrip

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

A parenthesized single-parameter lambda such as arrayMap((x) -> x * 2, [1, 2]) loses its parameter parentheses when rendered, so reparsing changes its AST from LambdaExpression to JsonExpression. PostgreSQL and MySQL JSON access in later function arguments can also be incorrectly classified as a lambda.

Preserve explicit parameter grouping in LambdaExpression and share its rendering between toString() and the expression deparser, including the caller's body visitor. In PostgreSQL and MySQL/MariaDB presets, expression-list and parenthesized-operand arrow handling uses JSON access. Existing unparenthesized lambda rendering in the default parser remains available.

Validation: Gradle check passed (7498 tests, 0 failures, 0 errors, 25 skipped), including grammar ambiguity and static checks. New tests cover grouped single/multiple parameters, nesting, argument positions, custom deparsers, fast/complex parsing and missing JSON operands. Thirteen PostgreSQL/MySQL JSON fixtures and both rendered forms executed successfully on PostgreSQL 18.6 and MySQL 8.4.11 (39 executions).

Syntax references: PostgreSQL JSON operators, MySQL JSON extraction, ClickHouse lambda syntax.

@manticore-projects
manticore-projects merged commit a8ef0b2 into JSQLParser:master Sep 20, 2026
10 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you for fixing this, silent errors like those are the worst.

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.

2 participants