File size: 4,199 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
144
145
146
147
148
149
150
151
152
/*
{
  "qid": "037",
  "task_type": "ambig",
  "has_intended_resolution": true,
  "language": "SQLite",
  "db": "github_repos",
  "question": "List all repository names with many issues opened in 2022, provide the corresponding issue count and the license for each repository.",
  "gold_ambiguity_points": [
    {
      "id": "A",
      "phrase": "many",
      "type": "infinite",
      "ambiguity_type": "semantic_value",
      "parameter_name": "issue_count_threshold",
      "parameter_dtype": "int",
      "parameter_sample_operators": [
        ">",
        ">="
      ],
      "parameter_sample_values": [
        7
      ],
      "intended_parameter_operator": ">",
      "intended_parameter_value": 7
    },
    {
      "id": "B",
      "phrase": "issues opened",
      "type": "finite",
      "ambiguity_type": "semantic_value",
      "interpretations": [
        "issues created",
        "issues created or reopened"
      ],
      "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": [
    "issue_count_threshold"
  ],
  "parameter_values": {
    "issue_count_threshold": 7
  },
  "other_exec_results": [],
  "required_columns": null,
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] issues opened": "issues created",
      "[B] many": ":issue_count_threshold"
    }
  }
}
*/
WITH issue_counts AS (
SELECT
json_extract(repo, '$.name') AS repo_name,
COUNT(DISTINCT json_extract(payload, '$.issue.id')) AS issues_opened
FROM YEAR_2022
WHERE type = 'IssuesEvent'
AND json_extract(payload, '$.action') = 'opened'
GROUP BY repo_name
HAVING issues_opened > :issue_count_threshold
)
SELECT
ic.repo_name,
ic.issues_opened,
gl.license
FROM issue_counts ic
LEFT JOIN GITHUB_REPOS_LICENSES gl ON ic.repo_name = gl.repo_name
ORDER BY ic.issues_opened DESC;
/* EXEC RESULT
                  repo_name  issues_opened      license
         leo424y/heysiri.ml            340         None
            flutter/flutter            145 bsd-3-clause
   MicrosoftDocs/azure-docs            113         None
           herrphon/upptime             99         None
        home-assistant/core             97         None
... TRUNCATED ...
singularity-data/risingwave             10         None
  scikit-learn/scikit-learn              9 bsd-3-clause
    Esri/calcite-components              8         None
            ToolJet/ToolJet              8         None
                  antvis/X6              8         None
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-B.1` -----
/*
{
  "id": "GQRY-B.1",
  "parameter_names": [
    "issue_count_threshold"
  ],
  "parameter_values": {
    "issue_count_threshold": 7
  },
  "other_exec_results": [],
  "required_columns": null,
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] issues opened": "issues created or reopened",
      "[B] many": ":issue_count_threshold"
    }
  }
}
*/
WITH issue_counts AS (
SELECT
json_extract(repo, '$.name') AS repo_name,
COUNT(DISTINCT json_extract(payload, '$.issue.id')) AS issues_opened
FROM YEAR_2022
WHERE type = 'IssuesEvent'
AND json_extract(payload, '$.action') IN ('opened', 'reopened')
GROUP BY repo_name
HAVING issues_opened > :issue_count_threshold
)
SELECT
ic.repo_name,
ic.issues_opened,
gl.license
FROM issue_counts ic
LEFT JOIN GITHUB_REPOS_LICENSES gl ON ic.repo_name = gl.repo_name
ORDER BY ic.issues_opened DESC;
/* EXEC RESULT
                repo_name  issues_opened      license
       leo424y/heysiri.ml            340         None
          flutter/flutter            149 bsd-3-clause
 MicrosoftDocs/azure-docs            114         None
         herrphon/upptime             99         None
      home-assistant/core             99         None
... TRUNCATED ...
scikit-learn/scikit-learn              9 bsd-3-clause
  tloncorp/landscape-apps              9         None
  Esri/calcite-components              8         None
          ToolJet/ToolJet              8         None
                antvis/X6              8         None
*/
----- END OF GOLD QUERY -----