mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-12-23 11:12:51 +00:00
Refactoring based on comments
This commit is contained in:
parent
3280c3db78
commit
3ec4eefa36
2 changed files with 7 additions and 5 deletions
|
|
@ -1270,12 +1270,14 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
// Handle parenthesized wildcard: (*)
|
||||
Token::LParen => {
|
||||
let inner_token = self.next_token();
|
||||
if inner_token.token == Token::Mul && self.peek_token().token == Token::RParen {
|
||||
let [maybe_mul, maybe_rparen] = self.peek_tokens_ref();
|
||||
if maybe_mul.token == Token::Mul && maybe_rparen.token == Token::RParen {
|
||||
let mul_token = self.next_token(); // consume Mul
|
||||
self.next_token(); // consume RParen
|
||||
return Ok(Expr::Wildcard(AttachedToken(inner_token)));
|
||||
return Ok(Expr::Wildcard(AttachedToken(mul_token)));
|
||||
}
|
||||
// Not a (*), reset and fall through to parse_expr
|
||||
// Not a (*), fall through to reset index and call parse_expr
|
||||
self.prev_token();
|
||||
}
|
||||
_ => (),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -17955,7 +17955,7 @@ fn test_parse_set_session_authorization() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn parse_select_distinct_parenthesized_wildcard() {
|
||||
fn parse_select_parenthesized_wildcard() {
|
||||
// Test SELECT DISTINCT(*) which uses a parenthesized wildcard
|
||||
// The parentheses are syntactic sugar and get normalized to just *
|
||||
let sql = "SELECT DISTINCT (*) FROM table1";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue