This is an automated email from the ASF dual-hosted git repository.

techdocsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new ca787885c96 [docs] batch02 of updating functions (#16761)
ca787885c96 is described below

commit ca787885c966e38ebdebe7ee8c25671996918325
Author: Edgar Melendrez <[email protected]>
AuthorDate: Wed Jul 24 15:28:57 2024 -0700

    [docs] batch02 of updating functions (#16761)
    
    * applying changes
    
    * ensuring batch is updated
    
    * Update docs/querying/sql-functions.md
    
    * raise -> raises
    
    * addressing review
    
    * Apply suggestions from code review
    
    Co-authored-by: Charles Smith <[email protected]>
    
    ---------
    
    Co-authored-by: Benedict Jin <[email protected]>
    Co-authored-by: Charles Smith <[email protected]>
---
 docs/querying/sql-functions.md | 148 +++++++++++++++++++++++++++++++++++------
 1 file changed, 127 insertions(+), 21 deletions(-)

diff --git a/docs/querying/sql-functions.md b/docs/querying/sql-functions.md
index f5219f6a4b2..b04664ac90e 100644
--- a/docs/querying/sql-functions.md
+++ b/docs/querying/sql-functions.md
@@ -1069,11 +1069,30 @@ Returns the following:
 
 ## LOG10
 
-`LOG10(expr)`
+Calculates the base-10 logarithm of the numeric expression.
 
-**Function type:** [Scalar, numeric](sql-scalar.md#numeric-functions)
+* **Syntax:** `LOG10(<NUMERIC>)`
+* **Function type:** Scalar, numeric
+
+<details><summary>Example</summary>
 
-Calculates the base-10 of the numeric expression.
+The following example applies the LOG10 function to the `max_temperature` 
column from the `taxi-trips` datasource.
+
+```sql
+SELECT
+  "max_temperature" AS "max_temperature",
+  LOG10("max_temperature") AS "log10_max_temp"
+FROM "taxi-trips"
+LIMIT 1
+```
+Returns the following:
+
+| `max_temperature` | `log10_max_temp` | 
+| -- | -- | 
+| `76` | `1.8808135922807914` | 
+</details>
+
+[Learn more](sql-scalar.md#numeric-functions)
 
 ## LOOKUP
 
@@ -1133,11 +1152,26 @@ Returns the minimum value of a set of values.
 
 ## MOD
 
-`MOD(x, y)`
+Calculates x modulo y, or the remainder of x divided by y. Where x and y are 
numeric expressions.
 
-**Function type:** [Scalar, numeric](sql-scalar.md#numeric-functions)
+* **Syntax:** `MOD(x, y)`
+* **Function type:** Scalar, numeric
+
+<details><summary>Example</summary>
+
+The following calculates 78 MOD 10.
+
+```sql
+SELECT MOD(78, 10) as "modulo"
+```
+Returns the following:
+
+| `modulo` | 
+| -- | 
+| `8` | 
+</details>
 
-Calculates x modulo y, or the remainder of x divided by y.
+[Learn more](sql-scalar.md#numeric-functions)
 
 ## MV_APPEND
 
@@ -1317,11 +1351,26 @@ Returns the one-based index position of a substring 
within an expression, option
 
 ## POWER
 
-`POWER(expr, power)`
+Calculates a numerical expression raised to the specified power.
 
-**Function type:** [Scalar, numeric](sql-scalar.md#numeric-functions)
+* **Syntax:** `POWER(base, exponent)`
+* **Function type:** Scalar, numeric
 
-Calculates a numerical expression raised to the specified power.
+<details><summary>Example</summary>
+
+The following example raises 5 to the power of 2.
+
+```sql
+SELECT POWER(5, 2) AS "power"
+```
+Returns the following:
+
+| `power` |
+| -- |
+| `25` | 
+</details>
+
+[Learn more](sql-scalar.md#numeric-functions)
 
 ## RADIANS
 
@@ -1398,11 +1447,31 @@ Returns the rightmost number of characters from an 
expression.
 
 ## ROUND
 
-`ROUND(expr[, digits])`
+Calculates the rounded value for a numerical expression.
 
-**Function type:** [Scalar, numeric](sql-scalar.md#numeric-functions)
+* **Syntax:** `ROUND(expr[, digits])`
+* **Function type:** Scalar, numeric
 
-Calculates the rounded value for a numerical expression.
+<details><summary>Example</summary>
+
+The following applies the ROUND function to 0 decimal points on the 
`pickup_longitude` column from the `taxi-trips` datasource.
+
+```sql
+SELECT
+  "pickup_longitude" AS "pickup_longitude",
+  ROUND("pickup_longitude", 0) as "rounded_pickup_longitude"
+FROM "taxi-trips"
+WHERE "pickup_longitude" IS NOT NULL
+LIMIT 1
+```
+Returns the following:
+
+| `pickup_longitude` | `rounded_pickup_longitude` | 
+| -- | -- | 
+| `-73.9377670288086` | `-74` | 
+</details>
+
+[Learn more](sql-scalar.md#numeric-functions)
 
 ## ROW_NUMBER
 
@@ -1446,11 +1515,26 @@ Calculates the trigonometric sine of an angle expressed 
in radians.
 
 ## SQRT
 
-`SQRT(expr)`
+Calculates the square root of a numeric expression.
 
-**Function type:** [Scalar, numeric](sql-scalar.md#numeric-functions)
+* **Syntax:** `SQRT(<NUMERIC>)`
+* **Function type:** Scalar, numeric
 
-Calculates the square root of a numeric expression.
+<details><summary>Example</summary>
+
+The following example calculates the square root of 25.
+
+```sql
+SELECT SQRT(25) AS "square_root"
+```
+Returns the following:
+
+| `square_root` |  
+| -- | 
+| `5` |
+</details>
+
+[Learn more](sql-scalar.md#numeric-functions)
 
 ## STDDEV
 
@@ -1720,20 +1804,41 @@ Trims the leading or trailing characters of an 
expression.
 
 ## TRUNC
 
-`TRUNC(expr[, digits])`
+Alias for [`TRUNCATE`](#truncate).
 
-**Function type:** [Scalar, numeric](sql-scalar.md#numeric-functions)
+* **Syntax:** `TRUNC(expr[, digits])`
+* **Function type:** Scalar, numeric
 
-Alias for [`TRUNCATE`](#truncate).
+[Learn more](sql-scalar.md#numeric-functions)
 
 ## TRUNCATE
 
-`TRUNCATE(expr[, digits])`
+Truncates a numerical expression to a specific number of decimal digits.
 
-**Function type:** [Scalar, numeric](sql-scalar.md#numeric-functions)
+* **Syntax:** `TRUNCATE(expr[, digits])`
+* **Function type:** Scalar, numeric
 
-Truncates a numerical expression to a specific number of decimal digits.
+<details><summary>Example</summary>
 
+The following applies the TRUNCATE function to 1 decimal place on the 
`pickup_longitude` column from the `taxi-trips` datasource.
+
+```sql
+SELECT
+  "pickup_longitude" as "pickup_longitude",
+  TRUNCATE("pickup_longitude", 1) as "truncate_pickup_longitude"
+FROM "taxi-trips"
+WHERE "pickup_longitude" IS NOT NULL
+LIMIT 1
+```
+Returns the following:
+
+| `pickup_longitude` | `truncate_pickup_longitude` | 
+| -- | -- | 
+| `-73.9377670288086` | `-73.9` | 
+</details>
+
+
+[Learn more](sql-scalar.md#numeric-functions)
 
 ## TRY_PARSE_JSON
 
@@ -1783,3 +1888,4 @@ Calculates the sample variance of a set of values.
 
 Alias for [`VAR_SAMP`](#var_samp).
 
+


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to