Skip to content

Commit 8aa779d

Browse files
authored
DS-15484: Document upcoming SQL feature additions to Workers Analytics Engine (#25446)
* DS-15484: Document upcoming SQL feature additions to WAE This PR adds documentation for various SQL feature additions to Workers Analytics Engine done in RM-24208. There are now too many functions to sensibly put in a single page, so I've broken the SQL Reference documentation out into a page structure which is extensible. I've taken deliberate inspiration from the ClickHouse SQL documentation page structure [1]. WAE's SQL dialect is based on the ClickHouse SQL dialect, and we intend to gradually add more and more functions from CH SQL. Having a similar docs structure will work well for that. [1] https://clickhouse.com/docs/sql-reference/functions/math-functions * DS-15484: Label new functions with `New` badges This was suggested by product. There's some functions which have slightly changed (e.g. `quantileExactWeighted`) to support a new alternate form more like ClickHouse. I've not labelled those functions because it's not so important to existing users. * Merge rounding functions into mathematical functions page * Review suggestions * Document topK and topKWeighted * Remaining review suggestions
1 parent 6179b21 commit 8aa779d

16 files changed

+1454
-802
lines changed

src/content/docs/analytics/analytics-engine/sampling.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Here are some examples of how to express some common queries over sampled data.
7070
| Count events in a dataset | `count()` | `sum(_sample_interval)` |
7171
| Sum a quantity, for example, bytes | `sum(bytes)` | `sum(bytes * _sample_interval)` |
7272
| Average a quantity | `avg(bytes)` | `sum(bytes * _sample_interval) / sum(_sample_interval)` |
73-
| Compute quantiles | `quantile(0.50)(bytes)` | `quantileWeighted(0.50)(bytes, _sample_interval)` |
73+
| Compute quantiles | `quantile(0.50)(bytes)` | `quantileExactWeighted(0.50)(bytes, _sample_interval)` |
7474

7575
Note that the accuracy of results is not determined by the sample interval, similar to the mapping analogy mentioned earlier. A high sample interval can still provide precise results. Instead, accuracy depends on the total number of data points queried and their distribution.
7676

src/content/docs/analytics/analytics-engine/sql-api.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Use the dashboard to create a token with permission to read analytics data on yo
3232

3333
## Querying the API
3434

35-
Submit the query text in the body of a `POST` request to the API address. The format of the data returned can be selected using the [`FORMAT` option](/analytics/analytics-engine/sql-reference/#format-clause) in your query.
35+
Submit the query text in the body of a `POST` request to the API address. The format of the data returned can be selected using the [`FORMAT`](/analytics/analytics-engine/sql-reference/statements/#format-clause) option in your query.
3636

3737
You can use cURL to test the API as follows, replacing the `<account_id>` with your 32 character account ID (available in the dashboard) and the `<token>` with the token string you generated above.
3838

@@ -82,7 +82,7 @@ The rate at which the data is sampled is exposed via the `_sample_interval` colu
8282
| `SELECT SUM(double1) FROM ...` | `SELECT SUM(_sample_interval * double1) FROM ...` |
8383
| `SELECT AVG(double1) FROM ...` | `SELECT SUM(_sample_interval * double1) / SUM(_sample_interval) FROM ...` |
8484

85-
Additionally, the [QUANTILEWEIGHTED function](/analytics/analytics-engine/sql-reference/#quantileweighted) is designed to be used with sample interval as the third argument.
85+
Additionally, the [QUANTILEEXACTWEIGHTED](/analytics/analytics-engine/sql-reference/aggregate-functions/#quantileexactweighted) function is designed to be used with sample interval as the third argument.
8686

8787
## Example queries
8888

0 commit comments

Comments
 (0)