arcs / tasks /readable /048 /task_readable.md
yanlinf's picture
Release ARCS dataset
1fb4e2d verified
|
Raw History Blame Contribute Delete
886 Bytes
# Task: 048
**Database:** github_repos
## Question
Count the number of repository IDs in YEAR_2023 that have public events and also received a large number of pull requests.
## Gold Query
```sql
WITH repo_public_events AS (
SELECT DISTINCT json_extract(repo, '$.id') as repo_id
FROM YEAR_2023
WHERE type = 'PublicEvent'
),
repo_pull_requests AS (
SELECT
json_extract(repo, '$.id') as repo_id,
COUNT(DISTINCT json_extract(payload, '$.pull_request.id')) as pull_request_count
FROM YEAR_2023
WHERE type = 'PullRequestEvent'
AND json_extract(payload, '$.action') = 'closed'
AND json_extract(payload, '$.pull_request.merged') = true
GROUP BY repo_id
HAVING pull_request_count > :pr_count_threshold
)
SELECT COUNT(*)
FROM repo_public_events rpe
JOIN repo_pull_requests rpr ON rpe.repo_id = rpr.repo_id;
```
**Execution Result:**
| COUNT(*) |
|------------|
| 0 |
*1 rows*