Skip to content

Commit

Permalink
[DOC] Update math expression documentation (#5316)
Browse files Browse the repository at this point in the history
* Minor: Math functions usage notes

* Docs fmt
  • Loading branch information
comphead authored Feb 17, 2023
1 parent 79ecf94 commit 03890d4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/source/user-guide/expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 |
Expand Down

0 comments on commit 03890d4

Please sign in to comment.