File size: 7,123 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
/*
{
  "qid": "020",
  "task_type": "ambig",
  "has_intended_resolution": true,
  "language": "SQLite",
  "db": "retails",
  "question": "List large parts that haven't been shipped to Middle East countries. Only includes parts with ID <= 1000.",
  "gold_ambiguity_points": [
    {
      "id": "A",
      "phrase": "large parts",
      "type": "finite",
      "ambiguity_type": "semantic_column",
      "interpretations": [
        "p_size is high",
        "p_type starts with 'LARGE'"
      ],
      "intended_interpretation_idx": 1
    },
    {
      "id": "B",
      "phrase": "large parts",
      "type": "infinite",
      "ambiguity_type": "semantic_value",
      "parameter_name": "size_threshold",
      "parameter_dtype": "int",
      "parameter_sample_operators": [
        ">",
        ">="
      ],
      "parameter_sample_values": [
        25
      ],
      "intended_parameter_operator": ">=",
      "intended_parameter_value": 25
    },
    {
      "id": "C",
      "phrase": "Middle East countries",
      "type": "finite",
      "ambiguity_type": "semantic_value",
      "interpretations": [
        "excludes Egypt (only countries whose region is MIDDLE EAST in the database)",
        "includes Egypt (Egypt is widely recognized as a Middle East country)"
      ],
      "intended_interpretation_idx": 0
    }
  ],
  "gold_intended_query_id": "GQRY-A.1-C.0",
  "extra_info": {}
}
*/


----- START OF GOLD QUERY `GQRY-A.0-C.0` -----
/*
{
  "id": "GQRY-A.0-C.0",
  "parameter_names": [
    "size_threshold"
  ],
  "parameter_values": {
    "size_threshold": 25
  },
  "other_exec_results": [],
  "required_columns": [
    1
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] large parts": "p_size is high",
      "[B] large parts": ":size_threshold",
      "[C] Middle East countries": "excludes Egypt (only countries whose region is MIDDLE EAST in the database)"
    }
  }
}
*/
SELECT DISTINCT p.p_partkey, p.p_name, p.p_type, p.p_size
FROM part p
WHERE p.p_size >= :size_threshold
AND p.p_partkey <= 1000
AND p.p_partkey NOT IN (
SELECT DISTINCT l.l_partkey
FROM lineitem l
JOIN orders o ON l.l_orderkey = o.o_orderkey
JOIN customer c ON o.o_custkey = c.c_custkey
JOIN nation n ON c.c_nationkey = n.n_nationkey
JOIN region r ON n.n_regionkey = r.r_regionkey
WHERE r.r_name = 'MIDDLE EAST'
)
ORDER BY p.p_partkey;
/* EXEC RESULT
 p_partkey                                      p_name                  p_type  p_size
        72 salmon goldenrod cornflower chartreuse rosy STANDARD BRUSHED COPPER      28
       134         medium smoke firebrick green medium    SMALL BRUSHED COPPER      42
       147       midnight antique lavender royal misty    SMALL BRUSHED NICKEL      50
       335      burnished mint azure honeydew honeydew  ECONOMY BRUSHED NICKEL      32
       355            frosted ivory beige orange slate  LARGE BURNISHED NICKEL      33
... TRUNCATED ...
       824  aquamarine metallic blanched spring purple  STANDARD BURNISHED TIN      44
       846              spring dodger lemon sienna dim      SMALL PLATED STEEL      27
       887    cornsilk purple purple lavender seashell     LARGE BRUSHED BRASS      50
       939       goldenrod mint almond goldenrod slate      ECONOMY PLATED TIN      35
       960    chocolate seashell beige lemon gainsboro      PROMO PLATED STEEL      50
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.0-C.1` -----
/*
{
  "id": "GQRY-A.0-C.1",
  "parameter_names": [
    "size_threshold"
  ],
  "parameter_values": {
    "size_threshold": 25
  },
  "other_exec_results": [],
  "required_columns": [
    1
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] large parts": "p_size is high",
      "[B] large parts": ":size_threshold",
      "[C] Middle East countries": "includes Egypt (Egypt is widely recognized as a Middle East country)"
    }
  }
}
*/
SELECT DISTINCT p.p_partkey, p.p_name, p.p_type, p.p_size
FROM part p
WHERE p.p_size >= :size_threshold
AND p.p_partkey <= 1000
AND p.p_partkey NOT IN (
SELECT DISTINCT l.l_partkey
FROM lineitem l
JOIN orders o ON l.l_orderkey = o.o_orderkey
JOIN customer c ON o.o_custkey = c.c_custkey
JOIN nation n ON c.c_nationkey = n.n_nationkey
JOIN region r ON n.n_regionkey = r.r_regionkey
WHERE r.r_name = 'MIDDLE EAST' OR n.n_name = 'EGYPT'
)
ORDER BY p.p_partkey;
/* EXEC RESULT
 p_partkey                                   p_name                 p_type  p_size
       147    midnight antique lavender royal misty   SMALL BRUSHED NICKEL      50
       355         frosted ivory beige orange slate LARGE BURNISHED NICKEL      33
       960 chocolate seashell beige lemon gainsboro     PROMO PLATED STEEL      50
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.1-C.0` -----
/*
{
  "id": "GQRY-A.1-C.0",
  "parameter_names": [],
  "parameter_values": {},
  "other_exec_results": [],
  "required_columns": [
    1
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] large parts": "p_type starts with 'LARGE'",
      "[B] large parts": ":size_threshold",
      "[C] Middle East countries": "excludes Egypt (only countries whose region is MIDDLE EAST in the database)"
    }
  }
}
*/
SELECT DISTINCT p.p_partkey, p.p_name, p.p_type, p.p_size
FROM part p
WHERE p.p_type LIKE 'LARGE%'
AND p.p_partkey <= 1000
AND p.p_partkey NOT IN (
SELECT DISTINCT l.l_partkey
FROM lineitem l
JOIN orders o ON l.l_orderkey = o.o_orderkey
JOIN customer c ON o.o_custkey = c.c_custkey
JOIN nation n ON c.c_nationkey = n.n_nationkey
JOIN region r ON n.n_regionkey = r.r_regionkey
WHERE r.r_name = 'MIDDLE EAST'
)
ORDER BY p.p_partkey;
/* EXEC RESULT
 p_partkey                                   p_name                 p_type  p_size
       355         frosted ivory beige orange slate LARGE BURNISHED NICKEL      33
       887 cornsilk purple purple lavender seashell    LARGE BRUSHED BRASS      50
*/
----- END OF GOLD QUERY -----


