-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29eeb27
commit f014809
Showing
3 changed files
with
36 additions
and
90 deletions.
There are no files selected for viewing
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
33 changes: 33 additions & 0 deletions
33
configs/public_api/http_endpoints/sql/GET-repos-pull_requests-history-size.sql
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
USE gharchive_dev; | ||
|
||
SELECT | ||
t_month AS event_month, xs, s, m, l, xl, xxl, all_size | ||
FROM ( | ||
SELECT | ||
t_month, | ||
SUM(CASE WHEN (additions + deletions) < 10 THEN 1 ELSE 0 END) OVER(PARTITION BY t_month) AS xs, | ||
SUM(CASE WHEN (additions + deletions) >= 10 AND (additions + deletions) < 30 THEN 1 ELSE 0 END) OVER(PARTITION BY t_month) AS s, | ||
SUM(CASE WHEN (additions + deletions) >= 30 AND (additions + deletions) < 100 THEN 1 ELSE 0 END) OVER(PARTITION BY t_month) AS m, | ||
SUM(CASE WHEN (additions + deletions) >= 100 AND (additions + deletions) < 500 THEN 1 ELSE 0 END) OVER(PARTITION BY t_month) AS l, | ||
SUM(CASE WHEN (additions + deletions) >= 500 AND (additions + deletions) < 1000 THEN 1 ELSE 0 END) OVER(PARTITION BY t_month) AS xl, | ||
SUM(CASE WHEN (additions + deletions) >= 1000 THEN 1 ELSE 0 END) OVER (PARTITION BY t_month) AS xxl, | ||
COUNT(*) OVER (PARTITION BY t_month) AS all_size, | ||
ROW_NUMBER() OVER (PARTITION BY t_month) AS row_num | ||
FROM ( | ||
SELECT | ||
DATE_FORMAT(created_at, '%Y-%m-01') as t_month, | ||
additions, | ||
deletions | ||
FROM | ||
github_events | ||
WHERE | ||
type = 'PullRequestEvent' | ||
AND repo_id = (SELECT repo_id FROM github_repos WHERE repo_name = CONCAT(${owner}, '/', ${repo}) LIMIT 1) | ||
AND action = 'opened' | ||
AND created_at >= ${from} | ||
AND created_at <= ${to} | ||
) sub | ||
) sub | ||
WHERE row_num = 1 | ||
ORDER BY t_month | ||
; |
87 changes: 0 additions & 87 deletions
87
configs/public_api/http_endpoints/sql/GET-repos-pull_requests-open_to_merge_dump_uyQXjT.sql
This file was deleted.
Oops, something went wrong.