This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 03890d40b [DOC] Update math expression documentation (#5316)
03890d40b is described below
commit 03890d40bc645827991856cc49d5780ad89e127e
Author: comphead <[email protected]>
AuthorDate: Fri Feb 17 07:01:06 2023 -0800
[DOC] Update math expression documentation (#5316)
* Minor: Math functions usage notes
* Docs fmt
---
docs/source/user-guide/expressions.md | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/docs/source/user-guide/expressions.md
b/docs/source/user-guide/expressions.md
index 9bb4af2ea..7717366d2 100644
--- a/docs/source/user-guide/expressions.md
+++ b/docs/source/user-guide/expressions.md
@@ -77,6 +77,7 @@ expressions such as `col("a") + col("b")` to be used.
| exp(x) | exponential |
| floor(x) | nearest integer less than or equal to argument |
| ln(x) | natural logarithm |
+| log(base, x) | logarithm of x for a particular base |
| log10(x) | base 10 logarithm |
| log2(x) | base 2 logarithm |
| power(base, exponent) | base raised to the power of exponent |
@@ -87,6 +88,19 @@ expressions such as `col("a") + col("b")` to be used.
| tan(x) | tangent |
| trunc(x) | truncate toward zero |
+### Math functions usage notes:
+
+Unlike to some databases the math functions in Datafusion works the same way
as Rust math functions, avoiding failing on corner cases e.g
+
+```
+❯ select log(-1), log(0), sqrt(-1);
++----------------+---------------+-----------------+
+| log(Int64(-1)) | log(Int64(0)) | sqrt(Int64(-1)) |
++----------------+---------------+-----------------+
+| NaN | -inf | NaN |
++----------------+---------------+-----------------+
+```
+
## Bitwise Operators
| Operator | Notes |