| /* | |
| { | |
| "qid": "049", | |
| "task_type": "ambig", | |
| "has_intended_resolution": true, | |
| "language": "SQLite", | |
| "db": "github_repos", | |
| "question": "List the active PR contributors in 2022.", | |
| "gold_ambiguity_points": [ | |
| { | |
| "id": "A", | |
| "phrase": "active", | |
| "type": "infinite", | |
| "ambiguity_type": "semantic_value", | |
| "parameter_name": "pr_count_threshold", | |
| "parameter_dtype": "int", | |
| "parameter_sample_operators": [ | |
| ">", | |
| ">=" | |
| ], | |
| "parameter_sample_values": [ | |
| 100 | |
| ], | |
| "intended_parameter_operator": ">=", | |
| "intended_parameter_value": 100 | |
| }, | |
| { | |
| "id": "B", | |
| "phrase": "PR", | |
| "type": "finite", | |
| "ambiguity_type": "semantic_computation", | |
| "interpretations": [ | |
| "pull requests submitted", | |
| "pull requests submitted that were merged" | |
| ], | |
| "intended_interpretation_idx": 1 | |
| } | |
| ], | |
| "gold_intended_query_id": "GQRY-B.1", | |
| "extra_info": {} | |
| } | |
| */ | |
| ----- START OF GOLD QUERY `GQRY-B.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-B.0", | |
| "parameter_names": [ | |
| "pr_count_threshold" | |
| ], | |
| "parameter_values": { | |
| "pr_count_threshold": 100 | |
| }, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 0 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] PR": "pull requests submitted", | |
| "[B] active": ":pr_count_threshold" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| json_extract(payload, '$.pull_request.user.id') AS contributor, | |
| COUNT(DISTINCT json_extract(payload, '$.pull_request.id')) AS pr_count | |
| FROM YEAR_2022 | |
| WHERE type = 'PullRequestEvent' | |
| AND json_extract(payload, '$.action') = 'opened' | |
| GROUP BY contributor | |
| HAVING pr_count >= :pr_count_threshold | |
| ORDER BY pr_count; | |
| /* EXEC RESULT | |
| contributor pr_count | |
| 45622341 117 | |
| 41898282 120 | |
| 6948709 145 | |
| 49699333 183 | |
| 84948785 324 | |
| ... TRUNCATED ... | |
| 30538765 355 | |
| 30536864 370 | |
| 87541280 823 | |
| 97608502 1331 | |
| 694745 1607 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-B.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-B.1", | |
| "parameter_names": [ | |
| "pr_count_threshold" | |
| ], | |
| "parameter_values": { | |
| "pr_count_threshold": 100 | |
| }, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 0 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] PR": "pull requests submitted that were merged", | |
| "[B] active": ":pr_count_threshold" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| json_extract(payload, '$.pull_request.user.id') AS contributor, | |
| COUNT(DISTINCT json_extract(payload, '$.pull_request.id')) AS pr_count | |
| FROM YEAR_2022 | |
| WHERE type = 'PullRequestEvent' | |
| AND json_extract(payload, '$.action') = 'closed' | |
| AND json_extract(payload, '$.pull_request.merged') = true | |
| AND strftime('%Y', json_extract(payload, '$.pull_request.created_at')) = '2022' | |
| GROUP BY contributor | |
| HAVING pr_count >= :pr_count_threshold | |
| ORDER BY pr_count; | |
| /* EXEC RESULT | |
| contributor pr_count | |
| 87541280 688 | |
| 97608502 880 | |
| 694745 997 | |
| */ | |
| ----- END OF GOLD QUERY ----- |