-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathevalJs.sql
More file actions
31 lines (31 loc) · 618 Bytes
/
evalJs.sql
File metadata and controls
31 lines (31 loc) · 618 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
SELECT
*,
SUM(pdf) OVER (PARTITION BY client ORDER BY bin) AS cdf
FROM (
SELECT
*,
volume / SUM(volume) OVER (PARTITION BY client) AS pdf
FROM (
SELECT
client,
COUNT(0) AS volume,
CAST(FLOAT64(r.payload['_cpu.EvaluateScript']) / 20 AS INT64) * 20 AS bin
FROM
`httparchive.crawl.requests` r
INNER JOIN
`httparchive.crawl.pages`
USING (date, client, is_root_page, rank, page)
WHERE
date = '${YYYY-MM-DD}' AND
is_root_page
GROUP BY
bin,
client
HAVING
bin IS NOT NULL AND
bin >= 0
)
)
ORDER BY
bin,
client