chore(sql): Update SQL reference with additional functions (#6359)

* feat(sql): WIP added struct and map functions

* chore(sql): update sql reference with new functions

* chore(sql): migrate sql reference function updates to other projects

* chore(sql): readd deleted cache functions pages

* Update content/shared/sql-reference/functions/array.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(sql): fixed broken anchor links

* fix(sql): fixed typos

* Apply suggestions from code review

Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>
pull/6348/head^2
Scott Anderson 2025-09-05 08:26:38 -06:00 committed by GitHub
parent a29607def3
commit 8f729f9500
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
92 changed files with 2823 additions and 281 deletions

View File

@ -14,5 +14,5 @@ source: /shared/sql-reference/functions/_index.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/_index.md
// SOURCE content/shared/sql-reference/functions/_index.md
-->

View File

@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/aggregate.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/aggregate.md
// SOURCE content/shared/sql-reference/functions/aggregate.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL array functions
list_title: Array functions
description: >
Use array functions to create and operate on Arrow arrays or lists in SQL queries.
menu:
influxdb3_cloud_dedicated:
name: Array
parent: sql-functions
weight: 309
source: /shared/sql-reference/functions/array.md
---
<!--
// SOURCE content/shared/sql-reference/functions/array.md
-->

View File

@ -14,6 +14,5 @@ source: /shared/sql-reference/functions/binary-string.md
---
<!--
The content of this page is at
// SOURCE /content/shared/sql-reference/functions/binary-string.md
// SOURCE content/shared/sql-reference/functions/binary-string.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/conditional.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/conditional.md
// SOURCE content/shared/sql-reference/functions/conditional.md
-->

View File

@ -8,12 +8,11 @@ menu:
influxdb3_cloud_dedicated:
name: Hashing
parent: sql-functions
weight: 309
weight: 313
source: /shared/sql-reference/functions/hashing.md
---
<!--
The content for this page is at
// SOURCE /content/shared/sql-reference/functions/hashing.md
// SOURCE content/shared/sql-reference/functions/hashing.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL map functions
list_title: Map functions
description: >
Use map functions to create and operate on Arrow maps in SQL queries.
menu:
influxdb3_cloud_dedicated:
name: Map
parent: sql-functions
weight: 310
source: /shared/sql-reference/functions/map.md
---
<!--
// SOURCE content/shared/sql-reference/functions/map.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/math.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/math.md
// SOURCE content/shared/sql-reference/functions/math.md
-->

View File

@ -7,11 +7,11 @@ menu:
influxdb3_cloud_dedicated:
name: Miscellaneous
parent: sql-functions
weight: 310
weight: 314
source: /shared/sql-reference/functions/misc.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/misc.md
// SOURCE content/shared/sql-reference/functions/misc.md
-->

View File

@ -7,12 +7,12 @@ menu:
influxdb3_cloud_dedicated:
name: Regular expression
parent: sql-functions
weight: 308
weight: 312
influxdb3/cloud-dedicated/tags: [regular expressions, sql]
source: /shared/sql-reference/functions/regular-expression.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/regular-expression.md
// SOURCE content/shared/sql-reference/functions/regular-expression.md
-->

View File

@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/selector.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/selector.md
// SOURCE content/shared/sql-reference/functions/selector.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/string.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/string.md
// SOURCE content/shared/sql-reference/functions/string.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL struct functions
list_title: Struct functions
description: >
Use struct functions to create Arrow structs in SQL queries.
menu:
influxdb3_cloud_dedicated:
name: Struct
parent: sql-functions
weight: 311
source: /shared/sql-reference/functions/struct.md
---
<!--
// SOURCE content/shared/sql-reference/functions/struct.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/time-and-date.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/time-and-date.md
// SOURCE content/shared/sql-reference/functions/time-and-date.md
-->

View File

@ -8,11 +8,11 @@ menu:
influxdb3_cloud_dedicated:
name: Window
parent: sql-functions
weight: 309
weight: 315
source: /shared/sql-reference/functions/window.md
---
<!--
The content for this page is at content/shared/sql-reference/functions/window.md
// SOURCE content/shared/sql-reference/functions/window.md
-->

View File

@ -14,5 +14,5 @@ source: /shared/sql-reference/functions/_index.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/_index.md
-->
// SOURCE content/shared/sql-reference/functions/_index.md
-->

View File

@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/aggregate.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/aggregate.md
// SOURCE content/shared/sql-reference/functions/aggregate.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL array functions
list_title: Array functions
description: >
Use array functions to create and operate on Arrow arrays or lists in SQL queries.
menu:
influxdb3_cloud_serverless:
name: Array
parent: sql-functions
weight: 309
source: /shared/sql-reference/functions/array.md
---
<!--
// SOURCE content/shared/sql-reference/functions/array.md
-->

View File

@ -14,6 +14,5 @@ source: /shared/sql-reference/functions/binary-string.md
---
<!--
The content of this page is at
// SOURCE /content/shared/sql-reference/functions/binary-string.md
// SOURCE content/shared/sql-reference/functions/binary-string.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/conditional.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/conditional.md
// SOURCE content/shared/sql-reference/functions/conditional.md
-->

View File

@ -8,12 +8,11 @@ menu:
influxdb3_cloud_serverless:
name: Hashing
parent: sql-functions
weight: 309
weight: 313
source: /shared/sql-reference/functions/hashing.md
---
<!--
The content for this page is at
// SOURCE /content/shared/sql-reference/functions/hashing.md
// SOURCE content/shared/sql-reference/functions/hashing.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL map functions
list_title: Map functions
description: >
Use map functions to create and operate on Arrow maps in SQL queries.
menu:
influxdb3_cloud_serverless:
name: Map
parent: sql-functions
weight: 310
source: /shared/sql-reference/functions/map.md
---
<!--
// SOURCE content/shared/sql-reference/functions/map.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/math.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/math.md
-->
// SOURCE content/shared/sql-reference/functions/math.md
-->

View File

@ -7,11 +7,11 @@ menu:
influxdb3_cloud_serverless:
name: Miscellaneous
parent: sql-functions
weight: 310
weight: 314
source: /shared/sql-reference/functions/misc.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/misc.md
-->
// SOURCE content/shared/sql-reference/functions/misc.md
-->

View File

@ -7,12 +7,12 @@ menu:
influxdb3_cloud_serverless:
name: Regular expression
parent: sql-functions
weight: 308
weight: 312
influxdb3/cloud-serverless/tags: [regular expressions, sql]
source: /shared/sql-reference/functions/regular-expression.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/regular-expression.md
-->
// SOURCE content/shared/sql-reference/functions/regular-expression.md
-->

View File

@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/selector.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/selector.md
// SOURCE content/shared/sql-reference/functions/selector.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/string.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/string.md
// SOURCE content/shared/sql-reference/functions/string.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL struct functions
list_title: Struct functions
description: >
Use struct functions to create Arrow structs in SQL queries.
menu:
influxdb3_cloud_serverless:
name: Struct
parent: sql-functions
weight: 311
source: /shared/sql-reference/functions/struct.md
---
<!--
// SOURCE content/shared/sql-reference/functions/struct.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/time-and-date.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/time-and-date.md
// SOURCE content/shared/sql-reference/functions/time-and-date.md
-->

View File

@ -8,11 +8,11 @@ menu:
influxdb3_cloud_serverless:
name: Window
parent: sql-functions
weight: 309
weight: 315
source: /shared/sql-reference/functions/window.md
---
<!--
The content for this page is at content/shared/sql-reference/functions/window.md
// SOURCE content/shared/sql-reference/functions/window.md
-->

View File

@ -14,5 +14,5 @@ source: /shared/sql-reference/functions/_index.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/_index.md
-->
// SOURCE content/shared/sql-reference/functions/_index.md
-->

View File

@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/aggregate.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/aggregate.md
// SOURCE content/shared/sql-reference/functions/aggregate.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL array functions
list_title: Array functions
description: >
Use array functions to create and operate on Arrow arrays or lists in SQL queries.
menu:
influxdb3_clustered:
name: Array
parent: sql-functions
weight: 309
source: /shared/sql-reference/functions/array.md
---
<!--
// SOURCE content/shared/sql-reference/functions/array.md
-->

View File

@ -14,6 +14,5 @@ source: /shared/sql-reference/functions/binary-string.md
---
<!--
The content of this page is at
// SOURCE /content/shared/sql-reference/functions/binary-string.md
// SOURCE content/shared/sql-reference/functions/binary-string.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/conditional.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/conditional.md
// SOURCE content/shared/sql-reference/functions/conditional.md
-->

View File

@ -8,12 +8,11 @@ menu:
influxdb3_clustered:
name: Hashing
parent: sql-functions
weight: 309
weight: 313
source: /shared/sql-reference/functions/hashing.md
---
<!--
The content for this page is at
// SOURCE /content/shared/sql-reference/functions/hashing.md
// SOURCE content/shared/sql-reference/functions/hashing.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL map functions
list_title: Map functions
description: >
Use map functions to create and operate on Arrow maps in SQL queries.
menu:
influxdb3_clustered:
name: Map
parent: sql-functions
weight: 310
source: /shared/sql-reference/functions/map.md
---
<!--
// SOURCE content/shared/sql-reference/functions/map.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/math.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/math.md
-->
// SOURCE content/shared/sql-reference/functions/math.md
-->

View File

@ -7,11 +7,11 @@ menu:
influxdb3_clustered:
name: Miscellaneous
parent: sql-functions
weight: 310
weight: 314
source: /shared/sql-reference/functions/misc.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/misc.md
-->
// SOURCE content/shared/sql-reference/functions/misc.md
-->

View File

@ -7,12 +7,12 @@ menu:
influxdb3_clustered:
name: Regular expression
parent: sql-functions
weight: 308
weight: 312
influxdb3/clustered/tags: [regular expressions, sql]
source: /shared/sql-reference/functions/regular-expression.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/regular-expression.md
-->
// SOURCE content/shared/sql-reference/functions/regular-expression.md
-->

View File

@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/selector.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/selector.md
// SOURCE content/shared/sql-reference/functions/selector.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/string.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/string.md
// SOURCE content/shared/sql-reference/functions/string.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL struct functions
list_title: Struct functions
description: >
Use struct functions to create Arrow structs in SQL queries.
menu:
influxdb3_clustered:
name: Struct
parent: sql-functions
weight: 311
source: /shared/sql-reference/functions/struct.md
---
<!--
// SOURCE content/shared/sql-reference/functions/struct.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/time-and-date.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/time-and-date.md
// SOURCE content/shared/sql-reference/functions/time-and-date.md
-->

View File

@ -8,11 +8,11 @@ menu:
influxdb3_clustered:
name: Window
parent: sql-functions
weight: 309
weight: 315
source: /shared/sql-reference/functions/window.md
---
<!--
The content for this page is at content/shared/sql-reference/functions/window.md
// SOURCE content/shared/sql-reference/functions/window.md
-->

View File

@ -14,5 +14,5 @@ source: /shared/sql-reference/functions/_index.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/_index.md
-->
// SOURCE content/shared/sql-reference/functions/_index.md
-->

View File

@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/aggregate.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/aggregate.md
// SOURCE content/shared/sql-reference/functions/aggregate.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL array functions
list_title: Array functions
description: >
Use array functions to create and operate on Arrow arrays or lists in SQL queries.
menu:
influxdb3_core:
name: Array
parent: sql-functions
weight: 309
source: /shared/sql-reference/functions/array.md
---
<!--
// SOURCE content/shared/sql-reference/functions/array.md
-->

View File

@ -14,6 +14,5 @@ source: /shared/sql-reference/functions/binary-string.md
---
<!--
The content of this page is at
// SOURCE /content/shared/sql-reference/functions/binary-string.md
// SOURCE content/shared/sql-reference/functions/binary-string.md
-->

View File

@ -7,7 +7,7 @@ menu:
influxdb3_core:
name: Cache
parent: sql-functions
weight: 311
weight: 314
source: /shared/sql-reference/functions/cache.md
---

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/conditional.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/conditional.md
// SOURCE content/shared/sql-reference/functions/conditional.md
-->

View File

@ -8,12 +8,11 @@ menu:
influxdb3_core:
name: Hashing
parent: sql-functions
weight: 309
weight: 313
source: /shared/sql-reference/functions/hashing.md
---
<!--
The content for this page is at
// SOURCE /content/shared/sql-reference/functions/hashing.md
// SOURCE content/shared/sql-reference/functions/hashing.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL map functions
list_title: Map functions
description: >
Use map functions to create and operate on Arrow maps in SQL queries.
menu:
influxdb3_core:
name: Map
parent: sql-functions
weight: 310
source: /shared/sql-reference/functions/map.md
---
<!--
// SOURCE content/shared/sql-reference/functions/map.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/math.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/math.md
-->
// SOURCE content/shared/sql-reference/functions/math.md
-->

View File

@ -7,11 +7,11 @@ menu:
influxdb3_core:
name: Miscellaneous
parent: sql-functions
weight: 310
weight: 314
source: /shared/sql-reference/functions/misc.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/misc.md
-->
// SOURCE content/shared/sql-reference/functions/misc.md
-->

View File

@ -7,12 +7,12 @@ menu:
influxdb3_core:
name: Regular expression
parent: sql-functions
weight: 308
weight: 312
influxdb3/core/tags: [regular expressions, sql]
source: /shared/sql-reference/functions/regular-expression.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/regular-expression.md
-->
// SOURCE content/shared/sql-reference/functions/regular-expression.md
-->

View File

@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/selector.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/selector.md
// SOURCE content/shared/sql-reference/functions/selector.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/string.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/string.md
// SOURCE content/shared/sql-reference/functions/string.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL struct functions
list_title: Struct functions
description: >
Use struct functions to create Arrow structs in SQL queries.
menu:
influxdb3_core:
name: Struct
parent: sql-functions
weight: 311
source: /shared/sql-reference/functions/struct.md
---
<!--
// SOURCE content/shared/sql-reference/functions/struct.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/time-and-date.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/time-and-date.md
// SOURCE content/shared/sql-reference/functions/time-and-date.md
-->

View File

@ -8,11 +8,11 @@ menu:
influxdb3_core:
name: Window
parent: sql-functions
weight: 309
weight: 315
source: /shared/sql-reference/functions/window.md
---
<!--
The content for this page is at content/shared/sql-reference/functions/window.md
// SOURCE content/shared/sql-reference/functions/window.md
-->

View File

@ -14,5 +14,5 @@ source: /shared/sql-reference/functions/_index.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/_index.md
-->
// SOURCE content/shared/sql-reference/functions/_index.md
-->

View File

@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/aggregate.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/aggregate.md
// SOURCE content/shared/sql-reference/functions/aggregate.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL array functions
list_title: Array functions
description: >
Use array functions to create and operate on Arrow arrays or lists in SQL queries.
menu:
influxdb3_enterprise:
name: Array
parent: sql-functions
weight: 309
source: /shared/sql-reference/functions/array.md
---
<!--
// SOURCE content/shared/sql-reference/functions/array.md
-->

View File

@ -14,6 +14,5 @@ source: /shared/sql-reference/functions/binary-string.md
---
<!--
The content of this page is at
// SOURCE /content/shared/sql-reference/functions/binary-string.md
// SOURCE content/shared/sql-reference/functions/binary-string.md
-->

View File

@ -7,7 +7,7 @@ menu:
influxdb3_enterprise:
name: Cache
parent: sql-functions
weight: 311
weight: 314
source: /shared/sql-reference/functions/cache.md
---

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/conditional.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/conditional.md
// SOURCE content/shared/sql-reference/functions/conditional.md
-->

View File

@ -8,12 +8,11 @@ menu:
influxdb3_enterprise:
name: Hashing
parent: sql-functions
weight: 309
weight: 313
source: /shared/sql-reference/functions/hashing.md
---
<!--
The content for this page is at
// SOURCE /content/shared/sql-reference/functions/hashing.md
// SOURCE content/shared/sql-reference/functions/hashing.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL map functions
list_title: Map functions
description: >
Use map functions to create and operate on Arrow maps in SQL queries.
menu:
influxdb3_enterprise:
name: Map
parent: sql-functions
weight: 310
source: /shared/sql-reference/functions/map.md
---
<!--
// SOURCE content/shared/sql-reference/functions/map.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/math.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/math.md
-->
// SOURCE content/shared/sql-reference/functions/math.md
-->

View File

@ -7,11 +7,11 @@ menu:
influxdb3_enterprise:
name: Miscellaneous
parent: sql-functions
weight: 310
weight: 314
source: /shared/sql-reference/functions/misc.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/misc.md
-->
// SOURCE content/shared/sql-reference/functions/misc.md
-->

View File

@ -7,12 +7,12 @@ menu:
influxdb3_enterprise:
name: Regular expression
parent: sql-functions
weight: 308
weight: 312
influxdb3/enterprise/tags: [regular expressions, sql]
source: /shared/sql-reference/functions/regular-expression.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/regular-expression.md
-->
// SOURCE content/shared/sql-reference/functions/regular-expression.md
-->

View File

@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/selector.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/selector.md
// SOURCE content/shared/sql-reference/functions/selector.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/string.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/string.md
// SOURCE content/shared/sql-reference/functions/string.md
-->

View File

@ -0,0 +1,17 @@
---
title: SQL struct functions
list_title: Struct functions
description: >
Use struct functions to create Arrow structs in SQL queries.
menu:
influxdb3_enterprise:
name: Struct
parent: sql-functions
weight: 311
source: /shared/sql-reference/functions/struct.md
---
<!--
// SOURCE content/shared/sql-reference/functions/struct.md
-->

View File

@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/time-and-date.md
---
<!--
The content of this page is at /content/shared/sql-reference/functions/time-and-date.md
// SOURCE content/shared/sql-reference/functions/time-and-date.md
-->

View File

@ -8,11 +8,11 @@ menu:
influxdb3_enterprise:
name: Window
parent: sql-functions
weight: 309
weight: 315
source: /shared/sql-reference/functions/window.md
---
<!--
The content for this page is at content/shared/sql-reference/functions/window.md
// SOURCE content/shared/sql-reference/functions/window.md
-->

View File

@ -77,7 +77,7 @@ aggregate value.
Returns an array created from the expression elements.
> [!Note]
> `array_agg` returns a `LIST` arrow type. Use bracket notation to reference the
> `array_agg` returns a `LIST` Arrow type. Use bracket notation to reference the
> index of an element in the returned array. Arrays are 1-indexed.
```sql
@ -524,7 +524,7 @@ GROUP BY location
### mean
_Alias of [avg](#avg)._
_Alias of [`avg`](#avg)._
### median
@ -1403,7 +1403,7 @@ GROUP BY room
### var_population
_Alias of [var_pop](#var_pop)._
_Alias of [`var_pop`](#var_pop)._
### var_samp

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ Decode binary data from textual representation in string.
decode(expression, format)
```
##### Arguments
### Arguments
- **expression**: Expression containing encoded string data.
Can be a constant, column, or function, and any combination of string operators.
@ -33,7 +33,7 @@ Encode binary data into a textual representation.
encode(expression, format)
```
##### Arguments
### Arguments
- **expression**: Expression containing string or binary data.
Can be a constant, column, or function, and any combination of string operators.

View File

@ -13,11 +13,11 @@ Returns data from an {{< product-name >}} distinct value cache.
distinct_cache(table_name, cache_name)
```
#### Arguments
### Arguments
- **table_name**: Name of the table associated with the distinct value cache
_(formatted as a string literal)_.
- **datatype**: Name of the the distinct value cache to query
- **cache_name**: Name of the distinct value cache to query
_(formatted as a string literal)_.
{{< expand-wrapper >}}
@ -38,11 +38,11 @@ Returns data from an {{< product-name >}} last value cache.
last_cache(table_name, cache_name)
```
#### Arguments
### Arguments
- **table_name**: Name of the table associated with the last value cache
_(formatted as a string literal)_.
- **datatype**: Name of the the last value cache to query
- **cache_name**: Name of the last value cache to query
_(formatted as a string literal)_.
{{< expand-wrapper >}}

View File

@ -2,16 +2,13 @@ The {{< product-name >}} SQL implementation supports the following conditional
functions for conditionally handling _null_ values:
- [coalesce](#coalesce)
- [greatest](#greatest)
- [ifnull](#ifnull)
- [least](#least)
- [nullif](#nullif)
- [nvl](#nvl)
- [nvl2](#nvl2)
<!-- Will come with next DataFusion upgrade
- [greatest](#greatest)
- [least](#least)
-->
## coalesce
Returns the first of its arguments that is not _null_.
@ -56,7 +53,7 @@ FROM
{{% /expand %}}
{{< /expand-wrapper >}}
<!--
## greatest
Returns the greatest value in a list of expressions.
@ -79,25 +76,23 @@ _The following example uses the
[Random numbers sample dataset](/influxdb/version/reference/sample-data/#random-numbers-sample-data)._
```sql
SELECT greatest(a, b) AS greatest FROM numbers LIMIT 4
SELECT time, greatest(a, b) AS greatest FROM numbers LIMIT 4
```
| time | greatest |
| ------------------- | ------------------: |
| 2023-01-01T00:02:00 | -0.482943221384294 |
| 2023-01-01T00:03:00 | -0.0729732928756677 |
| 2023-01-01T00:04:00 | 1.77857552719844 |
| 2023-01-01T00:05:00 | 0.741147445214238 |
| time | greatest |
| :------------------ | -----------------: |
| 2023-01-01T01:20:00 | -0.515490223280789 |
| 2023-01-01T01:21:00 | 0.803201312042983 |
| 2023-01-01T01:22:00 | 0.970938142399892 |
| 2023-01-01T01:23:00 | 0.0493748366311344 |
{{% /expand %}}
{{< /expand-wrapper >}}
-->
## ifnull
_Alias of [nvl](#nvl)._
<!--
## least
Returns the least value in a list of expressions.
@ -120,19 +115,18 @@ _The following example uses the
[Random numbers sample dataset](/influxdb/version/reference/sample-data/#random-numbers-sample-data)._
```sql
SELECT least(a, b) AS least FROM numbers LIMIT 4
SELECT time, least(a, b) AS least FROM numbers LIMIT 4
```
| time | least |
| ------------------- | -----------------: |
| 2023-01-01T00:02:00 | -0.921037167720451 |
| 2023-01-01T00:03:00 | -0.73880754843378 |
| 2023-01-01T00:04:00 | -0.905980032168252 |
| 2023-01-01T00:05:00 | -0.891164752631417 |
| :------------------ | -----------------: |
| 2023-01-01T00:10:00 | -1.08759833527982 |
| 2023-01-01T00:11:00 | -0.187620086586211 |
| 2023-01-01T00:12:00 | -0.81371037157091 |
| 2023-01-01T00:13:00 | -0.339781659874945 |
{{% /expand %}}
{{< /expand-wrapper >}}
-->
## nullif

View File

@ -17,7 +17,7 @@ Computes the binary hash of an expression using the specified algorithm.
digest(expression, algorithm)
```
##### Arguments
### Arguments
- **expression**: String expression to operate on.
Can be a constant, column, or function, and any combination of operators.
@ -63,7 +63,7 @@ Computes an MD5 128-bit checksum for a string expression.
md5(expression)
```
##### Arguments
### Arguments
- **expression**: String expression to operate on.
Can be a constant, column, or function, and any combination of operators.
@ -98,7 +98,7 @@ Computes the SHA-224 hash of a binary string.
sha224(expression)
```
##### Arguments
### Arguments
- **expression**: String expression to operate on.
Can be a constant, column, or function, and any combination of operators.
@ -133,7 +133,7 @@ Computes the SHA-256 hash of a binary string.
sha256(expression)
```
##### Arguments
### Arguments
- **expression**: String expression to operate on.
Can be a constant, column, or function, and any combination of operators.
@ -168,7 +168,7 @@ Computes the SHA-384 hash of a binary string.
sha384(expression)
```
##### Arguments
### Arguments
- **expression**: String expression to operate on.
Can be a constant, column, or function, and any combination of operators.
@ -203,7 +203,7 @@ Computes the SHA-512 hash of a binary string.
sha512(expression)
```
##### Arguments
### Arguments
- **expression**: String expression to operate on.
Can be a constant, column, or function, and any combination of operators.

View File

@ -0,0 +1,272 @@
Use map functions to create and operate on Arrow maps in SQL queries.
- [element_at](#element_at)
- [make_map](#make_map)
- [map](#map)
- [map_extract](#map_extract)
- [map_keys](#map_keys)
- [map_values](#map_values)
<!-- - [map_entries](#map_entries) -->
## element_at
_Alias of [map_extract](#map_extract)._
## make_map
Returns an Arrow map with the specified key and value.
```sql
make_map(key, value)
```
### Arguments
- **key**: Expression to use for the key.
Can be a constant, column, function, or any combination of arithmetic or
string operators.
- **value**: Expression to use for the value.
Can be a constant, column, function, or any combination of arithmetic or
string operators.
{{< expand-wrapper >}}
{{% expand "View `make_map` query example" %}}
_The following example uses the
{{% influxdb3/home-sample-link %}}._
```sql
SELECT
make_map(room, temp) AS make_map
FROM
home
LIMIT 4
```
| make_map |
| :------------------ |
| {Kitchen: 22.4} |
| {Living Room: 22.2} |
| {Kitchen: 22.7} |
| {Living Room: 22.2} |
{{% /expand %}}
{{< /expand-wrapper >}}
## map
Returns an Arrow map with the specified key-value pairs.
Keys are mapped to values by their positions in each respective list.
Each _key_ must be unique and non-null.
```sql
map(key_list, value_list)
-- or
map { key: value, ... }
```
### Arguments
- **key_list**: List of keys to use in the map.
Each key must be unique and non-null.
- **value_list**: List of values to map to the corresponding keys.
{{< expand-wrapper >}}
{{% expand "View `map` query example" %}}
```sql
SELECT
map(
[400, 401, 402, 403, 404],
['Bad Request', 'Unauthorized', 'Payment Required', 'Forbidden', 'Not Found']
) AS map
```
| map |
| :------------------------------------------------------------------------------------------- |
| {400: Bad Request, 401: Unauthorized, 402: Payment Required, 403: Forbidden, 404: Not Found} |
{{% /expand %}}
{{% expand "View `map` query example with alternate syntax" %}}
```sql
SELECT
map {
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found'
} AS map
```
| map |
| :------------------------------------------------------------------------------------------- |
| {400: Bad Request, 401: Unauthorized, 402: Payment Required, 403: Forbidden, 404: Not Found} |
{{% /expand %}}
{{< /expand-wrapper >}}
<!-- ## map_entries
Returns a list of all entries in a map.
```sql
map_entries(map)
```
### Arguments
- **map**: Map expression. Can be a constant, column, or function, and any
combination of map operators.
{{< expand-wrapper >}}
{{% expand "View `map` query example" %}}
```sql
SELECT
map_entries(
map(
[400, 401, 404],
['Bad Request', 'Unauthorized', 'Not Found']
)
) AS map_entries
```
| map_entries |
| :---------------------------------------------------------------------------------------------------------- |
| [{'key': 400, 'value': Bad Request}, {'key': 401, 'value': Unauthorized}, {'key': 404, 'value': Not Found}] |
{{% /expand %}}
{{< /expand-wrapper >}} -->
## map_extract
Returns a list containing the value for the given key or an empty list if the
Returns a list containing the value for the given key, or an empty list if the
key is not present in the map. The returned list will contain exactly one element
(the value) when the key is found.
```sql
map_extract(map, key)
```
### Arguments
- **map**: Map expression. Can be a constant, column, or function, and any
combination of map operators.
- **key**: Key to extract from the map. Can be a constant, column, or function,
any combination of arithmetic or string operators, or a named expression of
the previously listed.
#### Aliases
- `element_at`
##### Related functions
[get_field](/influxdb3/version/reference/sql/functions/misc/#get_field)
{{< expand-wrapper >}}
{{% expand "View `map_extract` query example" %}}
The following example uses the
[NOAA Bay Area weather sample data](/influxdb3/version/reference/sample-data/#noaa-bay-area-weather-data)
to perform the a query that:
- Defines a set of constants that includes a map that assigns integers to days
of the week.
- Queries the weather sample data and use `date_part` to extract an integer
representing the day of the week of the row's `time` value.
- Uses `map_extract` and the output of `date_part` to return an array containing
the name of the day of the week.
- Uses bracket notation (`[i]`) to reference an element by index in the returned
list (SQL arrays are 1-indexed, so `[1]` retrieves the first element).
```sql
WITH constants AS (
SELECT map(
[0, 1, 2, 3, 4, 5, 6],
['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
) AS days_of_week
)
SELECT
weather.time,
map_extract(c.days_of_week, date_part('dow', time))[1] AS day_of_week
FROM
weather,
constants AS c
ORDER BY
weather.time
LIMIT 6
```
| time | day_of_week |
| :------------------ | :---------- |
| 2020-01-01T00:00:00 | Wednesday |
| 2020-01-01T00:00:00 | Wednesday |
| 2020-01-01T00:00:00 | Wednesday |
| 2020-01-02T00:00:00 | Thursday |
| 2020-01-02T00:00:00 | Thursday |
| 2020-01-02T00:00:00 | Thursday |
{{% /expand %}}
{{< /expand-wrapper >}}
## map_keys
Returns a list of all keys in the map.
```sql
map_keys(map)
```
### Arguments
- **map**: Map expression. Can be a constant, column, or function, and any
combination of map operators.
##### Related functions
[get_field](/influxdb3/version/reference/sql/functions/misc/#get_field)
{{< expand-wrapper >}}
{{% expand "View `map_keys` query example" %}}
```sql
SELECT map_keys(map {'a': 1, 'b': NULL, 'c': 3}) AS map_keys
```
| map_keys |
| :-------- |
| [a, b, c] |
{{% /expand %}}
{{< /expand-wrapper >}}
## map_values
Returns a list of all values in the map.
```sql
map_values(map)
```
### Arguments
- **map**: Map expression. Can be a constant, column, or function, and any combination of map operators.
{{< expand-wrapper >}}
{{% expand "View `map_values` query example" %}}
```sql
SELECT map_values(map {'a': 1, 'b': NULL, 'c': 3}) AS map_values
```
| map_values |
| :--------- |
| [1, , 3] |
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -49,7 +49,7 @@ Returns the absolute value of a number.
abs(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -80,7 +80,7 @@ Returns the arc cosine or inverse cosine of a number.
acos(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -111,7 +111,7 @@ Returns the area hyperbolic cosine or inverse hyperbolic cosine of a number.
acosh(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -142,7 +142,7 @@ Returns the arc sine or inverse sine of a number.
asin(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -173,7 +173,7 @@ Returns the area hyperbolic sine or inverse hyperbolic sine of a number.
asinh(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -204,7 +204,7 @@ Returns the arc tangent or inverse tangent of a number.
atan(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -235,7 +235,7 @@ Returns the area hyperbolic tangent or inverse hyperbolic tangent of a number.
atanh(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -266,7 +266,7 @@ Returns the arc tangent or inverse tangent of `expression_y / expression_x`.
atan2(expression_y, expression_x)
```
##### Arguments
### Arguments
- **expression_y**: First numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -299,7 +299,7 @@ Returns the cube root of a number.
cbrt(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -330,7 +330,7 @@ Returns the nearest integer greater than or equal to a number.
ceil(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -361,7 +361,7 @@ Returns the cosine of a number.
cos(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -392,7 +392,7 @@ Returns the hyperbolic cosine of a number.
cosh(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -423,7 +423,7 @@ Returns the cotangent of a number.
cot(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of operators.
@ -455,7 +455,7 @@ Converts radians to degrees.
degrees(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -487,7 +487,7 @@ Returns the base-e exponential of a number.
exp(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to use as the exponent.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -518,7 +518,7 @@ Returns 1 if value is less than 2.
factorial(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Must be an integer (`BIGINT`).
@ -551,7 +551,7 @@ Returns the nearest integer less than or equal to a number.
floor(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -583,7 +583,7 @@ Returns `0` if both inputs are zero.
gcd(expression_x, expression_y)
```
##### Arguments
### Arguments
- **expression_x**: First numeric expression to operate on.
Must be an integer (`BIGINT`).
@ -619,7 +619,7 @@ Returns `true` if a given number is ±NaN, otherwise returns `false`.
isnan(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Must be a float (`DOUBLE`).
@ -658,7 +658,7 @@ Returns `true` if the given number is ±0.0, otherwise returns `false`.
iszero(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -697,7 +697,7 @@ Returns `0` if either input is zero.
lcm(expression_x, expression_y)
```
##### Arguments
### Arguments
- **expression_x**: First numeric expression to operate on.
Must be an integer (`BIGINT`).
@ -733,7 +733,7 @@ Returns the natural logarithm of a number.
ln(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -805,7 +805,7 @@ Returns the base-10 logarithm of a number.
log10(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -836,7 +836,7 @@ Returns the base-2 logarithm of a number.
log2(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -868,7 +868,7 @@ Otherwise returns the second argument.
nanvl(expression_x, expression_y)
```
##### Arguments
### Arguments
- **expression_x**: Numeric expression to return if its not `NaN`.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -934,7 +934,7 @@ power(base, exponent)
- `pow`
##### Arguments
### Arguments
- **base**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -971,7 +971,7 @@ Converts degrees to radians.
radians(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1033,7 +1033,7 @@ Rounds a number to the nearest integer.
round(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1066,7 +1066,7 @@ Zero and positive numbers return `1`.
signum(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1097,7 +1097,7 @@ Returns the sine of a number.
sin(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1128,7 +1128,7 @@ Returns the hyperbolic sine of a number.
sinh(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1159,7 +1159,7 @@ Returns the square root of a number.
sqrt(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1190,7 +1190,7 @@ Returns the tangent of a number.
tan(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1221,7 +1221,7 @@ Returns the hyperbolic tangent of a number.
tanh(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1253,7 +1253,7 @@ Truncates a number toward zero (at the decimal point).
trunc(numeric_expression)
```
##### Arguments
### Arguments
- **numeric_expression**: Numeric expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.

View File

@ -3,10 +3,10 @@ for performing a variety of operations:
- [arrow_cast](#arrow_cast)
- [arrow_typeof](#arrow_typeof)
- [get_field](#get_field)
- [interpolate](#interpolate)
- [locf](#locf)
- [version](#version)
<!-- - [struct](#struct) -->
## arrow_cast
@ -16,7 +16,7 @@ Casts a value to a specific Arrow data type.
arrow_cast(expression, datatype)
```
#### Arguments
### Arguments
- **expression**: Expression to cast.
Can be a constant, column, or function, and any combination of arithmetic or
@ -55,7 +55,7 @@ of the expression:
arrow_typeof(expression)
```
##### Arguments
### Arguments
- **expression**: Expression to evaluate.
Can be a constant, column, or function, and any combination of arithmetic or
@ -84,6 +84,66 @@ LIMIT 1
{{% /expand %}}
{{< /expand-wrapper >}}
## get_field
Returns a field from a map or a struct with the specified key.
> [!Note]
> Typically, `get_field` is indirectly invoked via field access syntax such as
> `my_struct['field_name']` which results in the call:
> `get_field(my_struct, 'field_name')`.
```sql
get_field(collection, field)
```
### Arguments
- **collection**: The map or struct to retrieve a field from.
- **field**: The name of field the field to retrieve from the map or struct.
Must evaluate to a string.
{{< expand-wrapper >}}
{{% expand "View `get_field` example with a struct column" %}}
```sql
SELECT
get_field(influxdb_struct, 'version') AS influxdb_version
FROM
(VALUES (struct('influxdb' AS product, 'v1' AS version)),
(struct('influxdb' AS product, 'v2' AS version)),
(struct('influxdb' AS product, 'v3' AS version))
) AS data(influxdb_struct)
```
| influxdb_version |
| :--------------- |
| v1 |
| v2 |
| v3 |
{{% /expand %}}
{{% expand "View `get_field` example with a map column" %}}
```sql
SELECT
get_field(influxdb_map, 'version') AS influxdb_version
FROM
(VALUES (map {'product': 'influxdb', 'version': 'v1'}),
(map {'product': 'influxdb', 'version': 'v2'}),
(map {'product': 'influxdb', 'version': 'v3'})
) AS data(influxdb_map)
```
| influxdb_version |
| :--------------- |
| v1 |
| v2 |
| v3 |
{{% /expand %}}
{{< /expand-wrapper >}}
## interpolate
Fills null values in a specified aggregated column by interpolating values
@ -94,7 +154,7 @@ Must be used with [`date_bin_gapfill`](/influxdb/version/reference/sql/functions
interpolate(aggregate_expression)
```
##### Arguments
### Arguments
- **aggregate_expression**: Aggregate operation on a specified expression.
The operation can use any [aggregate function](/influxdb/version/reference/sql/functions/aggregate/).
@ -156,7 +216,7 @@ _LOCF is an initialism of "last observation carried forward."_
locf(aggregate_expression)
```
##### Arguments
### Arguments
- **aggregate_expression**: Aggregate operation on a specified expression.
The operation can use any [aggregate function](/influxdb/version/reference/sql/functions/aggregate/).
@ -206,34 +266,6 @@ GROUP BY _time, room
{{% /expand %}}
{{< /expand-wrapper >}}
<!--
## struct
Returns an Arrow struct using the specified input expressions.
Fields in the returned struct use the `cN` naming convention.
For example: `c0`, `c1`, `c2`, etc.
```sql
struct(expression1[, ..., expression_n])
```
##### Arguments
- **expression_n**: Expression to include in the output struct.
Can be a constant, column, or function, and any combination of arithmetic or
string operators.
{{< expand-wrapper >}}
{{% expand "View `struct` example" %}}
```sql
struct('A', 'B', 3, 4)
-- Returns {c0: A, c1: B, c3: 3, c4: 4}
```
{{% /expand %}}
{{< /expand-wrapper >}}
-->
## version
Returns the version of DataFusion.

View File

@ -17,7 +17,7 @@ Returns the number of matches that a regular expression has in a string.
regexp_count(str, regexp[, start, flags])
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of operators.
@ -62,7 +62,7 @@ false otherwise.
regexp_like(str, regexp[, flags])
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -104,7 +104,7 @@ Returns a list of regular expression matches in a string.
regexp_match(str, regexp, flags)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -147,7 +147,7 @@ Replaces substrings in a string that match a regular expression.
regexp_replace(str, regexp, replacement, flags)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.

View File

@ -61,7 +61,7 @@ Returns the smallest value of a selected column and a timestamp.
selector_min(expression, timestamp)
```
##### Arguments
#### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of string or
@ -103,7 +103,7 @@ Returns the largest value of a selected column and a timestamp.
selector_max(expression, timestamp)
```
##### Arguments
#### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of string or
@ -145,7 +145,7 @@ Returns the first value ordered by time ascending.
selector_first(expression, timestamp)
```
##### Arguments
#### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of string or
@ -187,7 +187,7 @@ Returns the last value ordered by time ascending.
selector_last(expression, timestamp)
```
##### Arguments
#### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of string or

View File

@ -54,7 +54,7 @@ Returns the ASCII value of the first character in a string.
ascii(str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -95,7 +95,7 @@ Returns the bit length of a string.
bit_length(str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -134,7 +134,7 @@ of the input string.
btrim(str[, trim_str])
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -225,7 +225,7 @@ Concatenates multiple strings together.
concat(str[, ..., str_n])
```
##### Arguments
### Arguments
- **str**: String expression to concatenate.
Can be a constant, column, or function, and any combination of string operators.
@ -233,7 +233,7 @@ concat(str[, ..., str_n])
##### Related functions
[contcat_ws](#contcat_ws)
[concat_ws](#concat_ws)
{{< expand-wrapper >}}
{{% expand "View `concat` query example" %}}
@ -268,7 +268,7 @@ Concatenates multiple strings together with a specified separator.
concat_ws(separator, str[, ..., str_n])
```
##### Arguments
### Arguments
- **separator**: Separator to insert between concatenated strings.
- **str**: String expression to concatenate.
@ -313,7 +313,7 @@ Returns true if a string contains a search string (case-sensitive).
contains(str, search_str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of operators.
@ -327,7 +327,7 @@ Tests if a string ends with a substring.
ends_with(str, substr)
```
##### Arguments
### Arguments
- **str**: String expression to test.
Can be a constant, column, or function, and any combination of string operators.
@ -365,7 +365,7 @@ Returns 0 if the string is not in the list of substrings.
find_in_set(str, strlist)
```
##### Arguments
### Arguments
- **str**: String expression to find in `strlist`.
- **strlist**: A string containing a comma-delimited list of substrings.
@ -402,7 +402,7 @@ Words are delimited by non-alphanumeric characters.
initcap(str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -444,7 +444,7 @@ If the substring is not in the string, the function returns 0.
instr(str, substr)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -484,7 +484,7 @@ Returns a specified number of characters from the left side of a string.
left(str, n)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -526,7 +526,7 @@ Returns the number of characters in a string.
length(str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -570,7 +570,7 @@ between two strings.
levenshtein(str1, str2)
```
##### Arguments
### Arguments
- **str1**: First string expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
- **str2**: Second string expression to operate on.
@ -608,7 +608,7 @@ Converts a string to lower-case.
lower(str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -646,7 +646,7 @@ Pads the left side of a string with another string to a specified string length.
lpad(str, n[, padding_str])
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -687,7 +687,7 @@ Removes leading spaces from a string.
ltrim(str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -733,7 +733,7 @@ Returns the length of a string in bytes.
octet_length(str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -772,7 +772,7 @@ position and number of characters to replace.
overlay(str PLACING substr FROM pos [FOR count])
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -814,7 +814,7 @@ Returns the position of a substring in a string.
position(substr IN str)
```
##### Arguments
### Arguments
- **substr**: Substring expression to search for.
Can be a constant, column, or function, and any combination of string operators.
@ -852,7 +852,7 @@ Returns a string with an input string repeated a specified number of times.
repeat(str, n)
```
##### Arguments
### Arguments
- **str**: String expression to repeat.
Can be a constant, column, or function, and any combination of string operators.
@ -889,7 +889,7 @@ Replaces all occurrences of a specified substring in a string with a new substri
replace(str, substr, replacement)
```
##### Arguments
### Arguments
- **str**: String expression to repeat.
Can be a constant, column, or function, and any combination of string operators.
@ -926,7 +926,7 @@ Reverses the character order of a string.
reverse(str)
```
##### Arguments
### Arguments
- **str**: String expression to repeat.
Can be a constant, column, or function, and any combination of string operators.
@ -959,7 +959,7 @@ Returns a specified number of characters from the right side of a string.
right(str, n)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -997,7 +997,7 @@ Pads the right side of a string with another string to a specified string length
rpad(str, n[, padding_str])
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -1038,7 +1038,7 @@ Removes trailing spaces from a string.
rtrim(str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -1081,7 +1081,7 @@ specified position.
split_part(str, delimiter, pos)
```
##### Arguments
### Arguments
- **str**: String expression to spit.
Can be a constant, column, or function, and any combination of string operators.
@ -1119,7 +1119,7 @@ Tests if a string starts with a substring.
starts_with(str, substr)
```
##### Arguments
### Arguments
- **str**: String expression to test.
Can be a constant, column, or function, and any combination of string operators.
@ -1159,7 +1159,7 @@ If the substring does not exist in the string, the function returns 0.
strpos(str, substr)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -1195,7 +1195,7 @@ starting position in a string.
substr(str, start_pos[, length])
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -1237,7 +1237,7 @@ final delimiter (counting from the right).
substr_index(str, delimiter, count)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -1321,7 +1321,7 @@ Converts an integer to a hexadecimal string.
to_hex(int)
```
##### Arguments
### Arguments
- **int**: Integer expression to convert.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1357,7 +1357,7 @@ Removes leading and trailing spaces from a string.
trim(str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.
@ -1399,7 +1399,7 @@ Converts a string to upper-case.
upper(str)
```
##### Arguments
### Arguments
- **str**: String expression to operate on.
Can be a constant, column, or function, and any combination of string operators.

View File

@ -0,0 +1,140 @@
Use struct functions to create Arrow structs in SQL queries.
- [named_struct](#named_struct)
- [row](#row)
- [struct](#struct)
## named_struct
Returns an _Arrow struct_ using the specified name and input expressions pairs.
```sql
named_struct(expression1_name, expression1_input[, ..., expression_n_name, expression_n_input])
```
### Arguments
- **expression_n_name**: Name of the column field. Must be a constant string.
- **expression_n_input**: Expression to include in the output struct.
Can be a constant, column, or function, and any combination of arithmetic or
string operators.
##### Related functions
[get_field](/influxdb3/version/reference/sql/functions/misc/#get_field)
{{< expand-wrapper >}}
{{% expand "View `named_struct` query example" %}}
_The following example uses the
{{% influxdb3/home-sample-link %}}._
```sql
SELECT
named_struct('time', time, 'temperature', temp, 'humidity', hum) AS named_struct
FROM
home
WHERE
room = 'Kitchen'
LIMIT 4
```
| named_struct |
| :------------------------------------------------------------- |
| {time: 2022-01-01T13:00:00, temperature: 22.8, humidity: 36.5} |
| {time: 2022-01-01T12:00:00, temperature: 22.5, humidity: 36.0} |
| {time: 2022-01-01T15:00:00, temperature: 22.7, humidity: 36.2} |
| {time: 2022-01-01T18:00:00, temperature: 23.3, humidity: 36.9} |
{{% /expand %}}
{{< /expand-wrapper >}}
## row
_Alias of [`struct`](#struct)._
## struct
Returns an _Arrow struct_ using the specified input expressions optionally named.
Fields in the returned struct use the optional name or the `cN` naming convention.
Fields in the returned struct use the `cN` naming convention (for example: `c0`, `c1`, `c2`, etc.)
unless you specify custom names using the `AS` operator within individual expressions.
```sql
struct(expression1[, ..., expression_n])
```
### Arguments
- **expression1, expression_n**: Expression to include in the output struct.
Can be a constant, column, or function, and any combination of arithmetic or
string operators.
### Aliases
- row
##### Related functions
[get_field](/influxdb3/version/reference/sql/functions/misc/#get_field)
{{< expand-wrapper >}}
{{% expand "View `struct` query example" %}}
_The following example uses the
{{% influxdb3/home-sample-link %}}._
```sql
SELECT
struct(time, temp, hum) AS struct
FROM
home
WHERE
room = 'Kitchen'
LIMIT 4
```
{{% influxdb/custom-timestamps %}}
| struct |
| :-------------------------------------------- |
| {c0: 2022-01-01T13:00:00, c1: 22.8, c2: 36.5} |
| {c0: 2022-01-01T12:00:00, c1: 22.5, c2: 36.0} |
| {c0: 2022-01-01T15:00:00, c1: 22.7, c2: 36.2} |
| {c0: 2022-01-01T18:00:00, c1: 23.3, c2: 36.9} |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{% expand "View `struct` query example with named fields" %}}
Use the `AS` operator in a `struct` expression argument to assign a name to the
struct field.
_The following example uses the
{{% influxdb3/home-sample-link %}}._
```sql
SELECT
struct(time AS 'time', temp AS 'temperature', hum) AS struct
FROM
home
WHERE
room = 'Kitchen'
LIMIT 4
```
{{% influxdb/custom-timestamps %}}
| struct |
| :------------------------------------------------------- |
| {time: 2022-01-01T13:00:00, temperature: 22.8, c2: 36.5} |
| {time: 2022-01-01T12:00:00, temperature: 22.5, c2: 36.0} |
| {time: 2022-01-01T15:00:00, temperature: 22.7, c2: 36.2} |
| {time: 2022-01-01T18:00:00, temperature: 23.3, c2: 36.9} |
{{% /influxdb/custom-timestamps %}}
{{% /expand %}}
{{< /expand-wrapper >}}

View File

@ -125,7 +125,7 @@ For example, if you "bin" or "window" data into 15-minute intervals, an input ti
date_bin(interval, expression[, origin_timestamp])
```
##### Arguments:
### Arguments
- **interval**: Bin interval. Supports the following interval units:
@ -197,7 +197,7 @@ date_bin_gapfill(interval, expression[, origin_timestamp])
> `date_bin_gapfill` requires [time bounds](/influxdb/version/query-data/sql/basic-query/#query-data-within-time-boundaries)
> in the `WHERE` clause.
##### Arguments:
### Arguments
- **interval**: Bin interval. Supports the following interval units:
@ -375,7 +375,7 @@ UTC offset of the input timestamp.
date_bin_wallclock(interval, expression[, origin_timestamp])
```
##### Arguments:
### Arguments
- **interval**: Bin interval. Supports the following interval units:
@ -514,7 +514,7 @@ date_bin_wallclock_gapfill(interval, expression[, origin_timestamp])
> `date_bin_wallclock_gapfill` requires [time bounds](/influxdb/version/query-data/sql/basic-query/#query-data-within-time-boundaries)
> in the `WHERE` clause.
##### Arguments:
### Arguments
- **interval**: Bin interval. Supports the following interval units:
@ -690,7 +690,7 @@ Truncates a timestamp value to a specified precision.
date_trunc(precision, expression)
```
##### Arguments:
### Arguments
- **precision**: Time precision to truncate to.
The following precisions are supported:
@ -778,7 +778,7 @@ Returns the specified part of the date as an integer.
date_part(part, expression)
```
##### Arguments:
### Arguments
- **part**: Part of the date to return.
The following date parts are supported:
@ -844,7 +844,7 @@ Similar to `date_part`, but with different arguments.
extract(field FROM source)
```
##### Arguments
### Arguments
- **field**: Part or field of the date to return.
The following date fields are supported:
@ -894,7 +894,7 @@ When output to Parquet, the raw integer value (for example, `1641042000`) is pre
from_unixtime(expression)
```
##### Arguments:
### Arguments
- **expression**: Integer expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -930,7 +930,7 @@ Returns a date using the component parts (year, month, day).
make_date(year, month, day)
```
##### Arguments
### Arguments
- **year**: Year to use when making the date.
Can be a constant, column or function, and any combination of arithmetic operators.
@ -1000,7 +1000,7 @@ a [Rust Chrono format string](https://docs.rs/chrono/latest/chrono/format/strfti
to_char(expression, format)
```
##### Arguments
### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function that results in a date, time, timestamp or duration.
@ -1042,7 +1042,7 @@ Numeric values are interpreted as days since the
to_date(expression[, ..., format_n])
```
###### Arguments
### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1082,7 +1082,7 @@ like daylight saving time (DST).
to_local_time(expression)
```
##### Arguments
### Arguments
- **expression**: Time expression to operate on.
Can be a constant, column, or function.
@ -1146,7 +1146,7 @@ and return the corresponding RFC3339 timestamp.
to_timestamp(expression)
```
##### Arguments:
### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1177,7 +1177,7 @@ and return the corresponding RFC3339 timestamp.
to_timestamp_micros(expression[, ..., format_n])
```
##### Arguments:
### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1223,7 +1223,7 @@ and return the corresponding RFC3339 timestamp.
to_timestamp_millis(expression[, ..., format_n])
```
##### Arguments:
### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1271,7 +1271,7 @@ and return the corresponding RFC3339 timestamp.
to_timestamp_nanos(expression[, ..., format_n])
```
##### Arguments:
### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1317,7 +1317,7 @@ and return the corresponding RFC3339 timestamp.
to_timestamp_seconds(expression[, ..., format_n])
```
##### Arguments:
### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1364,7 +1364,7 @@ are provided.
to_unixtime(expression[, ..., format_n])
```
##### Arguments
### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.
@ -1413,7 +1413,7 @@ Converts a timestamp to a provided timezone. If the second argument is not provi
tz(time_expression[, timezone])
```
##### Arguments
### Arguments
- **time_expression**: time to operate on.
Can be a constant, column, or function, and any combination of arithmetic operators.

View File

@ -36,7 +36,6 @@ ORDER BY
{{% /influxdb/custom-timestamps %}}
- [Window frames](#window-frames)
- [Window function syntax](#window-function-syntax)
- [OVER clause](#over-clause)
- [PARTITION BY clause](#partition-by-clause)
- [ORDER BY clause](#order-by-clause)
@ -566,7 +565,7 @@ ranking order.
ntile(expression)
```
##### Arguments
#### Arguments
- **expression**: An integer. The number of groups to split the partition into.
@ -823,7 +822,7 @@ Returns the value from the first row of the window frame.
first_value(expression)
```
##### Arguments
#### Arguments
- **expression**: Expression to operate on. Can be a constant, column, or
function, and any combination of arithmetic operators.
@ -879,7 +878,7 @@ the function returns the specified default.
lag(expression, offset, default)
```
##### Arguments
#### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic or
@ -938,7 +937,7 @@ Returns the value from the last row of the window frame.
last_value(expression)
```
##### Arguments
#### Arguments
- **expression**: Expression to operate on. Can be a constant, column, or
function, and any combination of arithmetic operators.
@ -995,7 +994,7 @@ the function returns the specified default.
lead(expression, offset, default)
```
##### Arguments
#### Arguments
- **expression**: Expression to operate on.
Can be a constant, column, or function, and any combination of arithmetic or
@ -1055,7 +1054,7 @@ Returns the value from the row that is the nth row of the window frame
nth_value(expression, n)
```
##### Arguments
#### Arguments
- **expression**: The expression to operator on.
Can be a constant, column, or function, and any combination of arithmetic or