Last active
November 11, 2016 21:51
-
-
Save swegner/477026625c98f507a7246bca4793ae51 to your computer and use it in GitHub Desktop.
2016 Top Repositories by Pull Requests Opened
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH pull_requests AS ( | |
SELECT | |
e.repo.name AS repo, | |
COUNT(*) AS pr_count | |
FROM `githubarchive.day.2016*` AS e | |
WHERE e.type = 'PullRequestEvent' AND STARTS_WITH(e.payload, '{"action":"opened"') | |
GROUP BY e.repo.name | |
) | |
SELECT | |
pr.repo, | |
pr.pr_count, | |
RANK() OVER w AS `rank`, | |
100 * PERCENT_RANK() OVER w AS percentile | |
FROM pull_requests pr | |
WINDOW w AS (ORDER BY pr.pr_count DESC) | |
ORDER BY pr.pr_count DESC | |
LIMIT 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment