| /* | |
| { | |
| "qid": "041", | |
| "task_type": "ambig", | |
| "has_intended_resolution": true, | |
| "language": "SQLite", | |
| "db": "github_repos", | |
| "question": "Use the GITHUB_REPOS_* tables to count the total number of sample files in projects with Python and over 10 watchers.", | |
| "gold_ambiguity_points": [ | |
| { | |
| "id": "A", | |
| "phrase": "projects with Python", | |
| "type": "finite", | |
| "ambiguity_type": "semantic_table", | |
| "interpretations": [ | |
| "repos with language='Python' in GITHUB_REPOS_LANGUAGES", | |
| "repos with .py files in GITHUB_REPOS_SAMPLE_FILES", | |
| "repos with .py files in GITHUB_REPOS_SAMPLE_CONTENTS" | |
| ], | |
| "intended_interpretation_idx": 2 | |
| }, | |
| { | |
| "id": "B", | |
| "phrase": "projects with Python and over 10 watchers", | |
| "type": "finite", | |
| "ambiguity_type": "semantic_computation", | |
| "interpretations": [ | |
| "projects with both conditions met ('and' means logical AND)", | |
| "projects with either condition met ('and' means UNION)", | |
| "projects with Python and projects with over 10 watchers (two separate counts)" | |
| ], | |
| "intended_interpretation_idx": 2 | |
| } | |
| ], | |
| "gold_intended_query_id": "GQRY-A.2-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] projects with Python": "repos with language='Python' in GITHUB_REPOS_LANGUAGES", | |
| "[B] projects with Python and over 10 watchers": "projects with both conditions met ('and' means logical AND)" | |
| } | |
| } | |
| } | |
| */ | |
| WITH python_repos AS ( | |
| SELECT DISTINCT l.repo_name | |
| FROM GITHUB_REPOS_LANGUAGES l | |
| WHERE l.language LIKE '%Python%' | |
| ), | |
| watch_repos AS ( | |
| SELECT DISTINCT sr.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_REPOS sr | |
| WHERE sr.watch_count > 10 | |
| ) | |
| SELECT COUNT(*) AS file_count | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf | |
| WHERE sf.repo_name IN (SELECT pr.repo_name FROM python_repos pr) | |
| AND sf.repo_name IN (SELECT wr.repo_name FROM watch_repos wr); | |
| /* EXEC RESULT | |
| file_count | |
| 126 | |
| */ | |
| ----- 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] projects with Python": "repos with language='Python' in GITHUB_REPOS_LANGUAGES", | |
| "[B] projects with Python and over 10 watchers": "projects with either condition met ('and' means UNION)" | |
| } | |
| } | |
| } | |
| */ | |
| WITH python_repos AS ( | |
| SELECT DISTINCT l.repo_name | |
| FROM GITHUB_REPOS_LANGUAGES l | |
| WHERE language LIKE '%Python%' | |
| ), | |
| watch_repos AS ( | |
| SELECT DISTINCT sr.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_REPOS sr | |
| WHERE sr.watch_count > 10 | |
| ) | |
| SELECT COUNT(*) AS file_count | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf | |
| WHERE sf.repo_name IN (SELECT pr.repo_name FROM python_repos pr) | |
| OR sf.repo_name IN (SELECT wr.repo_name FROM watch_repos wr); | |
| /* EXEC RESULT | |
| file_count | |
| 224 | |
| */ | |
| ----- 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] projects with Python": "repos with language='Python' in GITHUB_REPOS_LANGUAGES", | |
| "[B] projects with Python and over 10 watchers": "projects with Python and projects with over 10 watchers (two separate counts)" | |
| } | |
| } | |
| } | |
| */ | |
| WITH python_repos AS ( | |
| SELECT DISTINCT l.repo_name | |
| FROM GITHUB_REPOS_LANGUAGES l | |
| WHERE l.language LIKE '%Python%' | |
| ), | |
| watch_repos AS ( | |
| SELECT DISTINCT sr.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_REPOS sr | |
| WHERE sr.watch_count > 10 | |
| ) | |
| SELECT COUNT(CASE WHEN sf.repo_name IN (SELECT pr.repo_name FROM python_repos pr) THEN 1 ELSE NULL END) AS python_file_count, | |
| COUNT(CASE WHEN sf.repo_name IN (SELECT wr.repo_name FROM watch_repos wr) THEN 1 ELSE NULL END) AS watch_file_count | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf; | |
| /* EXEC RESULT | |
| python_file_count watch_file_count | |
| 126 224 | |
| */ | |
| ----- 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] projects with Python": "repos with .py files in GITHUB_REPOS_SAMPLE_FILES", | |
| "[B] projects with Python and over 10 watchers": "projects with both conditions met ('and' means logical AND)" | |
| } | |
| } | |
| } | |
| */ | |
| WITH python_repos AS ( | |
| SELECT DISTINCT sf.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf | |
| WHERE LOWER(sf.path) LIKE '%.py' | |
| ), | |
| watch_repos AS ( | |
| SELECT DISTINCT sr.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_REPOS sr | |
| WHERE sr.watch_count > 10 | |
| ) | |
| SELECT COUNT(*) AS file_count | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf1 | |
| WHERE sf1.repo_name IN (SELECT pr.repo_name FROM python_repos pr) | |
| AND sf1.repo_name IN (SELECT wr.repo_name FROM watch_repos wr); | |
| /* EXEC RESULT | |
| file_count | |
| 145 | |
| */ | |
| ----- 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] projects with Python": "repos with .py files in GITHUB_REPOS_SAMPLE_FILES", | |
| "[B] projects with Python and over 10 watchers": "projects with either condition met ('and' means UNION)" | |
| } | |
| } | |
| } | |
| */ | |
| WITH python_repos AS ( | |
| SELECT DISTINCT sf.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf | |
| WHERE LOWER(sf.path) LIKE '%.py' | |
| ), | |
| watch_repos AS ( | |
| SELECT DISTINCT sr.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_REPOS sr | |
| WHERE sr.watch_count > 10 | |
| ) | |
| SELECT COUNT(*) AS file_count | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf1 | |
| WHERE sf1.repo_name IN (SELECT pr.repo_name FROM python_repos pr) | |
| OR sf1.repo_name IN (SELECT wr.repo_name FROM watch_repos wr); | |
| /* EXEC RESULT | |
| file_count | |
| 226 | |
| */ | |
| ----- 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] projects with Python": "repos with .py files in GITHUB_REPOS_SAMPLE_FILES", | |
| "[B] projects with Python and over 10 watchers": "projects with Python and projects with over 10 watchers (two separate counts)" | |
| } | |
| } | |
| } | |
| */ | |
| WITH python_repos AS ( | |
| SELECT DISTINCT sf.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf | |
| WHERE LOWER(sf.path) LIKE '%.py' | |
| ), | |
| watch_repos AS ( | |
| SELECT DISTINCT sr.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_REPOS sr | |
| WHERE sr.watch_count > 10 | |
| ) | |
| SELECT COUNT(CASE WHEN sf1.repo_name IN (SELECT pr.repo_name FROM python_repos pr) THEN 1 ELSE NULL END) AS python_file_count, | |
| COUNT(CASE WHEN sf1.repo_name IN (SELECT wr.repo_name FROM watch_repos wr) THEN 1 ELSE NULL END) AS watch_file_count | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf1; | |
| /* EXEC RESULT | |
| python_file_count watch_file_count | |
| 147 224 | |
| */ | |
| ----- 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] projects with Python": "repos with .py files in GITHUB_REPOS_SAMPLE_CONTENTS", | |
| "[B] projects with Python and over 10 watchers": "projects with both conditions met ('and' means logical AND)" | |
| } | |
| } | |
| } | |
| */ | |
| WITH python_repos AS ( | |
| SELECT DISTINCT sc.sample_repo_name as repo_name | |
| FROM GITHUB_REPOS_SAMPLE_CONTENTS sc | |
| WHERE LOWER(sc.sample_path) LIKE '%.py' | |
| ), | |
| watch_repos AS ( | |
| SELECT DISTINCT sr.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_REPOS sr | |
| WHERE sr.watch_count > 10 | |
| ) | |
| SELECT COUNT(*) AS file_count | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf | |
| WHERE sf.repo_name IN (SELECT pr.repo_name FROM python_repos pr) | |
| AND sf.repo_name IN (SELECT wr.repo_name FROM watch_repos wr); | |
| /* EXEC RESULT | |
| file_count | |
| 35 | |
| */ | |
| ----- 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] projects with Python": "repos with .py files in GITHUB_REPOS_SAMPLE_CONTENTS", | |
| "[B] projects with Python and over 10 watchers": "projects with either condition met ('and' means UNION)" | |
| } | |
| } | |
| } | |
| */ | |
| WITH python_repos AS ( | |
| SELECT DISTINCT sc.sample_repo_name as repo_name | |
| FROM GITHUB_REPOS_SAMPLE_CONTENTS sc | |
| WHERE LOWER(sc.sample_path) LIKE '%.py' | |
| ), | |
| watch_repos AS ( | |
| SELECT DISTINCT sr.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_REPOS sr | |
| WHERE sr.watch_count > 10 | |
| ) | |
| SELECT COUNT(*) AS file_count | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf | |
| WHERE sf.repo_name IN (SELECT pr.repo_name FROM python_repos pr) | |
| OR sf.repo_name IN (SELECT wr.repo_name FROM watch_repos wr); | |
| /* EXEC RESULT | |
| file_count | |
| 224 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.2-B.2` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.2-B.2", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] projects with Python": "repos with .py files in GITHUB_REPOS_SAMPLE_CONTENTS", | |
| "[B] projects with Python and over 10 watchers": "projects with Python and projects with over 10 watchers (two separate counts)" | |
| } | |
| } | |
| } | |
| */ | |
| WITH python_repos AS ( | |
| SELECT DISTINCT sc.sample_repo_name as repo_name | |
| FROM GITHUB_REPOS_SAMPLE_CONTENTS sc | |
| WHERE LOWER(sc.sample_path) LIKE '%.py' | |
| ), | |
| watch_repos AS ( | |
| SELECT DISTINCT sr.repo_name | |
| FROM GITHUB_REPOS_SAMPLE_REPOS sr | |
| WHERE sr.watch_count > 10 | |
| ) | |
| SELECT COUNT(CASE WHEN sf.repo_name IN (SELECT pr.repo_name FROM python_repos pr) THEN 1 ELSE NULL END) AS python_file_count, | |
| COUNT(CASE WHEN sf.repo_name IN (SELECT wr.repo_name FROM watch_repos wr) THEN 1 ELSE NULL END) AS watch_file_count | |
| FROM GITHUB_REPOS_SAMPLE_FILES sf; | |
| /* EXEC RESULT | |
| python_file_count watch_file_count | |
| 35 224 | |
| */ | |
| ----- END OF GOLD QUERY ----- |