Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions datafusion/functions/src/math/abs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ fn create_abs_function(input_data_type: &DataType) -> Result<MathArrayFunction>
doc_section(label = "Math Functions"),
description = "Returns the absolute value of a number.",
syntax_example = "abs(numeric_expression)",
sql_example = r#"```sql
> SELECT abs(-5);
+----------+
| abs(-5) |
+----------+
| 5 |
+----------+
```"#,
standard_argument(name = "numeric_expression", prefix = "Numeric")
)]
#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down
8 changes: 8 additions & 0 deletions datafusion/functions/src/math/cot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ use datafusion_macros::user_doc;
doc_section(label = "Math Functions"),
description = "Returns the cotangent of a number.",
syntax_example = r#"cot(numeric_expression)"#,
sql_example = r#"```sql
> SELECT cot(1);
+---------+
| cot(1) |
+---------+
| 0.64209 |
+---------+
```"#,
standard_argument(name = "numeric_expression", prefix = "Numeric")
)]
#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down
8 changes: 8 additions & 0 deletions datafusion/functions/src/math/factorial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ use datafusion_macros::user_doc;
doc_section(label = "Math Functions"),
description = "Factorial. Returns 1 if value is less than 2.",
syntax_example = "factorial(numeric_expression)",
sql_example = r#"```sql
> SELECT factorial(5);
+---------------+
| factorial(5) |
+---------------+
| 120 |
+---------------+
```"#,
standard_argument(name = "numeric_expression", prefix = "Numeric")
)]
#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down
8 changes: 8 additions & 0 deletions datafusion/functions/src/math/gcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ use datafusion_macros::user_doc;
doc_section(label = "Math Functions"),
description = "Returns the greatest common divisor of `expression_x` and `expression_y`. Returns 0 if both inputs are zero.",
syntax_example = "gcd(expression_x, expression_y)",
sql_example = r#"```sql
> SELECT gcd(48, 18);
+------------+
| gcd(48,18) |
+------------+
| 6 |
+------------+
```"#,
standard_argument(name = "expression_x", prefix = "First numeric"),
standard_argument(name = "expression_y", prefix = "Second numeric")
)]
Expand Down
8 changes: 8 additions & 0 deletions datafusion/functions/src/math/iszero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ use crate::utils::make_scalar_function;
doc_section(label = "Math Functions"),
description = "Returns true if a given number is +0.0 or -0.0 otherwise returns false.",
syntax_example = "iszero(numeric_expression)",
sql_example = r#"```sql
> SELECT iszero(0);
+------------+
| iszero(0) |
+------------+
| true |
+------------+
```"#,
standard_argument(name = "numeric_expression", prefix = "Numeric")
)]
#[derive(Debug, PartialEq, Eq, Hash)]
Expand Down
8 changes: 8 additions & 0 deletions datafusion/functions/src/math/lcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ use crate::utils::make_scalar_function;
doc_section(label = "Math Functions"),
description = "Returns the least common multiple of `expression_x` and `expression_y`. Returns 0 if either input is zero.",
syntax_example = "lcm(expression_x, expression_y)",
sql_example = r#"```sql
> SELECT lcm(4, 5);
+----------+
| lcm(4,5) |
+----------+
| 20 |
+----------+
```"#,
standard_argument(name = "expression_x", prefix = "First numeric"),
standard_argument(name = "expression_y", prefix = "Second numeric")
)]
Expand Down
8 changes: 8 additions & 0 deletions datafusion/functions/src/math/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ use datafusion_macros::user_doc;
description = "Returns the base-x logarithm of a number. Can either provide a specified base, or if omitted then takes the base-10 of a number.",
syntax_example = r#"log(base, numeric_expression)
log(numeric_expression)"#,
sql_example = r#"```sql
> SELECT log(2.71828);
+--------------+
| log(2.71828) |
+--------------+
| 1.0 |
+--------------+
```"#,
standard_argument(name = "base", prefix = "Base numeric"),
standard_argument(name = "numeric_expression", prefix = "Numeric")
)]
Expand Down
Loading