/* { "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 -----