diff --git a/sql/2021/javascript/most_requested_content_type.sql b/sql/2021/javascript/most_requested_content_type.sql index 5561b338b24..573059a6279 100644 --- a/sql/2021/javascript/most_requested_content_type.sql +++ b/sql/2021/javascript/most_requested_content_type.sql @@ -1,5 +1,13 @@ SELECT - resp_content_type, + client, + CASE + WHEN resp_content_type LIKE '%image%' THEN 'images' + WHEN resp_content_type LIKE '%font%' THEN 'font' + WHEN resp_content_type LIKE '%css%' THEN 'css' + WHEN resp_content_type LIKE '%javascript%' THEN 'javascript' + WHEN resp_content_type LIKE '%json%' THEN 'json' + ELSE 'other' + END AS content_type, COUNT(0) AS count, SUM(COUNT(0)) OVER (PARTITION BY client) AS total, COUNT(0) / SUM(COUNT(0)) OVER (PARTITION BY client) AS pct @@ -8,6 +16,7 @@ FROM WHERE date = '2021-07-01' GROUP BY - client + client, + content_type ORDER BY - client DESC + pct DESC diff --git a/sql/2021/javascript/web_components_specs.sql b/sql/2021/javascript/web_components_specs.sql index 383d0db5503..8dff570db5b 100644 --- a/sql/2021/javascript/web_components_specs.sql +++ b/sql/2021/javascript/web_components_specs.sql @@ -1,26 +1,17 @@ SELECT client, percentile, - APPROX_QUANTILES(custom_elements, 1000)[ - OFFSET(percentile * 10)] AS custom_elements, - APPROX_QUANTILES(shadow_roots, 1000)[ - OFFSET(percentile * 10)] AS shadow_roots, - APPROX_QUANTILES(template, 1000)[ - OFFSET(percentile * 10)] AS template + APPROX_QUANTILES(custom_elements, 1000)[OFFSET(percentile * 10)] AS custom_elements, + APPROX_QUANTILES(shadow_roots, 1000)[OFFSET(percentile * 10)] AS shadow_roots, + APPROX_QUANTILES(template, 1000)[OFFSET(percentile * 10)] AS template FROM ( SELECT _TABLE_SUFFIX AS client, - CAST(JSON_EXTRACT(JSON_EXTRACT_SCALAR(payload, - '$._javascript'), - '$.web_component_specs.custom_elements.length') AS INT64) AS custom_elements, - CAST(JSON_EXTRACT(JSON_EXTRACT_SCALAR(payload, - '$._javascript'), - '$.web_component_specs.shadow_roots.length') AS INT64) AS shadow_roots, - CAST(JSON_EXTRACT(JSON_EXTRACT_SCALAR(payload, - '$._javascript'), - '$.web_component_specs.template.length') AS INT64) AS template + ARRAY_LENGTH(JSON_EXTRACT_ARRAY(JSON_EXTRACT_SCALAR(payload, '$._javascript'), '$.web_component_specs.custom_elements')) AS custom_elements, + ARRAY_LENGTH(JSON_EXTRACT_ARRAY(JSON_EXTRACT_SCALAR(payload, '$._javascript'), '$.web_component_specs.shadow_roots')) AS shadow_roots, + ARRAY_LENGTH(JSON_EXTRACT_ARRAY(JSON_EXTRACT_SCALAR(payload, '$._javascript'), '$.web_component_specs.template')) AS template FROM - `httparchive.pages.2021_07_01_*` ), + `httparchive.pages.2021_09_01_*`), UNNEST([10, 25, 50, 75, 90, 100]) AS percentile GROUP BY percentile,