Skip to content

Commit 18b7c44

Browse files
committed
split by rank
1 parent a8f3abd commit 18b7c44

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

definitions/output/crawl/requests.js

+18-14
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,27 @@ publish('requests', {
3838
},
3939
tags: ['crawl_complete']
4040
}).preOps(ctx => `
41-
FOR client_value IN (SELECT * FROM UNNEST(['desktop', 'mobile']) AS client) DO
42-
FOR is_root_page_value IN (SELECT * FROM UNNEST([TRUE, FALSE]) AS is_root_page) DO
41+
FOR client_var IN (SELECT * FROM UNNEST(['desktop', 'mobile']) AS value) DO
42+
FOR is_root_page_var IN (SELECT * FROM UNNEST([TRUE, FALSE]) AS value) DO
43+
FOR rank_lt_50M_var IN (SELECT * FROM UNNEST([TRUE, FALSE]) AS value) DO
4344
44-
-- Delete old entries
45-
DELETE FROM ${ctx.self()}
46-
WHERE date = '${constants.currentMonth}'
47-
AND client = client_value.client
48-
AND is_root_page = is_root_page_value.is_root_page;
45+
-- Delete old entries
46+
DELETE FROM ${ctx.self()}
47+
WHERE date = '${constants.currentMonth}' AND
48+
client = client_var.value AND
49+
is_root_page = is_root_page_var.value AND
50+
(rank < 50000000) = rank_lt_50M_var.value;
4951
50-
-- Insert new entries
51-
INSERT INTO ${ctx.self()}
52-
SELECT *
53-
FROM ${ctx.ref('crawl_staging', 'requests')}
54-
WHERE date = '${constants.currentMonth}' AND
55-
client = client_value.client AND
56-
is_root_page = is_root_page_value.is_root_page ${constants.devRankFilter};
52+
-- Insert new entries
53+
INSERT INTO ${ctx.self()}
54+
SELECT *
55+
FROM ${ctx.ref('crawl_staging', 'requests')}
56+
WHERE date = '${constants.currentMonth}' AND
57+
client = client_var.value AND
58+
is_root_page = is_root_page_var.value AND
59+
(rank < 50000000) = rank_lt_50M_var.value ${constants.devRankFilter};
5760
61+
END FOR;
5862
END FOR;
5963
END FOR;
6064
`).query(ctx => `

0 commit comments

Comments
 (0)