@@ -10703,8 +10703,7 @@ impl<'a> Parser<'a> {
10703
10703
repeatable: seed,
10704
10704
})
10705
10705
// Try to parse without an explicit table sample method keyword
10706
- } else if self.peek_token().token == Token::LParen {
10707
- self.expect_token(&Token::LParen)?;
10706
+ } else if self.consume_token(&Token::LParen) {
10708
10707
if self.parse_keyword(Keyword::BUCKET) {
10709
10708
let bucket = self.parse_number_value()?;
10710
10709
self.expect_keywords(&[Keyword::OUT, Keyword::OF])?;
@@ -10717,9 +10716,9 @@ impl<'a> Parser<'a> {
10717
10716
self.expect_token(&Token::RParen)?;
10718
10717
TableSampleMethod::Bucket(TableSampleBucket { bucket, total, on })
10719
10718
} else {
10720
- let value = match self.maybe_parse(|p| p.parse_number_value()) {
10721
- Ok( Some(num) ) => num,
10722
- _ => {
10719
+ let value = match self.maybe_parse(|p| p.parse_number_value())? {
10720
+ Some(num) => num,
10721
+ None => {
10723
10722
if let Token::Word(w) = self.next_token().token {
10724
10723
Value::Placeholder(w.value)
10725
10724
} else {
@@ -10730,10 +10729,9 @@ impl<'a> Parser<'a> {
10730
10729
}
10731
10730
}
10732
10731
};
10733
- if self.peek_token().token == Token::RParen
10734
- && ! self.dialect.supports_implicit_table_sample_method( )
10732
+ if ! self.dialect.supports_implicit_table_sample_method()
10733
+ && self.consume_token(&Token::RParen )
10735
10734
{
10736
- self.expect_token(&Token::RParen)?;
10737
10735
TableSampleMethod::Bernoulli(TableSampleBernoulli {
10738
10736
probability: Some(Expr::Value(value)),
10739
10737
unit: None,
0 commit comments