Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
lmatz committed Dec 18, 2024
1 parent de05e35 commit 3374d16
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/frontend/src/binder/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl Binder {
with_ties = fetch_with_ties;
match quantity {
Some(v) => Some(v),
None => Some(Expr::Value(Value::Number("1".to_string()))),
None => Some(Expr::Value(Value::Number("1".to_owned()))),
}
}
(Some(limit), None) => Some(limit),
Expand Down
7 changes: 1 addition & 6 deletions src/frontend/src/planner/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,7 @@ impl Planner {
))
})?;
let limit = match limit_cast_to_bigint.fold_const() {
Ok(datum) => match datum {
Some(datum) => datum.as_integral() as u64,
None => {
return Err(limit_err.into());
}
},
Ok(Some(datum)) => datum.as_integral() as u64,
_ => return Err(limit_err.into()),
};

Expand Down
14 changes: 7 additions & 7 deletions src/sqlparser/tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ fn parse_simple_select() {
assert_eq!(3, select.projection.len());
let select = verified_query(sql);
assert_eq!(
Some(Expr::Value(Value::Number("5".to_string()))),
Some(Expr::Value(Value::Number("5".to_owned()))),
select.limit
);
}
Expand All @@ -216,10 +216,10 @@ fn parse_simple_select() {
fn parse_limit_is_not_an_alias() {
// In dialects supporting LIMIT it shouldn't be parsed as a table alias
let ast = verified_query("SELECT id FROM customer LIMIT 1");
assert_eq!(Some(Expr::Value(Value::Number("1".to_string()))), ast.limit);
assert_eq!(Some(Expr::Value(Value::Number("1".to_owned()))), ast.limit);

let ast = verified_query("SELECT 1 LIMIT 5");
assert_eq!(Some(Expr::Value(Value::Number("5".to_string()))), ast.limit);
assert_eq!(Some(Expr::Value(Value::Number("5".to_owned()))), ast.limit);
}

#[test]
Expand Down Expand Up @@ -1072,7 +1072,7 @@ fn parse_select_order_by_limit() {
select.order_by
);
assert_eq!(
Some(Expr::Value(Value::Number("2".to_string()))),
Some(Expr::Value(Value::Number("2".to_owned()))),
select.limit
);
}
Expand All @@ -1098,7 +1098,7 @@ fn parse_select_order_by_nulls_order() {
select.order_by
);
assert_eq!(
Some(Expr::Value(Value::Number("2".to_string()))),
Some(Expr::Value(Value::Number("2".to_owned()))),
select.limit
);
}
Expand Down Expand Up @@ -3551,7 +3551,7 @@ fn parse_fetch() {
let fetch_first_two_rows_only = Some(Fetch {
with_ties: false,

quantity: Some(Expr::Value(Value::Number("2".to_string()))),
quantity: Some(Expr::Value(Value::Number("2".to_owned()))),
});
let ast = verified_query("SELECT foo FROM bar FETCH FIRST 2 ROWS ONLY");
assert_eq!(ast.fetch, fetch_first_two_rows_only);
Expand All @@ -3576,7 +3576,7 @@ fn parse_fetch() {
ast.fetch,
Some(Fetch {
with_ties: true,
quantity: Some(Expr::Value(Value::Number("2".to_string()))),
quantity: Some(Expr::Value(Value::Number("2".to_owned()))),
})
);
let ast = verified_query(
Expand Down

0 comments on commit 3374d16

Please sign in to comment.