arcs-bench / tasks /readable /045 /task_readable.sql
anon
Upload tasks/ folder for end-to-end loader reproducibility
02edc38
/*
{
"qid": "045",
"task_type": "ambig",
"has_intended_resolution": true,
"language": "SQLite",
"db": "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_ambiguity_points": [
{
"id": "A",
"phrase": "issues opened",
"type": "finite",
"ambiguity_type": "semantic_value",
"interpretations": [
"issues created",
"issues created or reopened"
],
"intended_interpretation_idx": 0
},
{
"id": "B",
"phrase": "Q3",
"type": "finite",
"ambiguity_type": "semantic_table",
"interpretations": [
"Q3 2022",
"Q3 2023",
"across both Q3 2022 and Q3 2023 (whichever is higher)"
],
"intended_interpretation_idx": 2
}
],
"gold_intended_query_id": "GQRY-A.0-B.2",
"extra_info": {}
}
*/
----- START OF GOLD QUERY `GQRY-A.0-B.0` -----
/*
{
"id": "GQRY-A.0-B.0",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": null,
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] Q3": "Q3 2022",
"[B] issues opened": "issues created"
}
}
}
*/
WITH issue_counts 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
)
SELECT MAX(issues_opened)
FROM issue_counts;
/* EXEC RESULT
MAX(issues_opened)
67
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.0-B.1` -----
/*
{
"id": "GQRY-A.0-B.1",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": null,
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] Q3": "Q3 2023",
"[B] issues opened": "issues created"
}
}
}
*/
WITH issue_counts 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
)
SELECT MAX(issues_opened)
FROM issue_counts;
/* EXEC RESULT
MAX(issues_opened)
47
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.0-B.2` -----
/*
{
"id": "GQRY-A.0-B.2",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": null,
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] Q3": "across both Q3 2022 and Q3 2023 (whichever is higher)",
"[B] issues opened": "issues created"
}
}
}
*/
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;
/* EXEC RESULT
overall_max
67
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.1-B.0` -----
/*
{
"id": "GQRY-A.1-B.0",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": null,
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] Q3": "Q3 2022",
"[B] issues opened": "issues created or reopened"
}
}
}
*/
WITH issue_counts 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') IN ('opened', 'reopened')
AND strftime('%m', created_at / 1000000, 'unixepoch') IN ('07', '08', '09')
GROUP BY repo_id
)
SELECT MAX(issues_opened)
FROM issue_counts;
/* EXEC RESULT
MAX(issues_opened)
67
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.1-B.1` -----
/*
{
"id": "GQRY-A.1-B.1",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": null,
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] Q3": "Q3 2023",
"[B] issues opened": "issues created or reopened"
}
}
}
*/
WITH issue_counts 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') IN ('opened', 'reopened')
AND strftime('%m', created_at / 1000000, 'unixepoch') IN ('07', '08', '09')
GROUP BY repo_id
)
SELECT MAX(issues_opened)
FROM issue_counts;
/* EXEC RESULT
MAX(issues_opened)
251
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.1-B.2` -----
/*
{
"id": "GQRY-A.1-B.2",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": null,
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] Q3": "across both Q3 2022 and Q3 2023 (whichever is higher)",
"[B] issues opened": "issues created or reopened"
}
}
}
*/
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') IN ('opened', 'reopened')
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') IN ('opened', 'reopened')
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;
/* EXEC RESULT
overall_max
251
*/
----- END OF GOLD QUERY -----