aharpervc commented on code in PR #1809:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1809#discussion_r2052471264


##########
src/dialect/mssql.rs:
##########
@@ -116,7 +116,17 @@ impl Dialect for MsSqlDialect {
         true
     }
 
-    fn is_column_alias(&self, kw: &Keyword, _parser: &mut Parser) -> bool {
+    fn is_column_alias(&self, kw: &Keyword, parser: &mut Parser) -> bool {
+        // if we find maybe whitespace then a newline looking backward, then 
`GO` ISN'T a column alias
+        // if we can't find a newline then we assume that `GO` IS a column 
alias
+        if kw == &Keyword::GO
+            && parser
+                .expect_previously_only_whitespace_until_newline()
+                .is_ok()

Review Comment:
   In this case, it's most useful to know if there was previously only 
whitespace until a newline. However in the other call of this function in 
parse_go, we legitimately do want a parser error. Therefore we have choices:
   
   1. expect_previously_only_whitespace_until_newline raises a parse error 
which makes sense in parse_go but is converted to a boolean here
   2. expect_previously_only_whitespace_until_newline returns a boolean which 
makes sense here and then parse_go needs to separately raise a parse error
   
   Which is the best choice for the time being?



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