-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[DDSQL] DDSQL type and type literal docs #31252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DDSQL] DDSQL type and type literal docs #31252
Conversation
✅ Documentation Team ReviewThe documentation team has approved this pull request. Thank you for your contribution! |
5a29a06 to
8a163ca
Compare
Preview links (active after the
|
8a163ca to
359aeb5
Compare
359aeb5 to
c91b759
Compare
maycmlee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some suggestions
Co-authored-by: May Lee <may.lee@datadoghq.com>
Co-authored-by: May Lee <may.lee@datadoghq.com>
maycmlee
left a comment
There was a problem hiding this 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?
@maycmlee Yes! |
|
|
||
| ### Array types | ||
|
|
||
| All data types except `JSON` support array types. Arrays can contain multiple values of the same data type. |
There was a problem hiding this comment.
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`. |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
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: