-- PR merge rate by repo
SELECT
    split_part(filename, '/', 8) || '/' || split_part(filename, '/', 9) as repo,
    COUNT(*) as total_prs,
    COUNT(*) FILTER (WHERE merged) as merged,
    ROUND(COUNT(*) FILTER (WHERE merged) * 100.0 / COUNT(*), 1) as merge_pct
FROM read_parquet('hf://datasets/open-index/open-github-meta/data/pull_requests/**/0.parquet', filename=true)
GROUP BY repo
ORDER BY total_prs DESC;
