Skip to content

Commit

Permalink
overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lmatz committed Feb 8, 2023
1 parent c0aa909 commit b92b34d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 5 additions & 3 deletions e2e_test/batch/functions/pow.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ select pow(100000, -200000000000000);
----
0

query T
statement error QueryError: Expr error: Numeric out of range
select pow(100000, 200000000000000);
----
Infinity


statement error QueryError: Expr error: Numeric out of range
select pow(-100000, 200000000000001);
7 changes: 6 additions & 1 deletion src/expr/src/vector_op/arithmetic_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ where
T2: Into<T3> + Debug,
T3: Pow<T3> + num_traits::Float,
{
Ok(l.into().powf(r.into()))
let res = l.into().powf(r.into());
if res.is_infinite() {
Err(ExprError::NumericOutOfRange)
} else {
Ok(res)
}
}

#[inline(always)]
Expand Down

0 comments on commit b92b34d

Please sign in to comment.