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


##########
src/parser/mod.rs:
##########
@@ -1222,6 +1222,15 @@ impl<'a> Parser<'a> {
             Token::Mul => {
                 return Ok(Expr::Wildcard(AttachedToken(next_token)));
             }
+            // Handle parenthesized wildcard: (*)
+            Token::LParen => {
+                let inner_token = self.next_token();
+                if inner_token.token == Token::Mul && self.peek_token().token 
== Token::RParen {
+                    self.next_token(); // consume RParen
+                    return Ok(Expr::Wildcard(AttachedToken(inner_token)));
+                }
+                // Not a (*), reset and fall through to parse_expr

Review Comment:
   this looks incorrect per the comment, by reset should we have called 
`prev_token()` or similar to undo the consumed inner token `*`?



##########
tests/sqlparser_common.rs:
##########
@@ -17905,3 +17905,22 @@ fn test_parse_set_session_authorization() {
         }))
     );
 }
+
+#[test]
+fn parse_select_distinct_parenthesized_wildcard() {

Review Comment:
   ```suggestion
   fn parse_select_parenthesized_wildcard() {
   ```
   thinking since the syntax isn't implemented solely on the distinct keyword?



##########
src/parser/mod.rs:
##########
@@ -1222,6 +1222,15 @@ impl<'a> Parser<'a> {
             Token::Mul => {
                 return Ok(Expr::Wildcard(AttachedToken(next_token)));
             }
+            // Handle parenthesized wildcard: (*)
+            Token::LParen => {
+                let inner_token = self.next_token();
+                if inner_token.token == Token::Mul && self.peek_token().token 
== Token::RParen {

Review Comment:
   can this be simplified by calling `self.peek_tokens_ref(Token::MUL, 
Token::RParen)`?



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