diff --git a/api-docs/template.hbs b/api-docs/template.hbs index b98a20687..afed6e8be 100755 --- a/api-docs/template.hbs +++ b/api-docs/template.hbs @@ -31,6 +31,9 @@ padding: 0; margin: 0; } + #kapa-widget-container { + font-family: 'Proxima Nova', sans-serif; + } {{#unless disableGoogleFont}} // Load Kapa AI widget after DOM content is loaded document.addEventListener('DOMContentLoaded', function() { + const fontFamily = 'Proxima Nova, sans-serif'; const askAI = document.createElement('script'); askAI.type = 'text/javascript'; askAI.async = true; @@ -53,8 +57,8 @@ askAI.setAttribute('data-project-logo', '/img/influx-logo-cubo-white.png'); askAI.setAttribute('data-modal-disclaimer', 'This AI can access [documentation for InfluxDB, clients, and related tools](https://docs.influxdata.com). Information you submit is used in accordance with our [Privacy Policy](https://www.influxdata.com/legal/privacy-policy/).'); askAI.setAttribute('data-modal-example-questions', 'How do I write and query data with the {{title}}?, How do I use client libraries for the {{title}}?'); - askAI.setAttribute('data-button-height', '65px'); - askAI.setAttribute('data-button-width', '65px'); + askAI.setAttribute('data-button-height', '50px'); + askAI.setAttribute('data-button-width', '50px'); if (window.matchMedia('(max-width: 800px)').matches) { // For mobile devices (smaller than 600px) askAI.setAttribute('data-button-position-bottom', '130px'); @@ -62,25 +66,23 @@ // For larger screens askAI.setAttribute('data-button-position-bottom', '20px'); } + askAI.setAttribute('data-button-text-font-family', fontFamily); + askAI.setAttribute('data-button-text-font-size', '12.8px'); askAI.setAttribute('data-button-text', 'Ask AI'); askAI.setAttribute('data-conversation-button-icons-only', 'true'); - askAI.setAttribute('data-font-family', 'Proxima Nova, sans-serif'); + askAI.setAttribute('data-font-family', fontFamily); askAI.setAttribute('data-modal-example-questions-col-span', '8'); askAI.setAttribute('data-modal-full-screen-on-mobile', 'true'); askAI.setAttribute('data-modal-header-bg-color', '#d30971'); askAI.setAttribute('data-modal-header-border-bottom', 'none'); askAI.setAttribute('data-modal-header-padding', '.5rem'); askAI.setAttribute('data-modal-header-text-color', '#ffffff'); - askAI.setAttribute('data-modal-x-offset', '0'); + askAI.setAttribute('data-modal-size', '640px'); askAI.setAttribute('data-modal-y-offset', '0'); askAI.setAttribute('data-modal-with-overlay', 'false'); askAI.setAttribute('data-modal-inner-flex-direction', 'column'); askAI.setAttribute('data-modal-inner-justify-content', 'end'); - askAI.setAttribute('data-modal-inner-max-width', '600px'); - askAI.setAttribute('data-modal-inner-position-left', 'auto'); - askAI.setAttribute('data-modal-inner-position-right', '50px'); askAI.setAttribute('data-modal-inner-position-bottom', 'calc(2.5rem + 25px)'); - askAI.setAttribute('data-modal-size', '640px'); askAI.setAttribute('data-modal-title-color', '#fff'); askAI.setAttribute('data-modal-title-font-size', '1.25rem'); askAI.setAttribute('data-modal-lock-scroll', 'false'); diff --git a/assets/js/ask-ai.js b/assets/js/ask-ai.js index 9c145bab1..120047029 100644 --- a/assets/js/ask-ai.js +++ b/assets/js/ask-ai.js @@ -45,8 +45,6 @@ function initializeChat({ onChatLoad, chatAttributes }) { modalOverrideOpenClassAskAi: 'ask-ai-open', modalSize: '640px', modalWithOverlay: 'false', - modalInnerMaxWidth: '800px', - modalXOffset: 'calc(100% - 800px - (40rem * var(--mantine-scale))', modalYOffset: '10vh', userAnalyticsFingerprintEnabled: 'true', fontFamily: 'Proxima Nova, sans-serif', diff --git a/compose.yaml b/compose.yaml index ea11e03cb..612900f6a 100644 --- a/compose.yaml +++ b/compose.yaml @@ -307,6 +307,7 @@ services: influxdb3-core: container_name: influxdb3-core image: influxdb:3-core + pull_policy: always # Set variables (except your auth token) for Core in the .env.3core file. env_file: - .env.3core @@ -316,17 +317,21 @@ services: - influxdb3 - serve - --node-id=node0 - - --log-filter=debug - --object-store=file - --data-dir=/var/lib/influxdb3/data - --plugin-dir=/var/lib/influxdb3/plugins + - --log-filter=debug + - --verbose volumes: - type: bind source: test/.influxdb3/core/data target: /var/lib/influxdb3/data - type: bind - source: test/.influxdb3/core/plugins + source: test/.influxdb3/plugins/influxdata target: /var/lib/influxdb3/plugins + - type: bind + source: test/.influxdb3/core/plugins + target: /var/lib/influxdb3/plugins/custom environment: - INFLUXDB3_AUTH_TOKEN=/run/secrets/influxdb3-core-admin-token secrets: @@ -334,6 +339,7 @@ services: influxdb3-enterprise: container_name: influxdb3-enterprise image: influxdb:3-enterprise + pull_policy: always # Set license email and other variables (except your auth token) for Enterprise in the .env.3ent file. env_file: - .env.3ent @@ -344,10 +350,11 @@ services: - serve - --node-id=node0 - --cluster-id=cluster0 - - --log-filter=debug - --object-store=file - --data-dir=/var/lib/influxdb3/data - --plugin-dir=/var/lib/influxdb3/plugins + - --log-filter=debug + - --verbose environment: - INFLUXDB3_AUTH_TOKEN=/run/secrets/influxdb3-enterprise-admin-token volumes: @@ -355,8 +362,11 @@ services: source: test/.influxdb3/enterprise/data target: /var/lib/influxdb3/data - type: bind - source: test/.influxdb3/enterprise/plugins + source: test/.influxdb3/plugins/influxdata target: /var/lib/influxdb3/plugins + - type: bind + source: test/.influxdb3/enterprise/plugins + target: /var/lib/influxdb3/plugins/custom secrets: - influxdb3-enterprise-admin-token telegraf-pytest: diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/_index.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/_index.md index 643873b44..0a509ec36 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/_index.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/_index.md @@ -14,5 +14,5 @@ source: /shared/sql-reference/functions/_index.md --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/aggregate.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/aggregate.md index c6d8c8e92..465e5d23d 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/aggregate.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/aggregate.md @@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/aggregate.md --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/array.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/array.md new file mode 100644 index 000000000..b527991ea --- /dev/null +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/array.md @@ -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 +--- + + diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/binary-string.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/binary-string.md index e71ff2b84..3dd027195 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/binary-string.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/binary-string.md @@ -14,6 +14,5 @@ source: /shared/sql-reference/functions/binary-string.md --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/conditional.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/conditional.md index 21b48f8e5..2d2dbd7bd 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/conditional.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/conditional.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/conditional.md --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/hashing.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/hashing.md index 1241011f5..badcb3f74 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/hashing.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/hashing.md @@ -8,12 +8,11 @@ menu: influxdb3_cloud_dedicated: name: Hashing parent: sql-functions -weight: 309 +weight: 313 source: /shared/sql-reference/functions/hashing.md --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/map.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/map.md new file mode 100644 index 000000000..1421777d3 --- /dev/null +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/map.md @@ -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 +--- + + diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/math.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/math.md index 09d4d7ff1..a49972614 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/math.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/math.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/math.md --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/misc.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/misc.md index 3fc1e1db1..aa8ee7eb6 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/misc.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/misc.md @@ -7,11 +7,11 @@ menu: influxdb3_cloud_dedicated: name: Miscellaneous parent: sql-functions -weight: 310 +weight: 314 source: /shared/sql-reference/functions/misc.md --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/regular-expression.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/regular-expression.md index 67db2cf12..5089c80a9 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/regular-expression.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/regular-expression.md @@ -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 --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/selector.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/selector.md index f3149180e..812b026d1 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/selector.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/selector.md @@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/selector.md --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/string.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/string.md index 08bca3506..6e5535244 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/string.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/string.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/string.md --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/struct.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/struct.md new file mode 100644 index 000000000..95552dbcb --- /dev/null +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/struct.md @@ -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 +--- + + diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/time-and-date.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/time-and-date.md index 33949274a..dd5a8b762 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/time-and-date.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/time-and-date.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/time-and-date.md --- diff --git a/content/influxdb3/cloud-dedicated/reference/sql/functions/window.md b/content/influxdb3/cloud-dedicated/reference/sql/functions/window.md index b2f34e937..0c608a8e5 100644 --- a/content/influxdb3/cloud-dedicated/reference/sql/functions/window.md +++ b/content/influxdb3/cloud-dedicated/reference/sql/functions/window.md @@ -8,11 +8,11 @@ menu: influxdb3_cloud_dedicated: name: Window parent: sql-functions -weight: 309 +weight: 315 source: /shared/sql-reference/functions/window.md --- diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/_index.md b/content/influxdb3/cloud-serverless/reference/sql/functions/_index.md index 210a60d74..16137f7e5 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/_index.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/_index.md @@ -14,5 +14,5 @@ source: /shared/sql-reference/functions/_index.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/_index.md +--> diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/aggregate.md b/content/influxdb3/cloud-serverless/reference/sql/functions/aggregate.md index 9e890a3da..156b9bcf3 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/aggregate.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/aggregate.md @@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/aggregate.md --- diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/array.md b/content/influxdb3/cloud-serverless/reference/sql/functions/array.md new file mode 100644 index 000000000..e9479270b --- /dev/null +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/array.md @@ -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 +--- + + diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/binary-string.md b/content/influxdb3/cloud-serverless/reference/sql/functions/binary-string.md index 25b216982..6b40233e6 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/binary-string.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/binary-string.md @@ -14,6 +14,5 @@ source: /shared/sql-reference/functions/binary-string.md --- diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/conditional.md b/content/influxdb3/cloud-serverless/reference/sql/functions/conditional.md index f9e837b7e..d21540ccf 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/conditional.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/conditional.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/conditional.md --- diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/hashing.md b/content/influxdb3/cloud-serverless/reference/sql/functions/hashing.md index 5d4b4a201..94c4a3d4f 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/hashing.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/hashing.md @@ -8,12 +8,11 @@ menu: influxdb3_cloud_serverless: name: Hashing parent: sql-functions -weight: 309 +weight: 313 source: /shared/sql-reference/functions/hashing.md --- diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/map.md b/content/influxdb3/cloud-serverless/reference/sql/functions/map.md new file mode 100644 index 000000000..8cf856efe --- /dev/null +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/map.md @@ -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 +--- + + diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/math.md b/content/influxdb3/cloud-serverless/reference/sql/functions/math.md index cbb017d0c..aab06608e 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/math.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/math.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/math.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/math.md +--> diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/misc.md b/content/influxdb3/cloud-serverless/reference/sql/functions/misc.md index 1daf798c7..9396ff2e1 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/misc.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/misc.md @@ -7,11 +7,11 @@ menu: influxdb3_cloud_serverless: name: Miscellaneous parent: sql-functions -weight: 310 +weight: 314 source: /shared/sql-reference/functions/misc.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/misc.md +--> diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/regular-expression.md b/content/influxdb3/cloud-serverless/reference/sql/functions/regular-expression.md index fc4a6b150..299df8792 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/regular-expression.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/regular-expression.md @@ -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 --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/regular-expression.md +--> diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/selector.md b/content/influxdb3/cloud-serverless/reference/sql/functions/selector.md index acc3b9394..428906ac4 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/selector.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/selector.md @@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/selector.md --- diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/string.md b/content/influxdb3/cloud-serverless/reference/sql/functions/string.md index 861d13b2a..202abb70b 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/string.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/string.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/string.md --- diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/struct.md b/content/influxdb3/cloud-serverless/reference/sql/functions/struct.md new file mode 100644 index 000000000..951abe974 --- /dev/null +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/struct.md @@ -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 +--- + + diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/time-and-date.md b/content/influxdb3/cloud-serverless/reference/sql/functions/time-and-date.md index 322f30c5d..5008831ea 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/time-and-date.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/time-and-date.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/time-and-date.md --- diff --git a/content/influxdb3/cloud-serverless/reference/sql/functions/window.md b/content/influxdb3/cloud-serverless/reference/sql/functions/window.md index 882722f57..eeb839ccb 100644 --- a/content/influxdb3/cloud-serverless/reference/sql/functions/window.md +++ b/content/influxdb3/cloud-serverless/reference/sql/functions/window.md @@ -8,11 +8,11 @@ menu: influxdb3_cloud_serverless: name: Window parent: sql-functions -weight: 309 +weight: 315 source: /shared/sql-reference/functions/window.md --- diff --git a/content/influxdb3/clustered/reference/sql/functions/_index.md b/content/influxdb3/clustered/reference/sql/functions/_index.md index d0dd020e7..5fab8b9ff 100644 --- a/content/influxdb3/clustered/reference/sql/functions/_index.md +++ b/content/influxdb3/clustered/reference/sql/functions/_index.md @@ -14,5 +14,5 @@ source: /shared/sql-reference/functions/_index.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/_index.md +--> diff --git a/content/influxdb3/clustered/reference/sql/functions/aggregate.md b/content/influxdb3/clustered/reference/sql/functions/aggregate.md index 627276ff3..891c4742b 100644 --- a/content/influxdb3/clustered/reference/sql/functions/aggregate.md +++ b/content/influxdb3/clustered/reference/sql/functions/aggregate.md @@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/aggregate.md --- diff --git a/content/influxdb3/clustered/reference/sql/functions/array.md b/content/influxdb3/clustered/reference/sql/functions/array.md new file mode 100644 index 000000000..e36fddfa2 --- /dev/null +++ b/content/influxdb3/clustered/reference/sql/functions/array.md @@ -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 +--- + + diff --git a/content/influxdb3/clustered/reference/sql/functions/binary-string.md b/content/influxdb3/clustered/reference/sql/functions/binary-string.md index d6150ffef..d32411f36 100644 --- a/content/influxdb3/clustered/reference/sql/functions/binary-string.md +++ b/content/influxdb3/clustered/reference/sql/functions/binary-string.md @@ -14,6 +14,5 @@ source: /shared/sql-reference/functions/binary-string.md --- diff --git a/content/influxdb3/clustered/reference/sql/functions/conditional.md b/content/influxdb3/clustered/reference/sql/functions/conditional.md index db930a108..84c197d46 100644 --- a/content/influxdb3/clustered/reference/sql/functions/conditional.md +++ b/content/influxdb3/clustered/reference/sql/functions/conditional.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/conditional.md --- diff --git a/content/influxdb3/clustered/reference/sql/functions/hashing.md b/content/influxdb3/clustered/reference/sql/functions/hashing.md index 38a2a7482..46ecd7aca 100644 --- a/content/influxdb3/clustered/reference/sql/functions/hashing.md +++ b/content/influxdb3/clustered/reference/sql/functions/hashing.md @@ -8,12 +8,11 @@ menu: influxdb3_clustered: name: Hashing parent: sql-functions -weight: 309 +weight: 313 source: /shared/sql-reference/functions/hashing.md --- diff --git a/content/influxdb3/clustered/reference/sql/functions/map.md b/content/influxdb3/clustered/reference/sql/functions/map.md new file mode 100644 index 000000000..97d21217b --- /dev/null +++ b/content/influxdb3/clustered/reference/sql/functions/map.md @@ -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 +--- + + diff --git a/content/influxdb3/clustered/reference/sql/functions/math.md b/content/influxdb3/clustered/reference/sql/functions/math.md index 0e032d479..436b2e9c5 100644 --- a/content/influxdb3/clustered/reference/sql/functions/math.md +++ b/content/influxdb3/clustered/reference/sql/functions/math.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/math.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/math.md +--> diff --git a/content/influxdb3/clustered/reference/sql/functions/misc.md b/content/influxdb3/clustered/reference/sql/functions/misc.md index 3965055c1..4b947169d 100644 --- a/content/influxdb3/clustered/reference/sql/functions/misc.md +++ b/content/influxdb3/clustered/reference/sql/functions/misc.md @@ -7,11 +7,11 @@ menu: influxdb3_clustered: name: Miscellaneous parent: sql-functions -weight: 310 +weight: 314 source: /shared/sql-reference/functions/misc.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/misc.md +--> diff --git a/content/influxdb3/clustered/reference/sql/functions/regular-expression.md b/content/influxdb3/clustered/reference/sql/functions/regular-expression.md index c07b0eab5..203fe483e 100644 --- a/content/influxdb3/clustered/reference/sql/functions/regular-expression.md +++ b/content/influxdb3/clustered/reference/sql/functions/regular-expression.md @@ -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 --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/regular-expression.md +--> diff --git a/content/influxdb3/clustered/reference/sql/functions/selector.md b/content/influxdb3/clustered/reference/sql/functions/selector.md index ff8a121bc..7f907fe91 100644 --- a/content/influxdb3/clustered/reference/sql/functions/selector.md +++ b/content/influxdb3/clustered/reference/sql/functions/selector.md @@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/selector.md --- diff --git a/content/influxdb3/clustered/reference/sql/functions/string.md b/content/influxdb3/clustered/reference/sql/functions/string.md index 4b072bd5c..5b93e8985 100644 --- a/content/influxdb3/clustered/reference/sql/functions/string.md +++ b/content/influxdb3/clustered/reference/sql/functions/string.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/string.md --- diff --git a/content/influxdb3/clustered/reference/sql/functions/struct.md b/content/influxdb3/clustered/reference/sql/functions/struct.md new file mode 100644 index 000000000..7bc0d38ff --- /dev/null +++ b/content/influxdb3/clustered/reference/sql/functions/struct.md @@ -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 +--- + + diff --git a/content/influxdb3/clustered/reference/sql/functions/time-and-date.md b/content/influxdb3/clustered/reference/sql/functions/time-and-date.md index 1acac8a3d..85fd23231 100644 --- a/content/influxdb3/clustered/reference/sql/functions/time-and-date.md +++ b/content/influxdb3/clustered/reference/sql/functions/time-and-date.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/time-and-date.md --- diff --git a/content/influxdb3/clustered/reference/sql/functions/window.md b/content/influxdb3/clustered/reference/sql/functions/window.md index 4b4c0052a..35c7d5a6d 100644 --- a/content/influxdb3/clustered/reference/sql/functions/window.md +++ b/content/influxdb3/clustered/reference/sql/functions/window.md @@ -8,11 +8,11 @@ menu: influxdb3_clustered: name: Window parent: sql-functions -weight: 309 +weight: 315 source: /shared/sql-reference/functions/window.md --- diff --git a/content/influxdb3/core/reference/sql/functions/_index.md b/content/influxdb3/core/reference/sql/functions/_index.md index fa8e5be81..5fb175955 100644 --- a/content/influxdb3/core/reference/sql/functions/_index.md +++ b/content/influxdb3/core/reference/sql/functions/_index.md @@ -14,5 +14,5 @@ source: /shared/sql-reference/functions/_index.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/_index.md +--> diff --git a/content/influxdb3/core/reference/sql/functions/aggregate.md b/content/influxdb3/core/reference/sql/functions/aggregate.md index 3b4a2b8ac..2bdcec17d 100644 --- a/content/influxdb3/core/reference/sql/functions/aggregate.md +++ b/content/influxdb3/core/reference/sql/functions/aggregate.md @@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/aggregate.md --- diff --git a/content/influxdb3/core/reference/sql/functions/array.md b/content/influxdb3/core/reference/sql/functions/array.md new file mode 100644 index 000000000..a413d5a1a --- /dev/null +++ b/content/influxdb3/core/reference/sql/functions/array.md @@ -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 +--- + + diff --git a/content/influxdb3/core/reference/sql/functions/binary-string.md b/content/influxdb3/core/reference/sql/functions/binary-string.md index b12e5e8d5..da92409c0 100644 --- a/content/influxdb3/core/reference/sql/functions/binary-string.md +++ b/content/influxdb3/core/reference/sql/functions/binary-string.md @@ -14,6 +14,5 @@ source: /shared/sql-reference/functions/binary-string.md --- diff --git a/content/influxdb3/core/reference/sql/functions/cache.md b/content/influxdb3/core/reference/sql/functions/cache.md index c56aa4cfd..9b2f4444d 100644 --- a/content/influxdb3/core/reference/sql/functions/cache.md +++ b/content/influxdb3/core/reference/sql/functions/cache.md @@ -7,7 +7,7 @@ menu: influxdb3_core: name: Cache parent: sql-functions -weight: 311 +weight: 314 source: /shared/sql-reference/functions/cache.md --- diff --git a/content/influxdb3/core/reference/sql/functions/conditional.md b/content/influxdb3/core/reference/sql/functions/conditional.md index 1a4ed38ae..8bf49e4e9 100644 --- a/content/influxdb3/core/reference/sql/functions/conditional.md +++ b/content/influxdb3/core/reference/sql/functions/conditional.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/conditional.md --- diff --git a/content/influxdb3/core/reference/sql/functions/hashing.md b/content/influxdb3/core/reference/sql/functions/hashing.md index 5e0248f84..d03ab9e27 100644 --- a/content/influxdb3/core/reference/sql/functions/hashing.md +++ b/content/influxdb3/core/reference/sql/functions/hashing.md @@ -8,12 +8,11 @@ menu: influxdb3_core: name: Hashing parent: sql-functions -weight: 309 +weight: 313 source: /shared/sql-reference/functions/hashing.md --- diff --git a/content/influxdb3/core/reference/sql/functions/map.md b/content/influxdb3/core/reference/sql/functions/map.md new file mode 100644 index 000000000..b399242c7 --- /dev/null +++ b/content/influxdb3/core/reference/sql/functions/map.md @@ -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 +--- + + diff --git a/content/influxdb3/core/reference/sql/functions/math.md b/content/influxdb3/core/reference/sql/functions/math.md index 572b47353..e8ab5fe5b 100644 --- a/content/influxdb3/core/reference/sql/functions/math.md +++ b/content/influxdb3/core/reference/sql/functions/math.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/math.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/math.md +--> diff --git a/content/influxdb3/core/reference/sql/functions/misc.md b/content/influxdb3/core/reference/sql/functions/misc.md index 3235bf654..971d80bb2 100644 --- a/content/influxdb3/core/reference/sql/functions/misc.md +++ b/content/influxdb3/core/reference/sql/functions/misc.md @@ -7,11 +7,11 @@ menu: influxdb3_core: name: Miscellaneous parent: sql-functions -weight: 310 +weight: 314 source: /shared/sql-reference/functions/misc.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/misc.md +--> diff --git a/content/influxdb3/core/reference/sql/functions/regular-expression.md b/content/influxdb3/core/reference/sql/functions/regular-expression.md index 8d5f0a29b..fdb305c36 100644 --- a/content/influxdb3/core/reference/sql/functions/regular-expression.md +++ b/content/influxdb3/core/reference/sql/functions/regular-expression.md @@ -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 --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/regular-expression.md +--> diff --git a/content/influxdb3/core/reference/sql/functions/selector.md b/content/influxdb3/core/reference/sql/functions/selector.md index d74760493..ff14ff96b 100644 --- a/content/influxdb3/core/reference/sql/functions/selector.md +++ b/content/influxdb3/core/reference/sql/functions/selector.md @@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/selector.md --- diff --git a/content/influxdb3/core/reference/sql/functions/string.md b/content/influxdb3/core/reference/sql/functions/string.md index 07f02e941..bef0515e6 100644 --- a/content/influxdb3/core/reference/sql/functions/string.md +++ b/content/influxdb3/core/reference/sql/functions/string.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/string.md --- diff --git a/content/influxdb3/core/reference/sql/functions/struct.md b/content/influxdb3/core/reference/sql/functions/struct.md new file mode 100644 index 000000000..1db0dd9eb --- /dev/null +++ b/content/influxdb3/core/reference/sql/functions/struct.md @@ -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 +--- + + diff --git a/content/influxdb3/core/reference/sql/functions/time-and-date.md b/content/influxdb3/core/reference/sql/functions/time-and-date.md index 1d58575f5..60cf7f76d 100644 --- a/content/influxdb3/core/reference/sql/functions/time-and-date.md +++ b/content/influxdb3/core/reference/sql/functions/time-and-date.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/time-and-date.md --- diff --git a/content/influxdb3/core/reference/sql/functions/window.md b/content/influxdb3/core/reference/sql/functions/window.md index e964f30ed..4c000077d 100644 --- a/content/influxdb3/core/reference/sql/functions/window.md +++ b/content/influxdb3/core/reference/sql/functions/window.md @@ -8,11 +8,11 @@ menu: influxdb3_core: name: Window parent: sql-functions -weight: 309 +weight: 315 source: /shared/sql-reference/functions/window.md --- diff --git a/content/influxdb3/enterprise/reference/sql/functions/_index.md b/content/influxdb3/enterprise/reference/sql/functions/_index.md index eb99e2246..9c3da8d4c 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/_index.md +++ b/content/influxdb3/enterprise/reference/sql/functions/_index.md @@ -14,5 +14,5 @@ source: /shared/sql-reference/functions/_index.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/_index.md +--> diff --git a/content/influxdb3/enterprise/reference/sql/functions/aggregate.md b/content/influxdb3/enterprise/reference/sql/functions/aggregate.md index affec8cfa..2e533d9a2 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/aggregate.md +++ b/content/influxdb3/enterprise/reference/sql/functions/aggregate.md @@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/aggregate.md --- diff --git a/content/influxdb3/enterprise/reference/sql/functions/array.md b/content/influxdb3/enterprise/reference/sql/functions/array.md new file mode 100644 index 000000000..fa9006c47 --- /dev/null +++ b/content/influxdb3/enterprise/reference/sql/functions/array.md @@ -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 +--- + + diff --git a/content/influxdb3/enterprise/reference/sql/functions/binary-string.md b/content/influxdb3/enterprise/reference/sql/functions/binary-string.md index 1f3f33f0d..c9d44878b 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/binary-string.md +++ b/content/influxdb3/enterprise/reference/sql/functions/binary-string.md @@ -14,6 +14,5 @@ source: /shared/sql-reference/functions/binary-string.md --- diff --git a/content/influxdb3/enterprise/reference/sql/functions/cache.md b/content/influxdb3/enterprise/reference/sql/functions/cache.md index e1656ee44..505346fbc 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/cache.md +++ b/content/influxdb3/enterprise/reference/sql/functions/cache.md @@ -7,7 +7,7 @@ menu: influxdb3_enterprise: name: Cache parent: sql-functions -weight: 311 +weight: 314 source: /shared/sql-reference/functions/cache.md --- diff --git a/content/influxdb3/enterprise/reference/sql/functions/conditional.md b/content/influxdb3/enterprise/reference/sql/functions/conditional.md index 07bb62cbc..5edc59782 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/conditional.md +++ b/content/influxdb3/enterprise/reference/sql/functions/conditional.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/conditional.md --- diff --git a/content/influxdb3/enterprise/reference/sql/functions/hashing.md b/content/influxdb3/enterprise/reference/sql/functions/hashing.md index 4770d5336..509eac3e4 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/hashing.md +++ b/content/influxdb3/enterprise/reference/sql/functions/hashing.md @@ -8,12 +8,11 @@ menu: influxdb3_enterprise: name: Hashing parent: sql-functions -weight: 309 +weight: 313 source: /shared/sql-reference/functions/hashing.md --- diff --git a/content/influxdb3/enterprise/reference/sql/functions/map.md b/content/influxdb3/enterprise/reference/sql/functions/map.md new file mode 100644 index 000000000..4fca52803 --- /dev/null +++ b/content/influxdb3/enterprise/reference/sql/functions/map.md @@ -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 +--- + + diff --git a/content/influxdb3/enterprise/reference/sql/functions/math.md b/content/influxdb3/enterprise/reference/sql/functions/math.md index 934980b30..5998892e3 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/math.md +++ b/content/influxdb3/enterprise/reference/sql/functions/math.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/math.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/math.md +--> diff --git a/content/influxdb3/enterprise/reference/sql/functions/misc.md b/content/influxdb3/enterprise/reference/sql/functions/misc.md index 7bc7f4803..e91ed96e1 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/misc.md +++ b/content/influxdb3/enterprise/reference/sql/functions/misc.md @@ -7,11 +7,11 @@ menu: influxdb3_enterprise: name: Miscellaneous parent: sql-functions -weight: 310 +weight: 314 source: /shared/sql-reference/functions/misc.md --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/misc.md +--> diff --git a/content/influxdb3/enterprise/reference/sql/functions/regular-expression.md b/content/influxdb3/enterprise/reference/sql/functions/regular-expression.md index 5d118bbc7..f1671e039 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/regular-expression.md +++ b/content/influxdb3/enterprise/reference/sql/functions/regular-expression.md @@ -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 --- \ No newline at end of file +// SOURCE content/shared/sql-reference/functions/regular-expression.md +--> diff --git a/content/influxdb3/enterprise/reference/sql/functions/selector.md b/content/influxdb3/enterprise/reference/sql/functions/selector.md index 4f974a754..95d562e4a 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/selector.md +++ b/content/influxdb3/enterprise/reference/sql/functions/selector.md @@ -15,5 +15,5 @@ source: /shared/sql-reference/functions/selector.md --- diff --git a/content/influxdb3/enterprise/reference/sql/functions/string.md b/content/influxdb3/enterprise/reference/sql/functions/string.md index 7a292892f..7e81f1512 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/string.md +++ b/content/influxdb3/enterprise/reference/sql/functions/string.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/string.md --- diff --git a/content/influxdb3/enterprise/reference/sql/functions/struct.md b/content/influxdb3/enterprise/reference/sql/functions/struct.md new file mode 100644 index 000000000..769f1107a --- /dev/null +++ b/content/influxdb3/enterprise/reference/sql/functions/struct.md @@ -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 +--- + + diff --git a/content/influxdb3/enterprise/reference/sql/functions/time-and-date.md b/content/influxdb3/enterprise/reference/sql/functions/time-and-date.md index 7776a453b..5dbb1ff67 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/time-and-date.md +++ b/content/influxdb3/enterprise/reference/sql/functions/time-and-date.md @@ -13,5 +13,5 @@ source: /shared/sql-reference/functions/time-and-date.md --- diff --git a/content/influxdb3/enterprise/reference/sql/functions/window.md b/content/influxdb3/enterprise/reference/sql/functions/window.md index 934c647be..19175317d 100644 --- a/content/influxdb3/enterprise/reference/sql/functions/window.md +++ b/content/influxdb3/enterprise/reference/sql/functions/window.md @@ -8,11 +8,11 @@ menu: influxdb3_enterprise: name: Window parent: sql-functions -weight: 309 +weight: 315 source: /shared/sql-reference/functions/window.md --- diff --git a/content/influxdb3/explorer/install.md b/content/influxdb3/explorer/install.md index 9478137ec..e555511a2 100644 --- a/content/influxdb3/explorer/install.md +++ b/content/influxdb3/explorer/install.md @@ -11,301 +11,533 @@ weight: 2 Use [Docker](https://docker.com) to install and run **InfluxDB 3 Explorer**. -- [Run the InfluxDB 3 Explorer Docker container](#run-the-influxdb-3-explorer-docker-container) -- [Enable TLS/SSL (HTTPS)](#enable-tlsssl-https) -- [Pre-configure InfluxDB connection settings](#pre-configure-influxdb-connection-settings) -- [Run in query or admin mode](#run-in-query-or-admin-mode) - - [Run in query mode](#run-in-query-mode) - - [Run in admin mode](#run-in-admin-mode) -- [Environment Variables](#environment-variables) -- [Volume Reference](#volume-reference) -- [Exposed Ports](#exposed-ports) - - [Custom port mapping](#custom-port-mapping) +- [Quick start](#quick-start) +- [Installation methods](#installation-methods) +- [Configuration options](#configuration-options) + - [Persist data across restarts](#persist-data-across-restarts) + - [Pre-configure InfluxDB connections](#pre-configure-influxdb-connections) + - [Enable TLS/SSL (HTTPS)](#enable-tlsssl-https) + - [Choose operational mode](#choose-operational-mode) +- [Advanced configuration](#advanced-configuration) + - [Environment variables](#environment-variables) + - [Volume reference](#volume-reference) + - [Port reference](#port-reference) +- [Complete examples](#complete-examples) -## Run the InfluxDB 3 Explorer Docker container +## Quick start -1. **Install Docker** +Get {{% product-name %}} running in minutes: - If you haven't already, install [Docker](https://docs.docker.com/engine/) or - [Docker Desktop](https://docs.docker.com/desktop/). +1. **Run the Explorer container:** -2. **Pull the {{% product-name %}} Docker image** + ```bash + docker run --detach \ + --name influxdb3-explorer \ + --publish 8888:80 \ + influxdata/influxdb3-ui:{{% latest-patch %}} + ``` - ```bash - influxdata/influxdb3-ui:{{% latest-patch %}} - ``` +2. **Access the Explorer UI at ** -3. **Create local directories** _(optional)_ - - {{% product-name %}} can mount the following directories on your local - machine: - - | Directory | Description | Permissions | - | :--------- | :------------------------------------------------------------------------------------------------ | :---------: | - | `./db` | Stores {{% product-name %}} application data | 700 | - | `./config` | Stores [pre-configured InfluxDB connection settings](#pre-configure-influxdb-connection-settings) | 755 | - | `./ssl` | Stores TLS/SSL certificates _(Required when [using TLS/SSL](#enable-tlsssl-https))_ | 755 | - - > [!Important] - > If you don't create and mount a local `./db` directory, {{% product-name %}} - > stores application data in the container's file system. - > This data will be lost when the container is deleted. - - To create these directories with the appropriate permissions, run the - following commands from your current working directory: - - ```bash - mkdir -m 700 ./db - mkdir -m 755 ./config - mkdir -m 755 ./ssl - ``` - -4. **Run the {{% product-name %}} container** - - Use the `docker run` command to start the {{% product-name %}} container. - Include the following: - - - Port mappings: - - `8888` to `80` (or `443` if using TLS/SSL) - - `8889` to `8888` - - Mounted volumes: - - `$(pwd)/db:/db:rw` - - `$(pwd)/config:/app-root/config:ro` - - `$(pwd)/ssl:/etc/nginx/ssl:ro` - - Any of the available [environment variables](#environment-variables) - - > [!Note] - > To persist sessions across container restarts, see the detailed instructions - > on setting the [`SESSION_SECRET_KEY` environment variable](#session_secret_key). - - ```bash - docker run --detach \ - --name influxdb3-explorer \ - --publish 8888:80 \ - --publish 8889:8888 \ - --volume $(pwd)/config:/app-root/config:ro \ - --volume $(pwd)/db:/db:rw \ - --volume $(pwd)/ssl:/etc/nginx/ssl:ro \ - influxdata/influxdb3-ui:{{% latest-patch %}} \ - --mode=admin - ``` - -5. **Access the {{% product-name %}} user interface (UI) at **. +3. **[Configure your InfluxDB connection in the UI](/influxdb3/explorer/get-started)** --- -## Enable TLS/SSL (HTTPS) +## Installation methods -To enable TLS/SSL, mount valid certificate and key files into the container: +### Prerequisites -1. **Place your TLS/SSL certificate files your local `./ssl` directory** +Install [Docker](https://docs.docker.com/engine/) or [Docker Desktop](https://docs.docker.com/desktop/) if you haven't already. - Required files: +### Basic setup - - Certificate: `server.crt` or `fullchain.pem` - - Private key: `server.key` +> [!Tip] +> To get the latest updates, run the following command before starting the container: +> +> ```bash +> docker pull influxdata/influxdb3-ui:{{% latest-patch %}} +> ``` -2. **When running your container, mount the SSL directory and map port 443 to port 8888** - - Include the following options when running your Docker container: +{{< code-tabs-wrapper >}} +{{% code-tabs %}} +[Docker run](#) +[Docker Compose](#) +{{% /code-tabs %}} - ```sh - --volume $(pwd)/ssl:/etc/nginx/ssl:ro \ - --publish 8888:443 - ``` +{{% code-tab-content %}} +```bash +docker run --detach \ + --name influxdb3-explorer \ + --publish 8888:80 \ + influxdata/influxdb3-ui:{{% latest-patch %}} +``` +{{% /code-tab-content %}} -The nginx web server automatically uses certificate files when they are present -in the mounted path. +{{% code-tab-content %}} +```yaml +# docker-compose.yml +version: '3.8' -> [!Note] -> You can use a custom location for certificate and key files. -> Use the [`SSL_CERT_PATH`](#ssl_cert_path) and [`SSL_KEY_PATH`](#ssl_key_path) -> environment variables to identify the custom location. -> Also update the SSL directory volume mount path inside the container. - - ---- - -## Pre-configure InfluxDB connection settings - -You can predefine InfluxDB connection settings using a `config.json` file. - -{{% code-placeholders "INFLUXDB3_HOST|INFLUXDB_DATABASE_NAME|INFLUXDB3_AUTH_TOKEN|INFLUXDB3_SERVER_NAME" %}} - -1. **Create a `config.json` file in your local `./config` directory** - - ```json - { - "DEFAULT_INFLUX_SERVER": "INFLUXDB3_HOST", - "DEFAULT_INFLUX_DATABASE": "INFLUXDB_DATABASE_NAME", - "DEFAULT_API_TOKEN": "INFLUXDB3_AUTH_TOKEN", - "DEFAULT_SERVER_NAME": "INFLUXDB3_SERVER_NAME" - } - ``` - - > [!Important] - > If connecting to an InfluxDB 3 Core or Enterprise instance running on - > localhost (outside of the container), use the internal Docker network to - > in your InfluxDB 3 host value--for example: - > - > ```txt - > http://host.docker.internal:8181 - > ``` - -2. **Mount the configuration directory** - - Include the following option when running your Docker container: - - ```sh - --volume $(pwd)/config:/app-root/config:ro - ``` - -{{% /code-placeholders %}} - -These settings will be used as defaults when the container starts. - ---- - -## Run in query or admin mode - -{{% product-name %}} has the following operational modes: - -- **Query mode (default):** Read-only UI and query interface -- **Admin mode:** Full UI and API access for administrators - -You can control the operational mode using the `--mode=` option in your -`docker run` command (after the image name). - -### Run in query mode {note="(default)"} - -```sh -docker run \ - ... - --mode=query +services: + explorer: + image: influxdata/influxdb3-ui:{{% latest-patch %}} + container_name: influxdb3-explorer + ports: + - "8888:80" + volumes: + - ./config:/app-root/config:ro + restart: unless-stopped ``` -### Run in admin mode +Start the container: -```sh -docker run \ - ... +```bash +docker-compose up -d +``` +{{% /code-tab-content %}} +{{< /code-tabs-wrapper >}} + +### Production setup + +For production deployments with persistence, admin mode, and automatic image updates: + +{{< code-tabs-wrapper >}} +{{% code-tabs %}} +[Docker run](#) +[Docker Compose](#) +{{% /code-tabs %}} + +{{% code-tab-content %}} +```bash +docker run --detach \ + --name influxdb3-explorer \ + --pull always \ + --publish 8888:80 \ + --volume $(pwd)/db:/db:rw \ + --volume $(pwd)/config:/app-root/config:ro \ + --env SESSION_SECRET_KEY=$(openssl rand -hex 32) \ + --restart unless-stopped \ + influxdata/influxdb3-ui:{{% latest-patch %}} \ --mode=admin ``` +{{% /code-tab-content %}} -If `--mode` is not set, the container defaults to query mode. +{{% code-tab-content %}} +```yaml +# docker-compose.yml +version: '3.8' + +services: + explorer: + image: influxdata/influxdb3-ui:{{% latest-patch %}} + container_name: influxdb3-explorer + pull_policy: always + command: ["--mode=admin"] + ports: + - "8888:80" + volumes: + - ./db:/db:rw + - ./config:/app-root/config:ro + - ./ssl:/etc/nginx/ssl:ro + environment: + SESSION_SECRET_KEY: ${SESSION_SECRET_KEY:-changeme123456789012345678901234} + restart: unless-stopped +``` + +Create a `.env` file that contains the following: + +```bash +SESSION_SECRET_KEY=your_32_char_hex_string_here +``` + +Start the container: + +```bash +docker-compose up -d +``` +{{% /code-tab-content %}} +{{< /code-tabs-wrapper >}} --- -## Environment Variables +## Configuration options -Use the following environment variables to customize {{% product-name %}} settings -in your container. +### Persist data across restarts -- [DATABASE_URL](#database_url) -- [SESSION_SECRET_KEY](#session_secret_key) -- [SSL_CERT_PATH](#ssl_cert_path) -- [SSL_KEY_PATH](#ssl_key_path) +{{% product-name %}} stores application data in a SQLite database. To persist this data across container restarts: -### DATABASE_URL +1. **Create a local directory:** -Path to SQLite DB inside container. The default is `/db/sqlite.db`. + ```bash + mkdir -m 700 ./db + ``` -{{< expand-wrapper >}} -{{% expand "View `DATABASE_URL` example" %}} - +2. **Mount the directory when running the container:** -```bash -docker run --detach \ - # ... - --volume $(pwd)/db:/custom/db-path:rw \ - --env DATABASE_URL=/custom/db-path/sqlite.db \ - influxdata/influxdb3-ui:{{% latest-patch %}} -``` -{{% /expand %}} -{{< /expand-wrapper >}} + {{< code-tabs-wrapper >}} + {{% code-tabs %}} + [Docker](#) + [Docker Compose](#) + {{% /code-tabs %}} -### SESSION_SECRET_KEY + {{% code-tab-content %}} + ```bash + docker run --detach \ + --name influxdb3-explorer \ + --publish 8888:80 \ + --volume $(pwd)/db:/db:rw \ + influxdata/influxdb3-ui:{{% latest-patch %}} + ``` + {{% /code-tab-content %}} -Specifies the secret key for session management. If none is provided, Explorer -uses a random 32-byte hex string as the session secret key. - -{{< expand-wrapper >}} -{{% expand "View `SESSION_SECRET_KEY` example" %}} - - -```bash -docker run --detach \ - # ... - --env SESSION_SECRET_KEY=xxX0Xx000xX0XxxxX0Xx000xX0XxX00x \ - influxdata/influxdb3-ui:{{% latest-patch %}} -``` -{{% /expand %}} -{{< /expand-wrapper >}} + {{% code-tab-content %}} + ```yaml + version: '3.8' + + services: + explorer: + image: influxdata/influxdb3-ui:{{% latest-patch %}} + container_name: influxdb3-explorer + ports: + - "8888:80" + volumes: + - ./db:/db:rw + restart: unless-stopped + ``` + {{% /code-tab-content %}} + {{< /code-tabs-wrapper >}} > [!Important] -> #### Always set SESSION_SECRET_KEY in production +> Without a mounted `./db` directory, application data is lost when the container is deleted. + +### Pre-configure InfluxDB connections + +Instead of configuring connections through the UI, you can pre-define connection settings using a `config.json` file. This is useful for: +- Automated deployments +- Shared team configurations +- Quick setup for known environments + +1. **Create a `config.json` file:** + + ```bash + mkdir -p config + cat > config/config.json << 'EOF' + { + "DEFAULT_INFLUX_SERVER": "http://host.docker.internal:8181", + "DEFAULT_INFLUX_DATABASE": "mydb", + "DEFAULT_API_TOKEN": "your-token-here", + "DEFAULT_SERVER_NAME": "Local InfluxDB 3" + } + EOF + ``` + + Customize the following properties for your InfluxDB 3 instance: + + - **`DEFAULT_INFLUX_SERVER`**: your [InfluxDB 3 Core](/influxdb3/core/reference/config-options/#http-bind) or [Enterprise](/influxdb3/enterprise/reference/config-options/#http-bind) server URL + - **`DEFAULT_INFLUX_DATABASE`**: the name of your [InfluxDB 3 Core](/influxdb3/core/admin/databases/) or [Enterprise](/influxdb3/enterprise/admin/databases/) database + - **`DEFAULT_API_TOKEN`**: your [InfluxDB 3 Core](/influxdb3/core/admin/tokens/) or [Enterprise](/influxdb3/enterprise/admin/tokens/) authorization token with the necessary permissions to access your server + - **`DEFAULT_SERVER_NAME`**: a display name (only used by Explorer) for your [InfluxDB 3 Core](/influxdb3/core/get-started/setup/#start-influxdb) or [Enterprise](/influxdb3/enterprise/get-started/setup/#start-influxdb) server + + > [!Note] + > If connecting to a local, _non-Docker_ instance, use `host.docker.internal` as your server host--for example: + > + > ```txt + > "DEFAULT_INFLUX_SERVER": "http://host.docker.internal:8181" + > ``` + > + > `host.docker.internal` allows the Docker container to connect to services running on your host machine. + > For more information, see the [Docker documentation](https://docs.docker.com/desktop/features/networking). + +2. **Mount the configuration directory:** + + {{< code-tabs-wrapper >}} + {{% code-tabs %}} + [Docker](#) + [Docker Compose](#) + {{% /code-tabs %}} + + {{% code-tab-content %}} + ```bash + docker run --detach \ + --name influxdb3-explorer \ + --publish 8888:80 \ + --volume $(pwd)/config:/app-root/config:ro \ + influxdata/influxdb3-ui:{{% latest-patch %}} + ``` + {{% /code-tab-content %}} + + {{% code-tab-content %}} + ```yaml + version: '3.8' + + services: + explorer: + image: influxdata/influxdb3-ui:{{% latest-patch %}} + container_name: influxdb3-explorer + ports: + - "8888:80" + volumes: + - ./config:/app-root/config:ro + restart: unless-stopped + ``` + {{% /code-tab-content %}} + {{< /code-tabs-wrapper >}} + +### Enable TLS/SSL (HTTPS) + +To enable TLS/SSL for secure connections: + +1. **Create SSL directory and add certificate files:** + + ```bash + mkdir -m 755 ./ssl + # Copy your certificate files to the ssl directory + cp /path/to/server.crt ./ssl/ + cp /path/to/server.key ./ssl/ + ``` + + Required files: + - Certificate: `server.crt` or `fullchain.pem` + - Private key: `server.key` + +2. **Run the container with SSL enabled:** + + {{< code-tabs-wrapper >}} + {{% code-tabs %}} + [Docker](#) + [Docker Compose](#) + {{% /code-tabs %}} + + {{% code-tab-content %}} + ```bash + docker run --detach \ + --name influxdb3-explorer \ + --publish 8888:443 \ + --volume $(pwd)/ssl:/etc/nginx/ssl:ro \ + influxdata/influxdb3-ui:{{% latest-patch %}} + ``` + {{% /code-tab-content %}} + + {{% code-tab-content %}} + ```yaml + version: '3.8' + + services: + explorer: + image: influxdata/influxdb3-ui:{{% latest-patch %}} + container_name: influxdb3-explorer + ports: + - "8888:443" + volumes: + - ./ssl:/etc/nginx/ssl:ro + restart: unless-stopped + ``` + {{% /code-tab-content %}} + {{< /code-tabs-wrapper >}} + +3. **Access the Explorer UI at ** + +> [!Note] +> The nginx web server automatically detects and uses certificate files in the mounted path. + +### Choose operational mode + +{{% product-name %}} supports two operational modes: + +- **Query mode** (default): Read-only UI for querying data +- **Admin mode**: Full UI with administrative capabilities + +Set the mode using the `--mode` parameter: + +{{< code-tabs-wrapper >}} +{{% code-tabs %}} +[Docker](#) +[Docker Compose](#) +{{% /code-tabs %}} + +{{% code-tab-content %}} +```bash +# Query mode (default) +docker run --detach \ + --name influxdb3-explorer \ + --publish 8888:80 \ + influxdata/influxdb3-ui:{{% latest-patch %}} \ + --mode=query + +# Admin mode +docker run --detach \ + --name influxdb3-explorer \ + --publish 8888:80 \ + influxdata/influxdb3-ui:{{% latest-patch %}} \ + --mode=admin +``` +{{% /code-tab-content %}} + +{{% code-tab-content %}} +```yaml +version: '3.8' + +services: + explorer: + image: influxdata/influxdb3-ui:{{% latest-patch %}} + container_name: influxdb3-explorer + # For query mode (default), omit the command + # For admin mode, add: + command: ["--mode=admin"] + ports: + - "8888:80" + restart: unless-stopped +``` +{{% /code-tab-content %}} +{{< /code-tabs-wrapper >}} + +--- + +## Advanced configuration + +### Environment variables + +| Variable | Default | Description | +|----------|---------|-------------| +| `SESSION_SECRET_KEY` | _(random)_ | Secret key for session management. **Set this in production to persist sessions across restarts.** | +| `DATABASE_URL` | `/db/sqlite.db` | Path to SQLite database inside container | +| `SSL_CERT_PATH` | `/etc/nginx/ssl/cert.pem` | Path to SSL certificate file | +| `SSL_KEY_PATH` | `/etc/nginx/ssl/key.pem` | Path to SSL private key file | + +> [!Important] +> Always set `SESSION_SECRET_KEY` in production to persist user sessions across container restarts. +> Enter the following command to generate a secure key: > -> When you restart the container, {{% product-name %}} generates a new key if -> not explicitly set. For production use cases, always set the `SESSION_SECRET_KEY` -> environment variable to persist sessions across restarts. +> ```bash +> openssl rand -hex 32 +> ``` -### SSL_CERT_PATH +### Volume reference -Defines the path to the SSL certificate file inside the container. -Default is `/etc/nginx/ssl/cert.pem`. +| Container Path | Purpose | Permissions | Required | +|----------------|---------|-------------|----------| +| `/db` | SQLite database storage | 700 | No (but recommended) | +| `/app-root/config` | Connection configuration | 755 | No | +| `/etc/nginx/ssl` | TLS/SSL certificates | 755 | Only for HTTPS | -{{< expand-wrapper >}} -{{% expand "View `SSL_CERT_PATH` example" %}} - +### Port reference + +| Container Port | Protocol | Purpose | Common Host Mapping | +|----------------|----------|---------|---------------------| +| 80 | HTTP | Web UI (unencrypted) | 8888 | +| 443 | HTTPS | Web UI (encrypted) | 8888 | + +--- + +## Complete examples + +### Production setup with all features + +{{< code-tabs-wrapper >}} +{{% code-tabs %}} +[Docker](#) +[Docker Compose](#) +{{% /code-tabs %}} + +{{% code-tab-content %}} +```bash +# Create required directories +mkdir -m 700 ./db +mkdir -m 755 ./config ./ssl + +# Generate session secret +export SESSION_SECRET=$(openssl rand -hex 32) + +# Create configuration +cat > config/config.json << 'EOF' +{ + "DEFAULT_INFLUX_SERVER": "http://host.docker.internal:8181", + "DEFAULT_INFLUX_DATABASE": "production", + "DEFAULT_API_TOKEN": "your-production-token", + "DEFAULT_SERVER_NAME": "Production InfluxDB 3" +} +EOF + +# Run Explorer with all features +docker run --detach \ + --name influxdb3-explorer \ + --pull always \ + --publish 8888:443 \ + --volume $(pwd)/db:/db:rw \ + --volume $(pwd)/config:/app-root/config:ro \ + --volume $(pwd)/ssl:/etc/nginx/ssl:ro \ + --env SESSION_SECRET_KEY=$SESSION_SECRET \ + --restart unless-stopped \ + influxdata/influxdb3-ui:{{% latest-patch %}} \ + --mode=admin +``` +{{% /code-tab-content %}} + +{{% code-tab-content %}} +```yaml +# docker-compose.yml +version: '3.8' + +services: + explorer: + image: influxdata/influxdb3-ui:{{% latest-patch %}} + container_name: influxdb3-explorer + pull_policy: always + command: ["--mode=admin"] + ports: + - "8888:443" + volumes: + - ./db:/db:rw + - ./config:/app-root/config:ro + - ./ssl:/etc/nginx/ssl:ro + environment: + SESSION_SECRET_KEY: ${SESSION_SECRET_KEY} + restart: unless-stopped +``` + +Create a `.env` file that contains the following: ```bash -docker run --detach \ - # ... - --volume $(pwd)/ssl:/custom/ssl:ro \ - --env SSL_CERT_PATH=/custom/ssl/cert.pem \ - influxdata/influxdb3-ui:{{% latest-patch %}} +SESSION_SECRET_KEY=your_32_char_hex_string_here ``` -{{% /expand %}} -{{< /expand-wrapper >}} -### SSL_KEY_PATH - -Defines the path to the SSL private key file inside the container. -Default is `/etc/nginx/ssl/key.pem`. - -{{< expand-wrapper >}} -{{% expand "View `SSL_KEY_PATH` example" %}} - +Start the container: ```bash -docker run --detach \ - # ... - --volume $(pwd)/ssl:/custom/ssl:ro \ - --env SSL_KEY_PATH=/custom/ssl/key.pem \ +docker-compose up -d +``` +{{% /code-tab-content %}} +{{< /code-tabs-wrapper >}} + +### Development setup (minimal) + +{{< code-tabs-wrapper >}} +{{% code-tabs %}} +[Docker](#) +[Docker Compose](#) +{{% /code-tabs %}} + +{{% code-tab-content %}} +```bash +docker run --rm \ + --name influxdb3-explorer-dev \ + --publish 8888:80 \ influxdata/influxdb3-ui:{{% latest-patch %}} ``` -{{% /expand %}} -{{< /expand-wrapper >}} +{{% /code-tab-content %}} -## Volume Reference +{{% code-tab-content %}} +```yaml +# docker-compose.yml +version: '3.8' -| Container Path | Purpose | Host Example | -|----------------------|------------------------------|----------------------------| -| `/db` | SQLite DB storage | `./db` | -| `/app-root/config` | JSON config for defaults | `./config` | -| `/etc/nginx/ssl` | SSL certs for HTTPS | `./ssl` | - -## Exposed Ports - -| Port | Protocol | Purpose | -|------|----------|-------------------------| -| 80 | HTTP | Web access (unencrypted) | -| 443 | HTTPS | Web access (encrypted) | - -### Custom port mapping - -```sh -# Map ports to custom host values ---publish 8888:80 --publish 8443:443 +services: + explorer: + image: influxdata/influxdb3-ui:{{% latest-patch %}} + container_name: influxdb3-explorer-dev + ports: + - "8888:80" ``` +{{% /code-tab-content %}} +{{< /code-tabs-wrapper >}} diff --git a/content/shared/influxdb3-cli/config-options.md b/content/shared/influxdb3-cli/config-options.md index be8ce2e7e..5f91d50a0 100644 --- a/content/shared/influxdb3-cli/config-options.md +++ b/content/shared/influxdb3-cli/config-options.md @@ -175,10 +175,6 @@ influxdb3 serve - [TCP Listeners](#tcp-listeners) - [tcp-listener-file-path](#tcp-listener-file-path) - [admin-token-recovery-tcp-listener-file-path](#admin-token-recovery-tcp-listener-file-path) -{{% show-in "enterprise" %}} -- [Experimental Features](#experimental-features) - - [use-pacha-tree](#use-pacha-tree) -{{% /show-in %}} --- @@ -939,6 +935,11 @@ Sets the filter directive for logs. Specifies the destination for logs. +This option supports the following values: + +- `stdout` _(default)_ +- `stderr` + **Default:** `stdout` | influxdb3 serve option | Environment variable | @@ -1972,25 +1973,3 @@ Specifies the TCP listener file path for admin token recovery operations. | influxdb3 serve option | Environment variable | | :---------------------------------------------- | :-------------------------------------------------------- | | `--admin-token-recovery-tcp-listener-file-path` | `INFLUXDB3_ADMIN_TOKEN_RECOVERY_TCP_LISTENER_FILE_PATH` | - -{{% show-in "enterprise" %}} ---- - -### Experimental Features - -- [use-pacha-tree](#use-pacha-tree) - -#### use-pacha-tree - -Enables the experimental PachaTree storage engine for improved performance. - -> [!Warning] -> This is an experimental feature and should not be used in production environments. - -**Default:** `false` - -| influxdb3 serve option | Environment variable | -| :---------------------- | :------------------------------------- | -| `--use-pacha-tree` | `INFLUXDB3_ENTERPRISE_USE_PACHA_TREE` | - -{{% /show-in %}} \ No newline at end of file diff --git a/content/shared/sql-reference/functions/aggregate.md b/content/shared/sql-reference/functions/aggregate.md index 1cf76088c..45630de2f 100644 --- a/content/shared/sql-reference/functions/aggregate.md +++ b/content/shared/sql-reference/functions/aggregate.md @@ -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 diff --git a/content/shared/sql-reference/functions/array.md b/content/shared/sql-reference/functions/array.md new file mode 100644 index 000000000..5efa2249e --- /dev/null +++ b/content/shared/sql-reference/functions/array.md @@ -0,0 +1,1860 @@ + +Use array functions to create and operate on Arrow arrays or lists in SQL queries. + +- [array_any_value](#array_any_value) +- [array_append](#array_append) +- [array_cat](#array_cat) +- [array_concat](#array_concat) +- [array_contains](#array_contains) +- [array_dims](#array_dims) +- [array_distance](#array_distance) +- [array_distinct](#array_distinct) +- [array_element](#array_element) +- [array_empty](#array_empty) +- [array_except](#array_except) +- [array_extract](#array_extract) +- [array_has](#array_has) +- [array_has_all](#array_has_all) +- [array_has_any](#array_has_any) +- [array_indexof](#array_indexof) +- [array_intersect](#array_intersect) +- [array_join](#array_join) +- [array_length](#array_length) +- [array_max](#array_max) +- [array_min](#array_min) +- [array_ndims](#array_ndims) +- [array_pop_back](#array_pop_back) +- [array_pop_front](#array_pop_front) +- [array_position](#array_position) +- [array_positions](#array_positions) +- [array_prepend](#array_prepend) +- [array_push_back](#array_push_back) +- [array_push_front](#array_push_front) +- [array_remove](#array_remove) +- [array_remove_all](#array_remove_all) +- [array_remove_n](#array_remove_n) +- [array_repeat](#array_repeat) +- [array_replace](#array_replace) +- [array_replace_all](#array_replace_all) +- [array_replace_n](#array_replace_n) +- [array_resize](#array_resize) +- [array_reverse](#array_reverse) +- [array_slice](#array_slice) +- [array_sort](#array_sort) +- [array_to_string](#array_to_string) +- [array_union](#array_union) +- [arrays_overlap](#arrays_overlap) +- [cardinality](#cardinality) +- [empty](#empty) +- [flatten](#flatten) +- [generate_series](#generate_series) +- [list_any_value](#list_any_value) +- [list_append](#list_append) +- [list_cat](#list_cat) +- [list_concat](#list_concat) +- [list_contains](#list_contains) +- [list_dims](#list_dims) +- [list_distance](#list_distance) +- [list_distinct](#list_distinct) +- [list_element](#list_element) +- [list_empty](#list_empty) +- [list_except](#list_except) +- [list_extract](#list_extract) +- [list_has](#list_has) +- [list_has_all](#list_has_all) +- [list_has_any](#list_has_any) +- [list_indexof](#list_indexof) +- [list_intersect](#list_intersect) +- [list_join](#list_join) +- [list_length](#list_length) +- [list_max](#list_max) +- [list_ndims](#list_ndims) +- [list_pop_back](#list_pop_back) +- [list_pop_front](#list_pop_front) +- [list_position](#list_position) +- [list_positions](#list_positions) +- [list_prepend](#list_prepend) +- [list_push_back](#list_push_back) +- [list_push_front](#list_push_front) +- [list_remove](#list_remove) +- [list_remove_all](#list_remove_all) +- [list_remove_n](#list_remove_n) +- [list_repeat](#list_repeat) +- [list_replace](#list_replace) +- [list_replace_all](#list_replace_all) +- [list_replace_n](#list_replace_n) +- [list_resize](#list_resize) +- [list_reverse](#list_reverse) +- [list_slice](#list_slice) +- [list_sort](#list_sort) +- [list_to_string](#list_to_string) +- [list_union](#list_union) +- [make_array](#make_array) +- [make_list](#make_list) +- [range](#range) +- [string_to_array](#string_to_array) +- [string_to_list](#string_to_list) + +## array_any_value + +Returns the first non-null element in the array. + +```sql +array_any_value(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_any_value` + +{{< expand-wrapper >}} +{{% expand "View `array_any_value` example" %}} + +```sql +SELECT array_any_value([NULL, 1, 2, 3]) AS array_any_value +``` + +| array_any_value | +| :-------------- | +| 1 | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_append + +Appends an element to the end of an array. + +```sql +array_append(array, element) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **element**: Element to append to the array. + +#### Aliases + +- `list_append` +- `array_push_back` +- `list_push_back` + +{{< expand-wrapper >}} +{{% expand "View `array_append` example" %}} + +```sql +SELECT array_append([1, 2, 3], 4) AS array_append +``` + +| array_append | +| :----------- | +| [1, 2, 3, 4] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_cat + +_Alias of [array_concat](#array_concat)._ + +## array_concat + +Concatenates multiple arrays into a single array. + +```sql +array_concat(array[, ..., array_n]) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **array_n**: Subsequent array column or literal array to concatenate. + +#### Aliases + +- `array_cat` +- `list_concat` +- `list_cat` + +{{< expand-wrapper >}} +{{% expand "View `array_concat` example" %}} + +```sql +SELECT array_concat([1, 2], [3, 4], [5, 6]) AS array_concat +``` +| array_concat | +| :----------------- | +| [1, 2, 3, 4, 5, 6] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_contains + +_Alias of [array_has](#array_has)._ + +## array_dims + +Returns an array of the array's dimensions. + +```sql +array_dims(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_dims` + +{{< expand-wrapper >}} +{{% expand "View `array_dims` example" %}} + +```sql +SELECT array_dims([[1, 2, 3], [4, 5, 6]]) AS array_dims +``` + +| array_dims(List([1,2,3,4,5,6])) | +| :------------------------------ | +| [2, 3] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_distance + +Returns the Euclidean distance between two input arrays of equal length. + +```sql +array_distance(array1, array2) +``` + +### Arguments + +- **array1**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **array2**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_distance` + +{{< expand-wrapper >}} +{{% expand "View `array_distance` example" %}} + +```sql +SELECT array_distance([1, 2], [1, 4]) AS array_distance +``` + +| array_distance | +| -------------: | +| 2.0 | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_distinct + +Returns distinct values from the array after removing duplicates. + +```sql +array_distinct(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_distinct` + +{{< expand-wrapper >}} +{{% expand "View `array_distinct` example" %}} + +```sql +SELECT array_distinct([1, 3, 2, 3, 1, 2, 4]) AS array_distinct +``` + +| array_distinct(List([1,2,3,4])) | +| :------------------------------ | +| [1, 2, 3, 4] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_element + +Extracts the element with the index n from the array. + +```sql +array_element(array, index) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **index**: Index to use to extract the element from the array. + +#### Aliases + +- `array_extract` +- `list_element` +- `list_extract` + +{{< expand-wrapper >}} +{{% expand "View `array_element` example" %}} + +```sql +SELECT array_element([1, 2, 3, 4], 3) AS array_element +``` + +| array_element | +| ------------: | +| 3 | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_empty + +_Alias of [empty](#empty)._ + +## array_except + +Returns an array containing elements from the first array that are not present in the second array. + +```sql +array_except(array1, array2) +``` + +### Arguments + +- **array1**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **array2**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_except` + +{{< expand-wrapper >}} +{{% expand "View `array_except` example" %}} + +```sql +SELECT array_except([1, 2, 3, 4], [5, 6, 3, 4]) AS array_except +``` + +| array_except | +| :----------- | +| [1, 2] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_extract + +_Alias of [array_element](#array_element)._ + +## array_has + +Returns `true` if the array contains the element. + +```sql +array_has(array, element) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **element**: Scalar or Array expression. Can be a constant, column, or + function, and any combination of array operators. + +#### Aliases + +- `list_has` +- `array_contains` +- `list_contains` + +{{< expand-wrapper >}} +{{% expand "View `array_has` example" %}} + +```sql +SELECT array_has([1, 2, 3], 2) AS array_has +``` + +| array_has | +| :-------- | +| true | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_has_all + +Returns `true` if all elements of sub-array exist in array. + +```sql +array_has_all(array, sub-array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **sub-array**: Array expression. Can be a constant, column, or function, and + any combination of array operators. + +#### Aliases + +- `list_has_all` + +{{< expand-wrapper >}} +{{% expand "View `array_has_all` example" %}} + +```sql +SELECT array_has_all([1, 2, 3, 4], [2, 3]) AS array_has_all +``` + +| array_has_all | +| :------------ | +| true | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_has_any + +Returns `true` if at least one element appears in both arrays. + +```sql +array_has_any(array, sub-array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **sub-array**: Array expression. Can be a constant, column, or function, and + any combination of array operators. + +#### Aliases + +- `list_has_any` +- `arrays_overlap` + +{{< expand-wrapper >}} +{{% expand "View `array_has_any` example" %}} + +```sql +SELECT array_has_any([1, 2, 3], [3, 4]) AS array_has_any +``` + +| array_has_any | +| :------------ | +| true | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_indexof + +_Alias of [array_position](#array_position)._ + +## array_intersect + +Returns an array containing only the elements that appear in both **array1** and **array2**. + +```sql +array_intersect(array1, array2) +``` + +### Arguments + +- **array1**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **array2**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_intersect` + +{{< expand-wrapper >}} +{{% expand "View `array_intersect` example with intersecting arrays" %}} + +```sql +SELECT array_intersect([1, 2, 3, 4], [5, 6, 3, 4]) AS array_intersect +``` + +| array_intersect | +| :-------------- | +| [3, 4] | + +{{% /expand %}} +{{% expand "View `array_intersect` example with non-intersecting arrays" %}} + +```sql +SELECT array_intersect([1, 2, 3, 4], [5, 6, 7, 8]) AS array_intersect +``` + +| array_intersect | +| :-------------- | +| [] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_join + +_Alias of [array_to_string](#array_to_string)._ + +## array_length + +Returns the length of the array dimension. + +```sql +array_length(array, dimension) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **dimension**: Array dimension. Default is `1`. + +#### Aliases + +- `list_length` + +{{< expand-wrapper >}} +{{% expand "View `array_length` example with single-dimension array" %}} + +```sql +SELECT array_length([1, 2, 3, 4, 5]) AS array_length +``` + +| array_length | +| -----------: | +| 5 | + +{{% /expand %}} +{{% expand "View `array_length` example with multi-dimension array" %}} + +```sql +WITH vars AS ( + SELECT [ + [1, 2, 3, 4, 5], + [5, 6, 7, 8, 9] + ] AS example_array +) + +SELECT + array_length(example_array, 1) AS 'dim1_length', + array_length(example_array, 2) AS 'dim2_length' +FROM vars +``` + +| dim1_length | dim2_length | +| ----------: | ----------: | +| 2 | 5 | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_max + +Returns the maximum value in the array. + +```sql +array_max(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_max` + +{{< expand-wrapper >}} +{{% expand "View `array_max` example" %}} + +```sql +SELECT array_max([3,1,4,2]) AS array_max +``` + +| array_max | +| --------: | +| 4 | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_min + +Returns the minimum value in the array. + +```sql +array_min(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +{{< expand-wrapper >}} +{{% expand "View `array_min` example" %}} + +```sql +SELECT array_min([3,1,4,2]) AS array_min +``` + +| array_min | +| --------: | +| 1 | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_ndims + +Returns the number of dimensions of the array. + +```sql +array_ndims(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_ndims` + +{{< expand-wrapper >}} +{{% expand "View `array_ndims` example" %}} + +```sql +SELECT array_ndims([[1, 2, 3], [4, 5, 6]]) AS array_ndims +``` + +| array_ndims | +| ----------: | +| 2 | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_pop_back + +Returns the array without the last element. + +```sql +array_pop_back(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_pop_back` + +{{< expand-wrapper >}} +{{% expand "View `array_pop_back` example" %}} + +```sql +SELECT array_pop_back([1, 2, 3]) AS array_pop_back +``` + +| array_pop_back | +| :------------- | +| [1, 2] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_pop_front + +Returns the array without the first element. + +```sql +array_pop_front(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_pop_front` + +{{< expand-wrapper >}} +{{% expand "View `array_pop_front` example" %}} + +```sql +SELECT array_pop_front([1, 2, 3]) AS array_pop_front +``` + +| array_pop_front | +| :-------------- | +| [2, 3] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_position + +Returns the position of the first occurrence of the specified element in the +array, or _NULL_ if not found. + +```sql +array_position(array, element, index) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **element**: Element to search for position in the array. +- **index**: Index at which to start searching (1-indexed). Default is `1`. + +#### Aliases + +- `list_position` +- `array_indexof` +- `list_indexof` + +{{< expand-wrapper >}} +{{% expand "View `array_position` example" %}} + +```sql +SELECT array_position([1, 2, 2, 3, 1, 4], 2) AS array_position +``` + +| array_position | +| -------------: | +| 2 | + +{{% /expand %}} +{{% expand "View `array_position` example with index offset" %}} + +```sql +SELECT array_position([1, 2, 2, 3, 1, 4], 2, 3) AS array_position +``` + +| array_position | +| -------------: | +| 3 | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_positions + +Searches for an element in the array and returns the position or index of each +occurrence. + +```sql +array_positions(array, element) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **element**: Element to search for position in the array. + +#### Aliases + +- `list_positions` + +{{< expand-wrapper >}} +{{% expand "View `array_positions` example" %}} + +```sql +SELECT array_positions(['John', 'Jane', 'James', 'John'], 'John') AS array_positions +``` + +| array_positions | +| :-------------- | +| [1, 4] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_prepend + +Prepends an element to the beginning of an array. + +```sql +array_prepend(element, array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **element**: Element to prepend to the array. + +#### Aliases + +- `list_prepend` +- `array_push_front` +- `list_push_front` + +{{< expand-wrapper >}} +{{% expand "View `array_prepend` example" %}} + +```sql +SELECT array_prepend(1, [2, 3, 4]) AS array_prepend +``` + +| array_prepend | +| :------------ | +| [1, 2, 3, 4] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_push_back + +_Alias of [array_append](#array_append)._ + +## array_push_front + +_Alias of [array_prepend](#array_prepend)._ + +## array_remove + +Removes the first element from the array equal to the given value. + +```sql +array_remove(array, element) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **element**: Element to remove from the array. + +#### Aliases + +- `list_remove` + +{{< expand-wrapper >}} +{{% expand "View `array_remove` example" %}} + +```sql +SELECT array_remove([1, 2, 2, 3, 2, 1, 4], 2) AS array_remove +``` + +| array_remove | +| :----------------- | +| [1, 2, 3, 2, 1, 4] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_remove_all + +Removes all elements from the array equal to the specified value. + +```sql +array_remove_all(array, element) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **element**: Element to be removed from the array. + +#### Aliases + +- `list_remove_all` + +{{< expand-wrapper >}} +{{% expand "View `array_remove_all` example" %}} + +```sql +SELECT array_remove_all([1, 2, 2, 3, 2, 1, 4], 2) AS array_remove_all +``` + +| array_remove_all | +| :--------------- | +| [1, 3, 1, 4] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_remove_n + +Removes the first `max` elements from the array equal to the specified value. + +```sql +array_remove_n(array, element, max) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **element**: Element to remove from the array. +- **max**: Maximum number of occurrences to remove. + +#### Aliases + +- `list_remove_n` + +{{< expand-wrapper >}} +{{% expand "View `array_remove_n` example" %}} + +```sql +SELECT array_remove_n([1, 2, 2, 3, 2, 1, 4], 2, 2) AS array_remove_n +``` + +| array_remove_n | +| :-------------- | +| [1, 3, 2, 1, 4] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_repeat + +Returns an array containing element `count` times. + +```sql +array_repeat(element, count) +``` + +### Arguments + +- **element**: Element expression. Can be a constant, column, or function, and + any combination of array operators. +- **count**: Number of times to repeat the element. + +#### Aliases + +- `list_repeat` + +{{< expand-wrapper >}} +{{% expand "View `array_repeat` example with numeric values" %}} + +```sql +SELECT array_repeat(1, 3) AS array_repeat +``` + +| array_repeat | +| :----------- | +| [1, 1, 1] | + +{{% /expand %}} +{{% expand "View `array_repeat` example with string values" %}} + +```sql +SELECT array_repeat('John', 3) AS array_repeat +``` + +| array_repeat | +| :----------- | +| [John, John, John] | + + +{{% /expand %}} +{{% expand "View `array_repeat` example with array values" %}} + +```sql +SELECT array_repeat([1, 2], 2) AS array_repeat +``` + +| array_repeat | +| :--------------- | +| [[1, 2], [1, 2]] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_replace + +Replaces the first occurrence of the specified element with another specified element. + +```sql +array_replace(array, from, to) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **from**: Element to replace. +- **to**: Replacement element. + +#### Aliases + +- `list_replace` + +{{< expand-wrapper >}} +{{% expand "View `array_replace` example" %}} + +```sql +SELECT array_replace(['John', 'Jane', 'James', 'John'], 'John', 'Joe') AS array_replace +``` + +| array_replace | +| :----------------------- | +| [Joe, Jane, James, John] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_replace_all + +Replaces all occurrences of the specified element with another specified element. + +```sql +array_replace_all(array, from, to) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **from**: Element to replace. +- **to**: Replacement element. + +#### Aliases + +- `list_replace_all` + +{{< expand-wrapper >}} +{{% expand "View `array_replace_all` example" %}} + +```sql +SELECT array_replace_all(['John', 'Jane', 'James', 'John'], 'John', 'Joe') AS array_replace_all +``` + +| array_replace_all | +| :---------------------- | +| [Joe, Jane, James, Joe] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_replace_n + +Replaces the first `max` occurrences of the specified element with another +specified element. + +```sql +array_replace_n(array, from, to, max) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **from**: Element to replace. +- **to**: Replacement element. +- **max**: Maximum number of occurrences to replace. + +#### Aliases + +- `list_replace_n` + +{{< expand-wrapper >}} +{{% expand "View `array_replace_n` example" %}} + +```sql +SELECT array_replace_n(['John', 'Jane', 'James', 'John', 'John'], 'John', 'Joe', 2) AS array_replace_n +``` + +| array_replace_n | +| :---------------------------- | +| [Joe, Jane, James, Joe, John] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_resize + +Resizes the list to contain size elements. Initializes new elements with value +Resizes the array to the specified size. If expanding, fills new elements with the +specified value (or _NULL_ if not provided). If shrinking, truncates excess elements. + +```sql +array_resize(array, size, value) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **size**: New size of the array. +- **value**: Value to use for new elements. Default is _NULL_. + +#### Aliases + +- `list_resize` + +{{< expand-wrapper >}} +{{% expand "View `array_resize` example" %}} + +```sql +SELECT array_resize([1, 2, 3], 5, 0) AS array_resize +``` + +| array_resize(List([1,2,3],5,0)) | +| :------------------------------ | +| [1, 2, 3, 0, 0] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_reverse + +Returns the array with the order of the elements reversed. + +```sql +array_reverse(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_reverse` + +{{< expand-wrapper >}} +{{% expand "View `array_reverse` example" %}} + +```sql +SELECT array_reverse([1, 2, 3, 4]) AS array_reverse +``` + +| array_reverse | +| :------------ | +| [4, 3, 2, 1] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_slice + +Returns a slice of the array based on 1-indexed start and end positions. + +```sql +array_slice(array, begin, end) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **begin**: Index of the first element. If negative, it counts backward from + the end of the array. +- **end**: Index of the last element. If negative, it counts backward from the + end of the array. +- **stride**: Stride of the array slice. The default is `1`. + +#### Aliases + +- `list_slice` + +{{< expand-wrapper >}} +{{% expand "View `array_slice` example" %}} + +```sql +SELECT array_slice([1, 2, 3, 4, 5, 6, 7, 8], 3, 6) AS array_slice +``` + +| array_slice | +| :----------- | +| [3, 4, 5, 6] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_sort + +Sorts elements in an array. +If elements are numeric, it sorts elements in numerical order. +If elements are strings, it sorts elements in lexicographical order. + +```sql +array_sort(array, sort_order, sort_nulls) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **sort_order**: Sort order (`'ASC'` _(default)_ or `'DESC'`). +- **sort_nulls**: Sort nulls first or last (`'NULLS FIRST'` _(default)_ or `'NULLS LAST'`). + +#### Aliases + +- `list_sort` + +{{< expand-wrapper >}} +{{% expand "View `array_sort` example with numeric elements" %}} + +```sql +SELECT array_sort([3, 1, 2]) AS array_sort +``` + +| array_sort | +| :--------- | +| [1, 2, 3] | + +{{% /expand %}} +{{% expand "View `array_sort` example with string elements" %}} + +```sql +SELECT array_sort(['banana', 'apple', 'cherry'], 'DESC') AS array_sort +``` + +| array_sort | +| :---------------------- | +| [cherry, banana, apple] | + +{{% /expand %}} +{{% expand "View `array_sort` example with _NULL_ elements" %}} + +```sql +SELECT + array_sort( + ['banana', 'apple', NULL, 'cherry', NULL], + 'ASC', + 'NULLS LAST' + ) AS array_sort +``` + +| array_sort | +| :-------------------------- | +| [apple, banana, cherry, , ] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## array_to_string + +Converts an array to a string by joining all elements with the specified delimiter. + +```sql +array_to_string(array, delimiter[, null_string]) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **delimiter**: Array element separator. +- **null_string**: Optional. String to replace _NULL_ values in the array. + If not provided, _NULL_ elements are ignored. + +#### Aliases + +- `list_to_string` +- `array_join` +- `list_join` + +{{< expand-wrapper >}} +{{% expand "View `array_to_string` example" %}} + +```sql +SELECT array_to_string([1,2,3,4,5,6,7,8], ',') AS array_to_string +``` + +| array_to_string | +| :-------------- | +| 1,2,3,4,5,6,7,8 | + +{{% /expand %}} +{{% expand "View `array_to_string` example with _NULL_ replacements" %}} + +```sql +SELECT array_to_string([[1,2,3,4,5,NULL,7,8,NULL]], '-', '?') AS array_to_string +``` + +| array_to_string | +| :---------------- | +| 1-2-3-4-5-?-7-8-? | + +{{% /expand %}} +{{< /expand-wrapper >}} + + +## array_union + +Returns an array of elements that are present in both arrays (all elements from +Returns an array containing all unique elements from both input arrays, with +duplicates removed. + +```sql +array_union(array1, array2) +``` + +### Arguments + +- **array1**: Array expression. Can be a constant, column, or function, and any + combination of array operators. +- **array2**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `list_union` + +{{< expand-wrapper >}} +{{% expand "View `array_union` example" %}} + +```sql +SELECT array_union([1, 2, 3, 4], [5, 6, 3, 4]) AS array_union +``` + +| array_union | +| :----------------- | +| [1, 2, 3, 4, 5, 6] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## arrays_overlap + +_Alias of [array_has_any](#array_has_any)._ + +## cardinality + +Returns the total number of elements in the array. + +```sql +cardinality(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +{{< expand-wrapper >}} +{{% expand "View `cardinality` example" %}} + +```sql +SELECT cardinality([[1, 2, 3, 4], [5, 6, 7, 8]]) AS cardinality +``` + +| cardinality | +| ----------: | +| 8 | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## empty + +Returns `true` for an empty array or `false` for a non-empty array. + +```sql +empty(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +#### Aliases + +- `array_empty` +- `list_empty` + +{{< expand-wrapper >}} +{{% expand "View `empty` example" %}} + +```sql +SELECT empty(['apple']) AS empty +``` + +| empty | +| :---- | +| false | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## flatten + +Flattens nested arrays into a single-level array. + +- Recursively flattens arrays at any depth of nesting +- Returns unchanged if the array is already flat + +The result contains all elements from all nested arrays in a single flat array. + +```sql +flatten(array) +``` + +### Arguments + +- **array**: Array expression. Can be a constant, column, or function, and any + combination of array operators. + +{{< expand-wrapper >}} +{{% expand "View `flatten` example" %}} + +```sql +SELECT flatten([[1, 2], [3, 4]]) AS flattened +``` + +| flattened | +| :----------- | +| [1, 2, 3, 4] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## generate_series + +Returns an array with values between the specified **start** and **stop** values +generated at the specified **step**. + +The range `start..stop` contains all values greater than or equal to **start** +and less than or equal to **stop** (`start <= x <= stop`). +If **start** is greater than or equal to **stop** (`start >= stop`), the +function returns an empty array. + +_`generate_series` is similar to [range](#range), but includes the upper bound +(**stop**) in the output array._ + +```sql +generate_series(start, stop, step) +``` + +### Arguments + +- **start**: Start of the series. Supports integers, timestamps, dates, or + string types that can be coerced to `Date32`. +- **stop**: Upper bound of the series. Supports integers, timestamps, + dates, or string types that can be coerced to `Date32`. The type must be the + same as **start**. +- **step**: Increase by step (cannot be `0`). Steps less than a day are + only supported for ranges with the `TIMESTAMP` type. + +##### Related functions + +[range](#range) + +{{< expand-wrapper >}} +{{% expand "View `generate_series` example" %}} + +```sql +SELECT generate_series(1,5) AS generate_series +``` + +| generate_series | +| :-------------- | +| [1, 2, 3, 4, 5] | + +{{% /expand %}} +{{% expand "View `range` example with dates" %}} + +```sql +SELECT + generate_series( + DATE '2025-03-01', + DATE '2025-08-01', + INTERVAL '1 month' + ) AS generate_series +``` + +| generate_series | +| :----------------------------------------------------------------------- | +| [2025-03-01, 2025-04-01, 2025-05-01, 2025-06-01, 2025-07-01, 2025-08-01] | + +{{% /expand %}} +{{% expand "View `generate_series` example using timestamps" %}} + +```sql +SELECT + generate_series( + '2025-01-01T00:00:00Z'::timestamp, + '2025-01-01T06:00:00Z'::timestamp, + INTERVAL '2 hours' + ) AS generate_series +``` + +| generate_series | +| :----------------------------------------------------------------------------------- | +| [2025-01-01T00:00:00, 2025-01-01T02:00:00, 2025-01-01T04:00:00, 2025-01-01T06:00:00] | + +{{% /expand %}} +{{< /expand-wrapper >}} + + +## list_any_value + +_Alias of [array_any_value](#array_any_value)._ + +## list_append + +_Alias of [array_append](#array_append)._ + +## list_cat + +_Alias of [array_concat](#array_concat)._ + +## list_concat + +_Alias of [array_concat](#array_concat)._ + +## list_contains + +_Alias of [array_has](#array_has)._ + +## list_dims + +_Alias of [array_dims](#array_dims)._ + +## list_distance + +_Alias of [array_distance](#array_distance)._ + +## list_distinct + +_Alias of [array_distinct](#array_distinct)._ + +## list_element + +_Alias of [array_element](#array_element)._ + +## list_empty + +_Alias of [empty](#empty)._ + +## list_except + +_Alias of [array_except](#array_except)._ + +## list_extract + +_Alias of [array_element](#array_element)._ + +## list_has + +_Alias of [array_has](#array_has)._ + +## list_has_all + +_Alias of [array_has_all](#array_has_all)._ + +## list_has_any + +_Alias of [array_has_any](#array_has_any)._ + +## list_indexof + +_Alias of [array_position](#array_position)._ + +## list_intersect + +_Alias of [array_intersect](#array_intersect)._ + +## list_join + +_Alias of [array_to_string](#array_to_string)._ + +## list_length + +_Alias of [array_length](#array_length)._ + +## list_max + +_Alias of [array_max](#array_max)._ + +## list_ndims + +_Alias of [array_ndims](#array_ndims)._ + +## list_pop_back + +_Alias of [array_pop_back](#array_pop_back)._ + +## list_pop_front + +_Alias of [array_pop_front](#array_pop_front)._ + +## list_position + +_Alias of [array_position](#array_position)._ + +## list_positions + +_Alias of [array_positions](#array_positions)._ + +## list_prepend + +_Alias of [array_prepend](#array_prepend)._ + +## list_push_back + +_Alias of [array_append](#array_append)._ + +## list_push_front + +_Alias of [array_prepend](#array_prepend)._ + +## list_remove + +_Alias of [array_remove](#array_remove)._ + +## list_remove_all + +_Alias of [array_remove_all](#array_remove_all)._ + +## list_remove_n + +_Alias of [array_remove_n](#array_remove_n)._ + +## list_repeat + +_Alias of [array_repeat](#array_repeat)._ + +## list_replace + +_Alias of [array_replace](#array_replace)._ + +## list_replace_all + +_Alias of [array_replace_all](#array_replace_all)._ + +## list_replace_n + +_Alias of [array_replace_n](#array_replace_n)._ + +## list_resize + +_Alias of [array_resize](#array_resize)._ + +## list_reverse + +_Alias of [array_reverse](#array_reverse)._ + +## list_slice + +_Alias of [array_slice](#array_slice)._ + +## list_sort + +_Alias of [array_sort](#array_sort)._ + +## list_to_string + +_Alias of [array_to_string](#array_to_string)._ + +## list_union + +_Alias of [array_union](#array_union)._ + +## make_array + +Returns an array using the specified input expressions. + +```sql +make_array(expression1[, ..., expression_n]) +``` + +### Arguments + +- **expression_n**: Expression to include in the output array. + Can be a constant, column, or function, and any combination of arithmetic or + string operators. + +#### Aliases + +- `make_list` + +{{< expand-wrapper >}} +{{% expand "View `make_array` example" %}} + +```sql +SELECT make_array(1, 2, 3, 4, 5) AS make_array +``` + +| make_array | +| :-------------- | +| [1, 2, 3, 4, 5] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## make_list + +_Alias of [make_array](#make_array)._ + +## range + +Returns an array with values between the specified **start** and **stop** values +generated at the specified **step**. + +The range `start..stop` contains all values greater than or equal to **start** +and less than **stop** (`start <= x < stop`). +If **start** is greater than or equal to **stop** (`start >= stop`), the +function returns an empty array. + +_`range` is similar to [generate_series](#generate_series), but does not include +the upper bound (**stop**) in the output array._ + +```sql +range(start, stop, step) +``` + +### Arguments + +- **start**: Start of the series. Supports integers, timestamps, dates, or + string types that can be coerced to `Date32`. +- **stop**: Upper bound of the series. Supports integers, timestamps, + dates, or string types that can be coerced to `Date32`. The type must be the + same as **start**. +- **step**: Increase by step (cannot be `0`). Steps less than a day are + only supported for ranges with the `TIMESTAMP` type. + +##### Related functions + +[generate_series](#generate_series) + +{{< expand-wrapper >}} +{{% expand "View `range` example" %}} + +```sql +SELECT range(1, 5, 1) AS range +``` +| range | +|:-------------| +| [1, 2, 3, 4] | + +{{% /expand %}} +{{% expand "View `range` example with dates" %}} + +```sql +SELECT + range( + DATE '2025-03-01', + DATE '2025-08-01', + INTERVAL '1 month' + ) AS range +``` + +| range | +| :----------------------------------------------------------- | +| [2025-03-01, 2025-04-01, 2025-05-01, 2025-06-01, 2025-07-01] | + +{{% /expand %}} +{{% expand "View range example with timestamps" %}} + +```sql +SELECT + range( + '2025-01-01T00:00:00Z'::timestamp, + '2025-01-01T06:00:00Z'::timestamp, + INTERVAL '2 hours' + ) AS range +``` + +| range | +| :-------------------------------------------------------------- | +| [2025-01-01T00:00:00, 2025-01-01T02:00:00, 2025-01-01T04:00:00] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## string_to_array + +Splits a string into an array of substrings based on a delimiter. Any substrings +matching the optional `null_str` argument are replaced with `NULL`. + +```sql +string_to_array(str, delimiter[, null_str]) +``` + +### Arguments + +- **str**: String expression to split. +- **delimiter**: Delimiter string to split on. +- **null_str**: _(Optional)_ Substring values to replace with `NULL`. + +#### Aliases + +- `string_to_list` + +{{< expand-wrapper >}} +{{% expand "View `string_to_array` example with comma-delimited list" %}} + +```sql +SELECT string_to_array('abc, def, ghi', ', ') AS string_to_array +``` + +| string_to_array | +| :-------------- | +| [abc, def, ghi] | + +{{% /expand %}} +{{% expand "View `string_to_array` example with a non-standard delimiter" %}} + +```sql +SELECT string_to_array('abc##def', '##') AS string_to_array +``` + +| string_to_array | +| :-------------- | +| ['abc', 'def'] | + +{{% /expand %}} +{{% expand "View `string_to_array` example with _NULL_ replacements" %}} + +```sql +SELECT string_to_array('abc def', ' ', 'def') AS string_to_array +``` + +| string_to_array | +| :-------------- | +| ['abc', NULL] | + +{{% /expand %}} +{{< /expand-wrapper >}} + +## string_to_list + +_Alias of [string_to_array](#string_to_array)._ diff --git a/content/shared/sql-reference/functions/binary-string.md b/content/shared/sql-reference/functions/binary-string.md index 42521e3f1..1b81909d5 100644 --- a/content/shared/sql-reference/functions/binary-string.md +++ b/content/shared/sql-reference/functions/binary-string.md @@ -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. diff --git a/content/shared/sql-reference/functions/cache.md b/content/shared/sql-reference/functions/cache.md index f4e33b914..2179be780 100644 --- a/content/shared/sql-reference/functions/cache.md +++ b/content/shared/sql-reference/functions/cache.md @@ -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 >}} diff --git a/content/shared/sql-reference/functions/conditional.md b/content/shared/sql-reference/functions/conditional.md index b3258ef81..a264ba057 100644 --- a/content/shared/sql-reference/functions/conditional.md +++ b/content/shared/sql-reference/functions/conditional.md @@ -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) - - ## coalesce Returns the first of its arguments that is not _null_. @@ -56,7 +53,7 @@ FROM {{% /expand %}} {{< /expand-wrapper >}} - ## ifnull _Alias of [nvl](#nvl)._ - ## nullif diff --git a/content/shared/sql-reference/functions/hashing.md b/content/shared/sql-reference/functions/hashing.md index 54a3b5d64..7a014537a 100644 --- a/content/shared/sql-reference/functions/hashing.md +++ b/content/shared/sql-reference/functions/hashing.md @@ -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. diff --git a/content/shared/sql-reference/functions/map.md b/content/shared/sql-reference/functions/map.md new file mode 100644 index 000000000..b6d4dba27 --- /dev/null +++ b/content/shared/sql-reference/functions/map.md @@ -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) + + +## 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_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 >}} diff --git a/content/shared/sql-reference/functions/math.md b/content/shared/sql-reference/functions/math.md index 13896ec76..23f32b097 100644 --- a/content/shared/sql-reference/functions/math.md +++ b/content/shared/sql-reference/functions/math.md @@ -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 it’s 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. diff --git a/content/shared/sql-reference/functions/misc.md b/content/shared/sql-reference/functions/misc.md index e1ef37ba0..2623e432a 100644 --- a/content/shared/sql-reference/functions/misc.md +++ b/content/shared/sql-reference/functions/misc.md @@ -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) - ## 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 >}} - - ## version Returns the version of DataFusion. diff --git a/content/shared/sql-reference/functions/regular-expression.md b/content/shared/sql-reference/functions/regular-expression.md index c32e6bea2..629cb0f7c 100644 --- a/content/shared/sql-reference/functions/regular-expression.md +++ b/content/shared/sql-reference/functions/regular-expression.md @@ -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. diff --git a/content/shared/sql-reference/functions/selector.md b/content/shared/sql-reference/functions/selector.md index dbcaf81e0..fd8b4dc96 100644 --- a/content/shared/sql-reference/functions/selector.md +++ b/content/shared/sql-reference/functions/selector.md @@ -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 diff --git a/content/shared/sql-reference/functions/string.md b/content/shared/sql-reference/functions/string.md index fc2d39076..318620019 100644 --- a/content/shared/sql-reference/functions/string.md +++ b/content/shared/sql-reference/functions/string.md @@ -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. diff --git a/content/shared/sql-reference/functions/struct.md b/content/shared/sql-reference/functions/struct.md new file mode 100644 index 000000000..ec19ecfa9 --- /dev/null +++ b/content/shared/sql-reference/functions/struct.md @@ -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 >}} diff --git a/content/shared/sql-reference/functions/time-and-date.md b/content/shared/sql-reference/functions/time-and-date.md index 82738435a..d116e112f 100644 --- a/content/shared/sql-reference/functions/time-and-date.md +++ b/content/shared/sql-reference/functions/time-and-date.md @@ -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. diff --git a/content/shared/sql-reference/functions/window.md b/content/shared/sql-reference/functions/window.md index 698f46787..17693c8c0 100644 --- a/content/shared/sql-reference/functions/window.md +++ b/content/shared/sql-reference/functions/window.md @@ -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