feat(spansql): support array functions with lambdas (#8768)#14140
Open
arriven wants to merge 2 commits intogoogleapis:mainfrom
Open
feat(spansql): support array functions with lambdas (#8768)#14140arriven wants to merge 2 commits intogoogleapis:mainfrom
arriven wants to merge 2 commits intogoogleapis:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_INCLUDESstill supports regularsearch_valueargument (see tests).Additionally added
SPLIT_SUBSTRto the list of known functions.Fixes #8768