File size: 2,170 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
/*
{
  "qid": "040",
  "task_type": "ambig",
  "has_intended_resolution": true,
  "language": "SQLite",
  "db": "github_repos",
  "question": "Find all repository IDs that experienced rapid increase in push based on absolute change from 2022 to 2023.",
  "gold_ambiguity_points": [
    {
      "id": "A",
      "phrase": "rapid increase in push",
      "type": "infinite",
      "ambiguity_type": "semantic_value",
      "parameter_name": "push_threshold",
      "parameter_dtype": "int",
      "parameter_sample_operators": [
        ">",
        ">="
      ],
      "parameter_sample_values": [
        70
      ],
      "intended_parameter_operator": ">=",
      "intended_parameter_value": 70
    }
  ],
  "gold_intended_query_id": "GQRY",
  "extra_info": {}
}
*/


----- START OF GOLD QUERY `GQRY` -----
/*
{
  "id": "GQRY",
  "parameter_names": [
    "push_threshold"
  ],
  "parameter_values": {
    "push_threshold": 70
  },
  "other_exec_results": [],
  "required_columns": [
    0
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] rapid increase in push": ":push_threshold"
    }
  }
}
*/
WITH w2022 AS (
SELECT json_extract(repo, '$.id') AS repo_id, COUNT(*) AS cnt_2022
FROM YEAR_2022
WHERE type = 'PushEvent'
GROUP BY repo_id
),
w2023 AS (
SELECT json_extract(repo, '$.id') AS repo_id, COUNT(*) AS cnt_2023
FROM YEAR_2023
WHERE type = 'PushEvent'
GROUP BY repo_id
)
SELECT
w2022.repo_id AS repo_id,
w2022.cnt_2022 AS cnt_2022,
w2023.cnt_2023 AS cnt_2023,
w2023.cnt_2023 - w2022.cnt_2022 AS diff
FROM w2022
JOIN w2023 ON w2022.repo_id = w2023.repo_id
WHERE w2023.cnt_2023 - w2022.cnt_2022 >= :push_threshold
ORDER BY w2023.cnt_2023 - w2022.cnt_2022 DESC;
/* EXEC RESULT
  repo_id  cnt_2022  cnt_2023  diff
571344774       499     10864 10365
511095846         4      8919  8915
330914717      8856     16179  7323
561366239        48      6120  6072
429551228      4405     10081  5676
... TRUNCATED ...
229130005       174       262    88
406918379       401       483    82
465250207       641       723    82
579673939        12        92    80
380057700       133       209    76
*/
----- END OF GOLD QUERY -----