iffyio commented on code in PR #2192:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2192#discussion_r2781423291


##########
src/keywords.rs:
##########
@@ -1051,6 +1052,7 @@ define_keywords!(
     TRACE,
     TRAILING,
     TRANSACTION,
+    TRANSFORM,

Review Comment:
   it looks like both no longer need to be keywords in the diff?



##########
src/parser/mod.rs:
##########
@@ -1603,10 +1603,34 @@ impl<'a> Parser<'a> {
                     value: self.parse_introduced_string_expr()?.into(),
                 })
             }
+            // An unreserved word (likely an identifier) is followed by an 
arrow,
+            // which indicates a lambda function with a single, untyped 
parameter.
+            // For example: `a -> a * 2`.
             Token::Arrow if self.dialect.supports_lambda_functions() => {
                 self.expect_token(&Token::Arrow)?;
                 Ok(Expr::Lambda(LambdaFunction {
-                    params: OneOrManyWithParens::One(w.to_ident(w_span)),
+                    params: OneOrManyWithParens::One(LambdaFunctionParameter {
+                        name: w.to_ident(w_span),
+                        data_type: None,
+                    }),
+                    body: Box::new(self.parse_expr()?),
+                    syntax: LambdaSyntax::Arrow,
+                }))
+            }
+            // An unreserved word (likely an identifier) that is followed by 
another word (likley a data type)
+            // which is then followed by an arrow, which indicates a lambda 
function with a single, typed parameter.
+            // For example: `a INT -> a * 2`.
+            Token::Word(_)
+                if self.peek_nth_token_ref(1).token == Token::Arrow
+                    && self.dialect.supports_lambda_functions() =>

Review Comment:
   ```suggestion
                   if self.dialect.supports_lambda_functions() && 
self.peek_nth_token_ref(1).token == Token::Arrow  =>
   ```
   thinking probably cleaner/quicker to first check the dialect before looking 
to parse any further?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to