Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion datafusion/functions/src/math/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ fn validate_sqrt_input(value: f64) -> Result<()> {
}
}

fn validate_ln_input(value: f64) -> Result<()> {
if value <= 0.0 {
exec_err!("cannot take logarithm of a negative number")
} else {
Ok(())
}
}

// Create UDFs
make_udf_function!(abs::AbsFunc, abs);
make_math_unary_udf!(
Expand Down Expand Up @@ -163,7 +171,8 @@ make_math_unary_udf!(
ln,
super::ln_order,
super::bounds::unbounded_bounds,
super::get_ln_doc
super::get_ln_doc,
Some(super::validate_ln_input)
);
make_math_unary_udf!(
Log2Func,
Expand Down