Skip to content

Commit d280cd3

Browse files
committed
fix order by
1 parent edc9fb1 commit d280cd3

14 files changed

Lines changed: 26 additions & 123 deletions

sql/2025/privacy/bounce_domains_top.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ FROM bounce_sequences
7474
FOR client IN ('desktop', 'mobile')
7575
)
7676
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop, cnt_mobile AS mobile_count, cnt_desktop AS desktop_count
77-
|> ORDER BY mobile_count + desktop_count DESC
77+
|> ORDER BY COALESCE(mobile_count, 0) + COALESCE(desktop_count, 0) DESC
7878
|> LIMIT 100

sql/2025/privacy/client_hints_top.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ GROUP BY client, value
4141
FOR client IN ('desktop', 'mobile')
4242
)
4343
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop
44-
|> ORDER BY websites_count_desktop + websites_count_mobile DESC
44+
|> ORDER BY COALESCE(websites_count_desktop, 0) + COALESCE(websites_count_mobile, 0) DESC

sql/2025/privacy/client_hints_usage.sql

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,11 @@ accept_ch_meta AS (
2626
SELECT DISTINCT
2727
client,
2828
root_page
29-
FROM (
30-
SELECT
31-
client,
32-
root_page,
33-
custom_metrics.other.almanac AS metrics
34-
FROM `httparchive.crawl.pages`
35-
WHERE date = '2025-07-01'
36-
--AND rank = 1000
37-
),
38-
UNNEST(JSON_QUERY_ARRAY(metrics.`meta-nodes`.nodes)) AS meta_node
39-
WHERE LOWER(SAFE.STRING(meta_node.`http-equiv`)) = 'accept-ch'
29+
FROM `httparchive.crawl.pages`,
30+
UNNEST(JSON_QUERY_ARRAY(custom_metrics.other.almanac.`meta-nodes`.nodes)) AS meta_node
31+
WHERE date = '2025-07-01'
32+
--AND rank = 1000
33+
AND LOWER(SAFE.STRING(meta_node.`http-equiv`)) = 'accept-ch'
4034
),
4135

4236
-- Combine both sources
@@ -58,4 +52,3 @@ GROUP BY all_accept_ch.client
5852
FOR client IN ('desktop', 'mobile')
5953
)
6054
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop
61-
|> ORDER BY websites_count_mobile + websites_count_desktop DESC

sql/2025/privacy/cookie_domains_third_party_top.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ GROUP BY client, cookie_domain
1818
|> RENAME
1919
pct_domains_mobile AS mobile,
2020
pct_domains_desktop AS desktop
21-
|> ORDER BY domain_count_mobile + domain_count_desktop DESC
21+
|> ORDER BY COALESCE(domain_count_mobile, 0) + COALESCE(domain_count_desktop, 0) DESC
2222
|> LIMIT 1000

sql/2025/privacy/cookies_first_party_top.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ GROUP BY client, cookie_name
2323
|> RENAME
2424
pct_domains_mobile AS mobile,
2525
pct_domains_desktop AS desktop
26-
|> ORDER BY domain_count_mobile + domain_count_desktop DESC
26+
|> ORDER BY COALESCE(domain_count_mobile, 0) + COALESCE(domain_count_desktop, 0) DESC
2727
|> LIMIT 1000

sql/2025/privacy/cookies_third_party_top.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ GROUP BY client, cookie_details
1919
|> RENAME
2020
pct_domains_mobile AS mobile,
2121
pct_domains_desktop AS desktop
22-
|> ORDER BY domain_count_mobile + domain_count_desktop DESC
22+
|> ORDER BY COALESCE(domain_count_mobile, 0) + COALESCE(domain_count_desktop, 0) DESC
2323
|> LIMIT 1000

sql/2025/privacy/iab_tcf_v2_cmps_top.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ GROUP BY client, cmpId
1818
FOR client IN ('desktop', 'mobile')
1919
)
2020
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop
21-
|> ORDER BY websites_count_desktop + websites_count_mobile DESC
21+
|> ORDER BY COALESCE(websites_count_desktop, 0) + COALESCE(websites_count_mobile, 0) DESC

sql/2025/privacy/iab_tcf_v2_countries_top.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ FROM base_data
3636
FOR client IN ('desktop', 'mobile')
3737
)
3838
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop
39-
|> ORDER BY websites_count_desktop + websites_count_mobile DESC
39+
|> ORDER BY COALESCE(websites_count_desktop, 0) + COALESCE(websites_count_mobile, 0) DESC

sql/2025/privacy/iab_usp_strings_top.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ FROM `httparchive.crawl.pages`
2525
FOR client IN ('desktop', 'mobile')
2626
)
2727
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop
28-
|> ORDER BY websites_count_desktop + websites_count_mobile DESC
28+
|> ORDER BY COALESCE(websites_count_desktop, 0) + COALESCE(websites_count_mobile, 0) DESC

sql/2025/privacy/referrer_policy_top.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ FROM referrer_policy_custom_metrics
5757
FOR client IN ('desktop', 'mobile')
5858
)
5959
|> RENAME pct_mobile AS mobile, pct_desktop AS desktop
60-
|> ORDER BY websites_count_desktop + websites_count_mobile DESC
60+
|> ORDER BY COALESCE(websites_count_desktop, 0) + COALESCE(websites_count_mobile, 0) DESC

0 commit comments

Comments
 (0)