arcs / tasks /readable /045 /task_readable.md
yanlinf's picture
Release ARCS dataset
1fb4e2d verified
|
Raw History Blame Contribute Delete
1.15 kB

Task: 045

Database: github_repos

Question

What is the highest number of issues opened by a single repository (identified by repo ID) in Q3? Use the YEAR_* tables.

Gold Query

WITH issue_counts_2022 AS (
SELECT json_extract(repo, '$.id') AS repo_id,
COUNT(DISTINCT json_extract(payload, '$.issue.id')) AS issues_opened
FROM YEAR_2022
WHERE type = 'IssuesEvent'
AND json_extract(payload, '$.action') = 'opened'
AND strftime('%m', created_at / 1000000, 'unixepoch') IN ('07', '08', '09')
GROUP BY repo_id
),
issue_counts_2023 AS (
SELECT json_extract(repo, '$.id') AS repo_id,
COUNT(DISTINCT json_extract(payload, '$.issue.id')) AS issues_opened
FROM YEAR_2023
WHERE type = 'IssuesEvent'
AND json_extract(payload, '$.action') = 'opened'
AND strftime('%m', created_at / 1000000, 'unixepoch') IN ('07', '08', '09')
GROUP BY repo_id
),
max_counts AS (
SELECT MAX(issues_opened) AS max_value FROM issue_counts_2022
UNION ALL
SELECT MAX(issues_opened) AS max_value FROM issue_counts_2023
)
SELECT MAX(max_value) AS overall_max
FROM max_counts;

Execution Result:

overall_max
67

1 rows