From 656fef85b8b9b6a83136faac00dd089a69920f17 Mon Sep 17 00:00:00 2001 From: Diego Toharia Date: Mon, 10 Nov 2025 10:49:43 +0100 Subject: [PATCH 1/3] AQG-443: document DDSQL's `akeys` and `avals` functions These newly added functions operate on the `hstore` type. Since the only place in the docs where `hstore` is mentioned is the section about `Tags`, this PR adds a new subsection there that documents `hstore` functions, loosely following [Postgres' docs](https://www.postgresql.org/docs/8.4/hstore.html) for description. --- content/en/ddsql_reference/_index.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/content/en/ddsql_reference/_index.md b/content/en/ddsql_reference/_index.md index 96cc4e0bedb..f4712aa78b6 100644 --- a/content/en/ddsql_reference/_index.md +++ b/content/en/ddsql_reference/_index.md @@ -808,9 +808,6 @@ ORDER BY value DESC;{{< /code-block >}} - - - ## Tags DDSQL exposes tags as an `hstore` type, which is inspired by PostgreSQL. You can access the values for specific tag keys using the PostgreSQL arrow operator. For example: @@ -840,6 +837,21 @@ FROM k8s.daemonsets da INNER JOIN k8s.deployments de ON da.tags = de.tags -- for a specific tag: da.tags->'app' = de.tags->'app' ``` +Additionally, you can extract the tags keys and values into individual arrays of text: + +```sql +SELECT akeys(tags), avals(tags) +FROM aws.ec2_instance +``` + +### HSTORE functions and operators + +| Name | Return type | Description | +|-----------------------------------------------|---------------|--------------------------------------------------------------------------------------------------- +| tags -> text | text | Get the value for a given key (returns `null` if key is not present) | +| akeys(tags hstore) | array of text | Get the keys of an HSTORE as an array | +| avals(tags hstore) | array of text | Get the values of an HSTORE as an array | + ## Further reading {{< partial name="whats-next/whats-next.html" >}} From eea2b3cceb067f781fdcabc7c67f1b8dfacb9b48 Mon Sep 17 00:00:00 2001 From: Diego Toharia Date: Mon, 10 Nov 2025 13:50:32 +0100 Subject: [PATCH 2/3] AQG-443: use singular for tag when used in a genitive sentence Co-authored-by: Zakaria Fikrat <113985839+zafikrat@users.noreply.github.com> --- content/en/ddsql_reference/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/ddsql_reference/_index.md b/content/en/ddsql_reference/_index.md index f4712aa78b6..269a676a9de 100644 --- a/content/en/ddsql_reference/_index.md +++ b/content/en/ddsql_reference/_index.md @@ -837,7 +837,7 @@ FROM k8s.daemonsets da INNER JOIN k8s.deployments de ON da.tags = de.tags -- for a specific tag: da.tags->'app' = de.tags->'app' ``` -Additionally, you can extract the tags keys and values into individual arrays of text: +Additionally, you can extract the tag keys and values into individual arrays of text: ```sql SELECT akeys(tags), avals(tags) From 02cf018dd30106fe40a8e704356114a6198792e0 Mon Sep 17 00:00:00 2001 From: Diego Toharia Date: Tue, 11 Nov 2025 14:55:59 +0100 Subject: [PATCH 3/3] AQG-443: use correct casing, verb time and order of function params Co-authored-by: May Lee --- content/en/ddsql_reference/_index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/en/ddsql_reference/_index.md b/content/en/ddsql_reference/_index.md index 269a676a9de..faa52a16e7f 100644 --- a/content/en/ddsql_reference/_index.md +++ b/content/en/ddsql_reference/_index.md @@ -837,7 +837,7 @@ FROM k8s.daemonsets da INNER JOIN k8s.deployments de ON da.tags = de.tags -- for a specific tag: da.tags->'app' = de.tags->'app' ``` -Additionally, you can extract the tag keys and values into individual arrays of text: +Additionally, you can extract tag keys and values into individual arrays of text: ```sql SELECT akeys(tags), avals(tags) @@ -848,9 +848,9 @@ FROM aws.ec2_instance | Name | Return type | Description | |-----------------------------------------------|---------------|--------------------------------------------------------------------------------------------------- -| tags -> text | text | Get the value for a given key (returns `null` if key is not present) | -| akeys(tags hstore) | array of text | Get the keys of an HSTORE as an array | -| avals(tags hstore) | array of text | Get the values of an HSTORE as an array | +| tags -> 'text' | Text | Gets the value for a given key. Returns `null` if key is not present. | +| akeys(hstore tags) | Array of text | Gets the keys of an HSTORE as an array | +| avals(hstore tags) | Array of text | Gets the values of an HSTORE as an array | ## Further reading