-- Most reviewed PRs by number of review submissions
SELECT
    r.pr_number,
    COUNT(*) as review_count,
    COUNT(*) FILTER (WHERE r.state = 'APPROVED') as approvals,
    COUNT(*) FILTER (WHERE r.state = 'CHANGES_REQUESTED') as changes_requested
FROM read_parquet('hf://datasets/open-index/open-github-meta/data/reviews/**/0.parquet') r
GROUP BY r.pr_number
ORDER BY review_count DESC
LIMIT 20;
