Skip to content

feat(spansql): support array functions with lambdas (#8768)#14140

Open
arriven wants to merge 2 commits intogoogleapis:mainfrom
arriven:main
Open

feat(spansql): support array functions with lambdas (#8768)#14140
arriven wants to merge 2 commits intogoogleapis:mainfrom
arriven:main

Conversation

@arriven
Copy link
Copy Markdown
Contributor

@arriven arriven commented Mar 7, 2026

Added parsing support for lambda expressions as function arguments and set them as custom parsers for ARRAY_TRANSFORM, ARRAY_INCLUDES, ARRAY_FILTER.
Made sure that ARRAY_INCLUDES still supports regular search_value argument (see tests).

Additionally added SPLIT_SUBSTR to the list of known functions.

Fixes #8768

@arriven arriven requested review from a team as code owners March 7, 2026 21:02
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Mar 7, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for lambda expressions in array functions. The implementation is mostly correct, but there are a few issues. The new lambda parser uses p.parseLit() which is too restrictive and will fail on complex expressions; it should use p.parseExpr(). Additionally, the test cases could be improved: the parsing tests should include more complex expressions to cover more scenarios, and the SQL generation tests contain some semantically invalid function calls that should be corrected for clarity.

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

Labels

api: spanner Issues related to the Spanner API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spanner/spansql: add support for ARRAY_FILTER, ARRAY_INCLUDES and ARRAY_TRANSFORM

1 participant