arcs-bench / tasks /readable /042 /task_readable.sql
anon
Upload tasks/ folder for end-to-end loader reproducibility
02edc38
/*
{
"qid": "042",
"task_type": "ambig",
"has_intended_resolution": true,
"language": "SQLite",
"db": "github_repos",
"question": "Count the total number of Wiki pages updated in the last month of 2022 and 2023.",
"gold_ambiguity_points": [
{
"id": "A",
"phrase": "Wiki pages updated",
"type": "finite",
"ambiguity_type": "semantic_value",
"interpretations": [
"Wiki pages created",
"Wiki pages edited",
"Wiki pages created or edited"
],
"intended_interpretation_idx": 2
},
{
"id": "B",
"phrase": "last month of 2022 and 2023",
"type": "finite",
"ambiguity_type": "syntactic_table",
"interpretations": [
"December 2022 and December 2023",
"December 2022 and the entire 2023"
],
"intended_interpretation_idx": 1
}
],
"gold_intended_query_id": "GQRY-A.2-B.1",
"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] Wiki pages updated": "Wiki pages created",
"[B] last month of 2022 and 2023": "December 2022 and December 2023"
}
}
}
*/
WITH combined_events AS (
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM MONTH_202212 g
WHERE g.type = 'GollumEvent'
UNION ALL
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM MONTH_202312 g
WHERE g.type = 'GollumEvent'
),
updated_pages AS (
SELECT combined_events.repo_id, json_extract(page.value, '$.page_name') AS page_name
FROM combined_events,
json_each(combined_events.pages) AS page
WHERE json_extract(page.value, '$.action') = 'created'
GROUP BY combined_events.repo_id, page_name
)
SELECT COUNT(*) AS total_wiki_pages_updated FROM updated_pages;
/* EXEC RESULT
total_wiki_pages_updated
0
*/
----- 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] Wiki pages updated": "Wiki pages created",
"[B] last month of 2022 and 2023": "December 2022 and the entire 2023"
}
}
}
*/
WITH combined_events AS (
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM MONTH_202212 g
WHERE g.type = 'GollumEvent'
UNION ALL
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM YEAR_2023 g
WHERE g.type = 'GollumEvent'
),
updated_pages AS (
SELECT combined_events.repo_id, json_extract(page.value, '$.page_name') AS page_name
FROM combined_events,
json_each(combined_events.pages) AS page
WHERE json_extract(page.value, '$.action') = 'created'
GROUP BY combined_events.repo_id, page_name
)
SELECT COUNT(*) AS total_wiki_pages_updated FROM updated_pages;
/* EXEC RESULT
total_wiki_pages_updated
1
*/
----- 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] Wiki pages updated": "Wiki pages edited",
"[B] last month of 2022 and 2023": "December 2022 and December 2023"
}
}
}
*/
WITH combined_events AS (
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM MONTH_202212 g
WHERE g.type = 'GollumEvent'
UNION ALL
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM MONTH_202312 g
WHERE g.type = 'GollumEvent'
),
updated_pages AS (
SELECT combined_events.repo_id, json_extract(page.value, '$.page_name') AS page_name
FROM combined_events,
json_each(combined_events.pages) AS page
WHERE json_extract(page.value, '$.action') = 'edited'
GROUP BY combined_events.repo_id, page_name
)
SELECT COUNT(*) AS total_wiki_pages_updated FROM updated_pages;
/* EXEC RESULT
total_wiki_pages_updated
1
*/
----- 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] Wiki pages updated": "Wiki pages edited",
"[B] last month of 2022 and 2023": "December 2022 and the entire 2023"
}
}
}
*/
WITH combined_events AS (
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM MONTH_202212 g
WHERE g.type = 'GollumEvent'
UNION ALL
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM YEAR_2023 g
WHERE g.type = 'GollumEvent'
),
updated_pages AS (
SELECT combined_events.repo_id, json_extract(page.value, '$.page_name') AS page_name
FROM combined_events,
json_each(combined_events.pages) AS page
WHERE json_extract(page.value, '$.action') = 'edited'
GROUP BY combined_events.repo_id, page_name
)
SELECT COUNT(*) AS total_wiki_pages_updated FROM updated_pages;
/* EXEC RESULT
total_wiki_pages_updated
18
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.2-B.0` -----
/*
{
"id": "GQRY-A.2-B.0",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": null,
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] Wiki pages updated": "Wiki pages created or edited",
"[B] last month of 2022 and 2023": "December 2022 and December 2023"
}
}
}
*/
WITH combined_events AS (
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM MONTH_202212 g
WHERE g.type = 'GollumEvent'
UNION ALL
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM MONTH_202312 g
WHERE g.type = 'GollumEvent'
),
updated_pages AS (
SELECT combined_events.repo_id, json_extract(page.value, '$.page_name') AS page_name
FROM combined_events,
json_each(combined_events.pages) AS page
WHERE json_extract(page.value, '$.action') IN ('created', 'edited')
GROUP BY combined_events.repo_id, page_name
)
SELECT COUNT(*) AS total_wiki_pages_updated FROM updated_pages;
/* EXEC RESULT
total_wiki_pages_updated
1
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.2-B.1` -----
/*
{
"id": "GQRY-A.2-B.1",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": null,
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] Wiki pages updated": "Wiki pages created or edited",
"[B] last month of 2022 and 2023": "December 2022 and the entire 2023"
}
}
}
*/
WITH combined_events AS (
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM MONTH_202212 g
WHERE g.type = 'GollumEvent'
UNION ALL
SELECT
json_extract(g.repo, '$.id') AS repo_id,
json_extract(g.payload, '$.pages') AS pages
FROM YEAR_2023 g
WHERE g.type = 'GollumEvent'
),
updated_pages AS (
SELECT combined_events.repo_id, json_extract(page.value, '$.page_name') AS page_name
FROM combined_events,
json_each(combined_events.pages) AS page
WHERE json_extract(page.value, '$.action') IN ('created', 'edited')
GROUP BY combined_events.repo_id, page_name
)
SELECT COUNT(*) AS total_wiki_pages_updated FROM updated_pages;
/* EXEC RESULT
total_wiki_pages_updated
19
*/
----- END OF GOLD QUERY -----