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


##########
src/dialect/snowflake.rs:
##########
@@ -247,6 +247,18 @@ impl Dialect for SnowflakeDialect {
 
     fn parse_statement(&self, parser: &mut Parser) -> Option<Result<Statement, 
ParserError>> {
         if parser.parse_keyword(Keyword::BEGIN) {
+            // Snowflake supports both `BEGIN TRANSACTION` and `BEGIN ... END` 
blocks.
+            // If the next keyword indicates a transaction statement, let the
+            // standard parse_begin() handle it.
+            if parser.peek_keyword(Keyword::TRANSACTION)
+                || parser.peek_keyword(Keyword::WORK)
+                || parser.peek_keyword(Keyword::NAME)
+                || parser.peek_token().token == Token::SemiColon
+                || parser.peek_token().token == Token::EOF

Review Comment:
   can we add a test case with only a begin keyword (for the EOF case)?



##########
src/dialect/snowflake.rs:
##########
@@ -247,6 +247,18 @@ impl Dialect for SnowflakeDialect {
 
     fn parse_statement(&self, parser: &mut Parser) -> Option<Result<Statement, 
ParserError>> {
         if parser.parse_keyword(Keyword::BEGIN) {
+            // Snowflake supports both `BEGIN TRANSACTION` and `BEGIN ... END` 
blocks.
+            // If the next keyword indicates a transaction statement, let the
+            // standard parse_begin() handle it.
+            if parser.peek_keyword(Keyword::TRANSACTION)

Review Comment:
   can we use `parser.peek_one_of_keywords()` and `parser.peek_token_ref()` for 
the two cases to simplify or make the op less expensive?



-- 
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