----- START OF GOLD QUERY `GQRY-A.1-C.1` -----
/*
{
  "id": "GQRY-A.1-C.1",
  "parameter_names": [],
  "parameter_values": {},
  "other_exec_results": [],
  "required_columns": [
    1
  ],
  "required_sorted": false,
  "extra_info": {
    "ambiguity_resolution": {
      "[A] large parts": "p_type starts with 'LARGE'",
      "[B] large parts": ":size_threshold",
      "[C] Middle East countries": "includes Egypt (Egypt is widely recognized as a Middle East country)"
    }
  }
}
*/
SELECT DISTINCT p.p_partkey, p.p_name, p.p_type, p.p_size
FROM part p
WHERE p.p_type LIKE 'LARGE%'
AND p.p_partkey <= 1000
AND p.p_partkey NOT IN (
SELECT DISTINCT l.l_partkey
FROM lineitem l
JOIN orders o ON l.l_orderkey = o.o_orderkey
JOIN customer c ON o.o_custkey = c.c_custkey
JOIN nation n ON c.c_nationkey = n.n_nationkey
JOIN region r ON n.n_regionkey = r.r_regionkey
WHERE r.r_name = 'MIDDLE EAST' OR n.n_name = 'EGYPT'
)
ORDER BY p.p_partkey;
/* EXEC RESULT
 p_partkey                           p_name                 p_type  p_size
       355 frosted ivory beige orange slate LARGE BURNISHED NICKEL      33
*/
----- END OF GOLD QUERY -----