Skip to content

Commit

Permalink
add err info to avoid panic and delete heavy test
Browse files Browse the repository at this point in the history
  • Loading branch information
fkuner committed May 12, 2022
1 parent 5ba330f commit abfd626
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
18 changes: 6 additions & 12 deletions query/src/sql/planner/binder/limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,19 @@ impl<'a> Binder {
let type_checker = TypeChecker::new(bind_context, self.ctx.clone());

let limit_cnt = match limit {
Some(Expr::Literal(x)) => Some(
type_checker
.parse_literal(x, None)
.unwrap()
.as_u64()
.unwrap() as usize,
),
Some(Expr::Literal(x)) => {
let data = type_checker.parse_literal(x, None)?.as_u64()?;
Some(data as usize)
}
Some(_) => {
return Err(ErrorCode::IllegalDataType("Unsupported limit type"));
}
None => None,
};

let offset_cnt = if let Some(Expr::Literal(x)) = offset {
type_checker
.parse_literal(x, None)
.unwrap()
.as_u64()
.unwrap() as usize
let data = type_checker.parse_literal(x, None)?.as_u64()?;
data as usize
} else {
0
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,3 @@ new_planner
7
8
9
0
1 change: 0 additions & 1 deletion tests/suites/0_stateless/20+_others/20_0001_planner_v2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,5 @@ select '=== Test offset ===';
select number from numbers(10) order by number asc offset 5;
select '===================';
select number from numbers(10) order by number+number asc offset 5;
select number from numbers(10000000000000) limit 1;

set enable_planner_v2 = 0;

0 comments on commit abfd626

Please sign in to comment.