-
-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathlayer.sql
More file actions
25 lines (24 loc) · 662 Bytes
/
layer.sql
File metadata and controls
25 lines (24 loc) · 662 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
# Note: using response bodies here instead of parsed CSS.
# The parser doesn't quite support the @layer syntax yet, resulting in errors.
# Because the table is clustered, this query is actually cheaper than querying parsed_css.
WITH layers AS (
SELECT
client,
page,
url,
REGEXP_CONTAINS(body, r'\b@layer\b') AS has_layer
FROM
`httparchive.almanac.summary_response_bodies`
WHERE
date = '2022-06-01' AND
type = 'css'
)
SELECT
client,
COUNT(DISTINCT IF(has_layer, page, NULL)) AS pages,
COUNT(DISTINCT page) AS total,
COUNT(DISTINCT IF(has_layer, page, NULL)) / COUNT(DISTINCT page) AS pct
FROM
layers
GROUP BY
client