Skip to content

Commit

Permalink
Merge branch 'apache:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
KassieZ authored Feb 12, 2025
2 parents f088062 + 0a6d40a commit 3e720e8
Show file tree
Hide file tree
Showing 74 changed files with 2,310 additions and 2,291 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,27 @@ specific language governing permissions and limitations
under the License.
-->

## array_flatten
## Description

array_flatten

### description
Flatten a multidimensional array into one dimension.

#### Syntax
## Syntax

```sql
ARRAY<T> array_flatten(ARRAY<ARRAY<T>> array1)
array_flatten(<a>)
```

Flatten a multidimensional array into one dimension.
## Parameters

| Parameter | Description |
| --- | --- |
| `<a>` | ARRAY array |

### example
## Return Value

Returns the flattened array

## Example

```sql
mysql> select array_flatten([[1,2,3],[4,5]]);
Expand All @@ -57,7 +63,3 @@ mysql> select array_flatten([[[[[[1,2,3,4,5],[6,7],[8,9],[10,11],[12]],[[13]]],[
+-------------------------------------------------------------------------------+
1 row in set (0.02 sec)
```

### keywords

ARRAY,ARRAY_FLATTEN
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,68 @@ specific language governing permissions and limitations
under the License.
-->

## log10
## Description

### description
#### Syntax

`DOUBLE log10(DOUBLE x)`
Returns the natural logarithm of `x` to base `10`.

:::tip
Another alias for this function is `dlog10`.
:::
## Alias

- DLOG10

## Syntax

```sql
LOG10(<x>)
```

## Parameters

| Parameter | Description |
|-----------|------------|
| `<x>` | Antilogarithm should be greater than 0 |

## Return value

Returns a floating-point number.

- If x IS NULL: return `NULL`

### example
## Example

```sql
select log10(1);
```
mysql> select log10(1);
+------------+
| log10(1.0) |
+------------+
| 0 |
+------------+
mysql> select log10(10);
+-------------+
| log10(10.0) |
+-------------+
| 1 |
+-------------+
mysql> select log10(16);
+--------------------+
| log10(16.0) |
+--------------------+
| 1.2041199826559248 |
+--------------------+

```text
+--------------------------+
| log10(cast(1 as DOUBLE)) |
+--------------------------+
| 0.0 |
+--------------------------+
```

```sql
select log10(10);
```

```text
+---------------------------+
| log10(cast(10 as DOUBLE)) |
+---------------------------+
| 1.0 |
+---------------------------+
```

### keywords
LOG10, DLOG10
```sql
select log10(16);
```

```text
+---------------------------+
| log10(cast(16 as DOUBLE)) |
+---------------------------+
| 1.2041199826559248 |
+---------------------------+
```


Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,62 @@ specific language governing permissions and limitations
under the License.
-->

## log2
## Description

### description
#### Syntax

`DOUBLE log2(DOUBLE x)`
Returns the natural logarithm of `x` to base `2`.

### example
## Syntax

```sql
LOG2(<x>)
```
mysql> select log2(1);
+-----------+
| log2(1.0) |
+-----------+
| 0 |
+-----------+
mysql> select log2(2);
+-----------+
| log2(2.0) |
+-----------+
| 1 |
+-----------+
mysql> select log2(10);
+--------------------+
| log2(10.0) |
+--------------------+
| 3.3219280948873622 |
+--------------------+

## Parameters

| Parameter | Description |
|-----------|------------|
| `<x>` | Antilogarithm should be greater than 0 |

## Return value

Returns a floating-point number.

- If x IS NULL: return `NULL`

## Example

```sql
select log2(1);
```

### keywords
LOG2
```text
+-------------------------+
| log2(cast(1 as DOUBLE)) |
+-------------------------+
| 0.0 |
+-------------------------+
```

```sql
select log2(2);
```

```text
+-------------------------+
| log2(cast(2 as DOUBLE)) |
+-------------------------+
| 1.0 |
+-------------------------+
```

```sql
select log2(10);
```

```text
+--------------------------+
| log2(cast(10 as DOUBLE)) |
+--------------------------+
| 3.3219280948873626 |
+--------------------------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,74 @@ specific language governing permissions and limitations
under the License.
-->

## positive
## Description

### description
#### Syntax
Returns the value itself.

## Syntax

```sql
BIGINT positive(BIGINT x)
DOUBLE positive(DOUBLE x)
DECIMAL positive(DECIMAL x)
POSITIVE(<x>)
```
Return `x`.

### example
## Parameters

| Parameter | Description |
|-----------|------------|
| `<x>` | The value that needs to be returned. |

## Return value

Returns an integer or a floating-point number. Special cases:

- If the parameter is NULL, return NULL.

## Example

```sql
SELECT positive(-10);
```
mysql> SELECT positive(-10);

```text
+---------------+
| positive(-10) |
+---------------+
| -10 |
+---------------+
mysql> SELECT positive(12);
```

```sql
SELECT positive(10.111);
```

```text
+------------------+
| positive(10.111) |
+------------------+
| 10.111 |
+------------------+
```

```sql
SELECT positive(12);
```

```text
+--------------+
| positive(12) |
+--------------+
| 12 |
+--------------+
```

### keywords
POSITIVE
```sql
SELECT positive(null);
```

```text
+----------------+
| positive(NULL) |
+----------------+
| NULL |
+----------------+
```
Loading

0 comments on commit 3e720e8

Please sign in to comment.