-
-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathfonts_family_by_script.sql
More file actions
46 lines (43 loc) · 923 Bytes
/
fonts_family_by_script.sql
File metadata and controls
46 lines (43 loc) · 923 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
-- Section: Design
-- Question: Which families are used broken down by script?
-- Normalization: Requests (parsed only)
-- INCLUDE https://github.com/HTTPArchive/almanac.httparchive.org/blob/main/sql/{year}/fonts/common.sql
WITH
requests AS (
SELECT
client,
SCRIPTS(payload) AS scripts,
FAMILY(payload) AS family,
COUNT(0) OVER (PARTITION BY client) AS total
FROM
`httparchive.crawl.requests`
WHERE
date = @date AND
type = 'font' AND
is_root_page AND
IS_PARSED(payload)
)
SELECT
client,
script,
family,
COUNT(0) AS count,
total AS total,
ROUND(COUNT(0) / total, @precision) AS proportion,
ROW_NUMBER() OVER (PARTITION BY client, script ORDER BY COUNT(0) DESC) AS rank
FROM
requests,
UNNEST(scripts) AS script
WHERE
family != 'Adobe Blank'
GROUP BY
client,
script,
family,
requests.total
QUALIFY
rank <= 10
ORDER BY
client,
script,
count DESC