Skip to content

Conversation

@romanoff
Copy link
Contributor

@romanoff romanoff commented Dec 3, 2025

Support parsing parenthesized wildcard (*)

Example of query:

SELECT DISTINCT (*) FROM table1

}

#[test]
fn parse_select_distinct_parenthesized_wildcard() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn parse_select_distinct_parenthesized_wildcard() {
fn parse_select_parenthesized_wildcard() {

thinking since the syntax isn't implemented solely on the distinct keyword?

self.next_token(); // consume RParen
return Ok(Expr::Wildcard(AttachedToken(inner_token)));
}
// Not a (*), reset and fall through to parse_expr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 1227 to 1228
let inner_token = self.next_token();
if inner_token.token == Token::Mul && self.peek_token().token == Token::RParen {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@romanoff
Copy link
Contributor Author

romanoff commented Dec 5, 2025

@iffyio Updated. Thank you for reviewing

Comment on lines 1233 to 1234
// Not a (*), fall through to reset index and call parse_expr
self.prev_token();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calling self.prev_token() doesn't seem needed? similar to the _ branch, the fall-through paths call self.index = index; to reset at the end it looks like

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@romanoff romanoff force-pushed the allow_parsing_parenthesized_wildcard branch from fa70750 to 3732a4a Compare December 19, 2025 01:27
Copy link
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @romanoff!

@iffyio iffyio added this pull request to the merge queue Dec 19, 2025
Merged via the queue into apache:main with commit 355a3bf Dec 19, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants