vimko commented on code in PR #1705:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1705#discussion_r2094040996


##########
src/tokenizer.rs:
##########
@@ -1229,14 +1229,26 @@ impl<'a> Tokenizer<'a> {
                 // operators
                 '-' => {
                     chars.next(); // consume the '-'
+
                     match chars.peek() {
                         Some('-') => {
-                            chars.next(); // consume the second '-', starting 
a single-line comment
-                            let comment = 
self.tokenize_single_line_comment(chars);
-                            
Ok(Some(Token::Whitespace(Whitespace::SingleLineComment {
-                                prefix: "--".to_owned(),
-                                comment,
-                            })))
+                            let mut is_comment = true;
+                            if 
self.dialect.requires_single_line_comment_whitespace() {
+                                is_comment = Some(' ') == 
chars.peekable.clone().nth(1);

Review Comment:
   Usually, `--` is used independently to separate segments of SQL statements. 
For example:
   
   ```sql
   BEGIN;
   --
   -- Add field field_1 to table1
   --
   ALTER TABLE `table1` ADD COLUMN `field_1` datetime(6) NULL;
   
   --
   -- Add field field_2 to table2
   --
   ALTER TABLE `table2` ADD COLUMN `field_2` datetime(6) NULL;
   
   COMMIT;
   
   ```
   
   In this case, `--` will not be recognized as a comment.



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to