Skip to content

Instantly share code, notes, and snippets.

@zabetak
Created October 13, 2020 08:17
Show Gist options
  • Save zabetak/ce034d1e20c46318fdc36faca1f08418 to your computer and use it in GitHub Desktop.
Save zabetak/ce034d1e20c46318fdc36faca1f08418 to your computer and use it in GitHub Desktop.
Counts the number of (contributor) reviews per committer for a specific quarter
-- The SQL below counts exclusively reviews of non-committers.
SELECT count(*) reviews, committer
FROM
(SELECT c.author author,
c.committer committer,
CASE
WHEN c.author_timestamp > phonebook.first_commit THEN 1
ELSE 0
END is_committer
FROM git_commits c
LEFT JOIN
(SELECT committer,
min(commit_timestamp) first_commit
FROM git_commits
GROUP BY committer) phonebook ON c.author = phonebook.committer
WHERE commit_timestamp >= cast('2020-07-01' AS date)
AND commit_timestamp < cast('2020-10-01' AS date))
WHERE is_committer = 0
GROUP BY committer
ORDER BY reviews DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment