Skip to content

Conversation

@bradbesserman
Copy link
Contributor

@bradbesserman bradbesserman commented Aug 22, 2025

What does this PR do? What is the motivation?

This PR adds docs for DDSQL types and type literals. It is based on a request in this thread.

Preview link -> https://docs-staging.datadoghq.com/brad.besserman/ddsql-type-and-type-literal-docs/ddsql_reference/#data-types

Merge instructions

Merge readiness:

  • Ready for merge

@bradbesserman bradbesserman requested review from a team as code owners August 22, 2025 19:36
@github-actions
Copy link
Contributor

github-actions bot commented Aug 22, 2025

✅ Documentation Team Review

The documentation team has approved this pull request. Thank you for your contribution!

@bradbesserman bradbesserman force-pushed the brad.besserman/ddsql-type-and-type-literal-docs branch from 5a29a06 to 8a163ca Compare August 22, 2025 19:39
@github-actions
Copy link
Contributor

Preview links (active after the build_preview check completes)

Modified Files

@estherk15 estherk15 self-assigned this Aug 22, 2025
@bradbesserman bradbesserman force-pushed the brad.besserman/ddsql-type-and-type-literal-docs branch from 8a163ca to 359aeb5 Compare August 22, 2025 20:12
@bradbesserman bradbesserman force-pushed the brad.besserman/ddsql-type-and-type-literal-docs branch from 359aeb5 to c91b759 Compare August 22, 2025 20:17
Copy link
Contributor

@maycmlee maycmlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some suggestions

bradbesserman and others added 2 commits August 25, 2025 11:35
Co-authored-by: May Lee <may.lee@datadoghq.com>
Co-authored-by: May Lee <may.lee@datadoghq.com>
Copy link
Contributor

@maycmlee maycmlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Is this ready to merge?

@bradbesserman
Copy link
Contributor Author

LGTM! Is this ready to merge?

@maycmlee Yes!

@maycmlee maycmlee merged commit c1273b0 into master Aug 26, 2025
17 of 18 checks passed
@maycmlee maycmlee deleted the brad.besserman/ddsql-type-and-type-literal-docs branch August 26, 2025 15:21

### Array types

All data types except `JSON` support array types. Arrays can contain multiple values of the same data type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

select array_agg(x) from (select cast('{"x":1}' as json) x union all select cast('{"x":2}' as json)) seems to work fine?

| `TIMESTAMP` | `TIMESTAMP 'value'` | `TIMESTAMP '2023-12-25 10:30:00'` |
| `VARCHAR` | `VARCHAR 'value'` | `VARCHAR 'hello world'` |

The type prefix can be omitted and the type is automatically inferred from the value. For example, `'hello world'` is inferred as `VARCHAR`, `123` as `BIGINT`, and `true` as `BOOLEAN`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider including some guidance on when to use the type prefix. It's not clear why users need this.

price * DOUBLE 1.08 AS price_with_tax,
created_at + INTERVAL '7 days' AS expiry_date
FROM products
WHERE active = BOOLEAN true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit torn about including a where clause like this, which I think idiomatically should be written WHERE active. I understand it's an example for demonstration. But is there an example where you actually benefit from this syntax?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants