File size: 3,192 Bytes
02edc38 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | /*
{
"qid": "044",
"task_type": "ambig",
"has_intended_resolution": true,
"language": "SQLite",
"db": "github_repos",
"question": "Find the most active organization in 2023.",
"gold_ambiguity_points": [
{
"id": "A",
"phrase": "most active organization",
"type": "finite",
"ambiguity_type": "semantic_computation",
"interpretations": [
"organization with the highest total number of events",
"organization with the highest number of repositories that generated events",
"organization with the highest number of actors on its repositories"
],
"intended_interpretation_idx": 1
}
],
"gold_intended_query_id": "GQRY-A.1",
"extra_info": {}
}
*/
----- START OF GOLD QUERY `GQRY-A.0` -----
/*
{
"id": "GQRY-A.0",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": [
0
],
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] most active organization": "organization with the highest total number of events"
}
}
}
*/
WITH org_activity AS (
SELECT
json_extract(y.org, '$.id') AS org_id,
COUNT(*) AS event_count
FROM YEAR_2023 y
WHERE y.org IS NOT NULL AND y.org <> 'null' AND org_id IS NOT NULL
GROUP BY org_id
)
SELECT oa.org_id, oa.event_count
FROM org_activity oa
WHERE oa.event_count = (
SELECT MAX(oa2.event_count)
FROM org_activity oa2
);
/* EXEC RESULT
org_id event_count
8158177 42493
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.1` -----
/*
{
"id": "GQRY-A.1",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": [
0
],
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] most active organization": "organization with the highest number of repositories that generated events"
}
}
}
*/
WITH org_activity AS (
SELECT
json_extract(y.org, '$.id') AS org_id,
COUNT(DISTINCT json_extract(y.repo, '$.id')) AS repo_count
FROM YEAR_2023 y
WHERE y.org IS NOT NULL AND y.org <> 'null' AND org_id IS NOT NULL
GROUP BY org_id
)
SELECT oa.org_id, oa.repo_count
FROM org_activity oa
WHERE oa.repo_count = (
SELECT MAX(oa2.repo_count)
FROM org_activity oa2
);
/* EXEC RESULT
org_id repo_count
8158177 4
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.2` -----
/*
{
"id": "GQRY-A.2",
"parameter_names": [],
"parameter_values": {},
"other_exec_results": [],
"required_columns": [
0
],
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] most active organization": "organization with the highest number of actors on its repositories"
}
}
}
*/
WITH org_activity AS (
SELECT
json_extract(y.org, '$.id') AS org_id,
COUNT(DISTINCT json_extract(y.actor, '$.id')) AS actor_count
FROM YEAR_2023 y
WHERE y.org IS NOT NULL AND y.org <> 'null' AND org_id IS NOT NULL
GROUP BY org_id
)
SELECT oa.org_id, oa.actor_count
FROM org_activity oa
WHERE oa.actor_count = (
SELECT MAX(oa2.actor_count)
FROM org_activity oa2
);
/* EXEC RESULT
org_id actor_count
13844975 916
*/
----- END OF GOLD QUERY ----- |