From d03b42f86d560166c227bf1ba5d3e52e6989b80d Mon Sep 17 00:00:00 2001 From: Mark Hintz Date: Tue, 26 Aug 2025 16:17:00 -0400 Subject: [PATCH 1/3] Add examples of multi-valued tags handling to DDSQL tags documentation I'd like to add an example of what happens in DDSQL when a resource has multiple values for the same tag key. This is a potential stumbling-block for customers and I'd like to be sure that it's well-documented in case customers run into this. --- content/en/ddsql_reference/_index.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/content/en/ddsql_reference/_index.md b/content/en/ddsql_reference/_index.md index d153f19928f93..30faeb5b27c85 100644 --- a/content/en/ddsql_reference/_index.md +++ b/content/en/ddsql_reference/_index.md @@ -677,7 +677,7 @@ ORDER BY value DESC;{{< /code-block >}} ## Tags -DDSQL exposes tags as an `hstore` type, which you can query using the PostgreSQL arrow operator. For example: +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: ```sql SELECT instance_type, count(instance_type) @@ -686,7 +686,15 @@ WHERE tags->'region' = 'us-east-1' -- region is a tag, not a column GROUP BY instance_type ``` -Tags are key-value pairs where each key can have zero, one, or multiple values. When accessed, the tag value returns a string containing all corresponding values. +Tags are key-value pairs where each key can have zero, one, or multiple tag values corresponding to it. When accessed, the tag value returns a single string, containing _all_ corresponding values. When the data had multiple tag values for the same tag key, these will be represented as a sorted, comma-separated string. For example: + +```sql +SELECT tags->'team', instance_type, architecture, COUNT(*) as instance_count +FROM aws.ec2_instance +WHERE tags->'team' = 'compute_provisioning,database_ops' +GROUP BY tags->'team', instance_type, architecture +ORDER BY instance_count DESC +``` You can also compare tag values as strings or entire tag sets: From 05911d421e46e0b4e3cc87cadbaf579aeca07c13 Mon Sep 17 00:00:00 2001 From: Mark Hintz Date: Tue, 26 Aug 2025 16:19:25 -0400 Subject: [PATCH 2/3] Update codeowners for DDSQL Reference --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 648bd82e440b6..2e79a793ac7be 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -165,7 +165,7 @@ content/en/code_analysis/ @Datadog/static-analysis @Data content/en/quality_gates/ @Datadog/ci-app-backend @Datadog/documentation # DDSQL Editor References -content/en/ddsql_reference/*.md @Datadog/xpq @Datadog/documentation @Datadog/advanced-query-guild +content/en/ddsql_reference/*.md @Datadog/documentation @Datadog/advanced-query-guild # Data Streams Monitoring content/en/data_streams/*.md @Datadog/data-streams-monitoring @Datadog/documentation From b6ce08879f3df41238d0cf8290bdc6f9a87de2fa Mon Sep 17 00:00:00 2001 From: Mark Hintz Date: Tue, 26 Aug 2025 16:30:30 -0400 Subject: [PATCH 3/3] Apply PR feedback for future -> present tense Co-authored-by: Brett Blue <84536271+brett0000FF@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 30faeb5b27c85..12bbb19aaacc3 100644 --- a/content/en/ddsql_reference/_index.md +++ b/content/en/ddsql_reference/_index.md @@ -686,7 +686,7 @@ WHERE tags->'region' = 'us-east-1' -- region is a tag, not a column GROUP BY instance_type ``` -Tags are key-value pairs where each key can have zero, one, or multiple tag values corresponding to it. When accessed, the tag value returns a single string, containing _all_ corresponding values. When the data had multiple tag values for the same tag key, these will be represented as a sorted, comma-separated string. For example: +Tags are key-value pairs where each key can have zero, one, or multiple tag values corresponding to it. When accessed, the tag value returns a single string, containing _all_ corresponding values. When the data has multiple tag values for the same tag key, they are represented as a sorted, comma-separated string. For example: ```sql SELECT tags->'team', instance_type, architecture, COUNT(*) as instance_count