diff --git a/e2e_test/batch/functions/pow.slt.part b/e2e_test/batch/functions/pow.slt.part index 19a59e3c67b87..869b3e936cbd0 100644 --- a/e2e_test/batch/functions/pow.slt.part +++ b/e2e_test/batch/functions/pow.slt.part @@ -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); diff --git a/src/expr/src/vector_op/arithmetic_op.rs b/src/expr/src/vector_op/arithmetic_op.rs index f24fd475bf579..7db4856ed4aee 100644 --- a/src/expr/src/vector_op/arithmetic_op.rs +++ b/src/expr/src/vector_op/arithmetic_op.rs @@ -115,7 +115,12 @@ where T2: Into + Debug, T3: Pow + 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)]