Open
Conversation
iffyio
reviewed
Feb 5, 2026
src/parser/mod.rs
Outdated
| Keyword::FILTER | ||
| | Keyword::TRANSFORM | ||
| | Keyword::REDUCE if self.dialect.supports_lambda_functions() => { | ||
| self.expect_token(&Token::LParen)?; |
Contributor
There was a problem hiding this comment.
can we move the logic to a standalone function? since its a lot of code to inline
| /// The name of the parameter | ||
| pub name: Ident, | ||
| /// The optional data type of the parameter | ||
| pub data_type: Option<DataType>, |
Contributor
There was a problem hiding this comment.
Can we add a link to the docs containing the data_type syntax?
tests/sqlparser_snowflake.rs
Outdated
| snowflake().verified_expr("TRANSFORM([1, 2, 3], a -> a * 2)"); | ||
| snowflake().verified_expr("TRANSFORM([1, 2, 3], a INT -> a * 2)"); | ||
| snowflake().verified_expr("TRANSFORM([1, 2, 3], (x INT, y INT) -> (x + y))"); | ||
| snowflake().verified_expr("REDUCE([1, 2, 3], 0, (acc, val) -> acc + val)"); |
Contributor
There was a problem hiding this comment.
can we add test cases for FILTER as well?
Contributor
Author
|
@iffyio thanks for the feedback. I took a diff approach which I believe eliminates the concerns you raised. It's a bit of a shame that lambda expression parsing is spread across 3-4 diff flows but perhaps we can do something about it in the future. |
3ea5197 to
516a09d
Compare
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.
This PR introduces the following changes:
TRANSFORM,FILTERandREDUCEfunctions which take lambda as an argument.See: https://docs.snowflake.com/en/user-guide/querying-semistructured#label-higher-order-functions