Skip to content

Commit

Permalink
Lint SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
tunetheweb committed Oct 28, 2024
1 parent f19b659 commit dfa74bb
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions sql/2024/markup/content_encoding.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
-- Temporary function to extract content-encoding
CREATE TEMPORARY FUNCTION GET_CONTENT_ENCODING(response_headers ARRAY<STRUCT<name STRING, value STRING>>)
CREATE TEMPORARY FUNCTION GET_CONTENT_ENCODING(response_headers ARRAY<STRUCT<name STRING, value STRING>>)
RETURNS STRING AS (
(
SELECT
SELECT
value
FROM
FROM
UNNEST(response_headers) AS header
WHERE
WHERE
LOWER(header.name) = 'content-encoding'
LIMIT 1
)
Expand Down
4 changes: 2 additions & 2 deletions sql/2024/markup/custom_elements_adoption.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ SELECT
client,
COUNT(0) AS total,
COUNTIF(has_custom_elements) AS freq,
COUNTIF(has_custom_elements) / COUNT(0) AS pct_custom_elements,
COUNTIF(has_custom_elements) / COUNT(0) AS pct_custom_elements
FROM
custom_elements
GROUP BY
date, client
ORDER BY
date ASC
date ASC
6 changes: 3 additions & 3 deletions sql/2024/markup/doctype.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ CREATE TEMPORARY FUNCTION EXTRACT_DOCTYPE(summary STRING) RETURNS STRING AS (
SELECT
client,
LOWER(REGEXP_REPLACE(TRIM(EXTRACT_DOCTYPE(summary)), r' +', ' ')) AS doctype, # remove extra spaces and make lower case
COUNT(*) AS pages,
SUM(COUNT(*)) OVER (PARTITION BY client) AS total,
COUNT(*) / SUM(COUNT(*)) OVER (PARTITION BY client) AS pct_pages
COUNT(0) AS pages,
SUM(COUNT(0)) OVER (PARTITION BY client) AS total,
COUNT(0) / SUM(COUNT(0)) OVER (PARTITION BY client) AS pct_pages
FROM
`httparchive.all.pages`
WHERE
Expand Down
2 changes: 1 addition & 1 deletion sql/2024/markup/document_size_distribution.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ GROUP BY
percentile,
client
ORDER BY
client
client
2 changes: 1 addition & 1 deletion sql/2024/markup/document_trends_is_root_page.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SELECT
FROM
`httparchive.all.pages`
WHERE
date IN ('2022-06-01', '2023-06-01', '2024-06-01') and
date IN ('2022-06-01', '2023-06-01', '2024-06-01') AND
is_root_page
GROUP BY
date,
Expand Down
2 changes: 1 addition & 1 deletion sql/2024/markup/inputs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ JOIN
USING (client),
UNNEST(get_markup_inputs_info(JSON_EXTRACT(custom_metrics, '$.markup'))) AS markup_input_info
WHERE
date = '2024-06-01'
date = '2024-06-01'
GROUP BY
client,
input_type
Expand Down
2 changes: 1 addition & 1 deletion sql/2024/markup/meta_node_names.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WITH totals AS (
date = '2024-06-01'
GROUP BY
client
),
),

meta AS (
SELECT
Expand Down
2 changes: 1 addition & 1 deletion sql/2024/markup/obsolete_elements.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ try {
''';

CREATE TEMPORARY FUNCTION is_obsolete(element STRING) AS (
element IN ('applet', 'acronym', 'basefont', 'bgsound', 'big', 'blink', 'center', 'dir', 'font', 'frame', 'frameset', 'isindex', 'keygen', 'listing', 'marquee', 'menuitem', 'multicol', 'nextid', 'nobr', 'noembed', 'noframes', 'param', 'plaintext', 'rb', 'rtc', 'spacer', 'strike', 'tt', 'xmp')
element IN ('applet', 'acronym', 'basefont', 'bgsound', 'big', 'blink', 'center', 'dir', 'font', 'frame', 'frameset', 'isindex', 'keygen', 'listing', 'marquee', 'menuitem', 'multicol', 'nextid', 'nobr', 'noembed', 'noframes', 'param', 'plaintext', 'rb', 'rtc', 'spacer', 'strike', 'tt', 'xmp')
);

WITH totals AS (
Expand Down

0 comments on commit dfa74bb

Please sign in to comment.