Skip to content

Commit 353ce58

Browse files
committed
Code review comments
1 parent 8113dd6 commit 353ce58

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/parser/mod.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -10703,8 +10703,7 @@ impl<'a> Parser<'a> {
1070310703
repeatable: seed,
1070410704
})
1070510705
// 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) {
1070810707
if self.parse_keyword(Keyword::BUCKET) {
1070910708
let bucket = self.parse_number_value()?;
1071010709
self.expect_keywords(&[Keyword::OUT, Keyword::OF])?;
@@ -10717,9 +10716,9 @@ impl<'a> Parser<'a> {
1071710716
self.expect_token(&Token::RParen)?;
1071810717
TableSampleMethod::Bucket(TableSampleBucket { bucket, total, on })
1071910718
} 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 => {
1072310722
if let Token::Word(w) = self.next_token().token {
1072410723
Value::Placeholder(w.value)
1072510724
} else {
@@ -10730,10 +10729,9 @@ impl<'a> Parser<'a> {
1073010729
}
1073110730
}
1073210731
};
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)
1073510734
{
10736-
self.expect_token(&Token::RParen)?;
1073710735
TableSampleMethod::Bernoulli(TableSampleBernoulli {
1073810736
probability: Some(Expr::Value(value)),
1073910737
unit: None,

0 commit comments

Comments
 (0)