File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ fn basic_queries(c: &mut Criterion) {
5151 let tables = ( 0 ..1000 )
5252 . map ( |n| format ! ( "TABLE_{n}" ) )
5353 . collect :: < Vec < _ > > ( )
54- . join ( " JOIN " ) ;
54+ . join ( " CROSS JOIN " ) ;
5555 let where_condition = ( 0 ..1000 )
5656 . map ( |n| format ! ( "COL_{n} = {n}" ) )
5757 . collect :: < Vec < _ > > ( )
Original file line number Diff line number Diff line change @@ -1293,6 +1293,15 @@ impl<'a> Parser<'a> {
12931293 Token::Mul => {
12941294 return Ok(Expr::Wildcard(AttachedToken(next_token)));
12951295 }
1296+ // Handle parenthesized wildcard: (*)
1297+ Token::LParen => {
1298+ let [maybe_mul, maybe_rparen] = self.peek_tokens_ref();
1299+ if maybe_mul.token == Token::Mul && maybe_rparen.token == Token::RParen {
1300+ let mul_token = self.next_token(); // consume Mul
1301+ self.next_token(); // consume RParen
1302+ return Ok(Expr::Wildcard(AttachedToken(mul_token)));
1303+ }
1304+ }
12961305 _ => (),
12971306 };
12981307
Original file line number Diff line number Diff line change @@ -17953,3 +17953,22 @@ fn test_parse_set_session_authorization() {
1795317953 }))
1795417954 );
1795517955}
17956+
17957+ #[test]
17958+ fn parse_select_parenthesized_wildcard() {
17959+ // Test SELECT DISTINCT(*) which uses a parenthesized wildcard
17960+ // The parentheses are syntactic sugar and get normalized to just *
17961+ let sql = "SELECT DISTINCT (*) FROM table1";
17962+ let canonical = "SELECT DISTINCT * FROM table1";
17963+ let select = all_dialects().verified_only_select_with_canonical(sql, canonical);
17964+ assert_eq!(select.distinct, Some(Distinct::Distinct));
17965+ assert_eq!(select.projection.len(), 1);
17966+ assert!(matches!(select.projection[0], SelectItem::Wildcard(_)));
17967+
17968+ // Also test without spaces: SELECT DISTINCT(*)
17969+ let sql_no_spaces = "SELECT DISTINCT(*) FROM table1";
17970+ let select2 = all_dialects().verified_only_select_with_canonical(sql_no_spaces, canonical);
17971+ assert_eq!(select2.distinct, Some(Distinct::Distinct));
17972+ assert_eq!(select2.projection.len(), 1);
17973+ assert!(matches!(select2.projection[0], SelectItem::Wildcard(_)));
17974+ }
You can’t perform that action at this time.
0 commit comments