arcs-bench / tasks /readable /021 /task_readable.sql
anon
Upload tasks/ folder for end-to-end loader reproducibility
02edc38
/*
{
"qid": "021",
"task_type": "ambig",
"has_intended_resolution": true,
"language": "SQLite",
"db": "retails",
"question": "Find customers with high purchase quantities.",
"gold_ambiguity_points": [
{
"id": "A",
"phrase": "high purchase quantities",
"type": "finite",
"ambiguity_type": "semantic_computation",
"interpretations": [
"large total quantities of individual parts",
"large number of line items",
"large number of orders"
],
"intended_interpretation_idx": 0
},
{
"id": "B",
"phrase": "high purchase quantities",
"type": "infinite",
"ambiguity_type": "semantic_value",
"parameter_name": "quantity_threshold",
"parameter_dtype": "int",
"parameter_sample_operators": [
">",
">="
],
"parameter_sample_values": [
2800
],
"intended_parameter_operator": ">=",
"intended_parameter_value": 2800
}
],
"gold_intended_query_id": "GQRY-A.0",
"extra_info": {}
}
*/
----- START OF GOLD QUERY `GQRY-A.0` -----
/*
{
"id": "GQRY-A.0",
"parameter_names": [
"quantity_threshold"
],
"parameter_values": {
"quantity_threshold": 2800
},
"other_exec_results": [],
"required_columns": [
1
],
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] high purchase quantities": "large total quantities of individual parts",
"[B] high purchase quantities": ":quantity_threshold"
}
}
}
*/
SELECT c.c_custkey, c.c_name, SUM(l.l_quantity) as total_quantity
FROM customer c
JOIN orders o ON c.c_custkey = o.o_custkey
JOIN lineitem l ON o.o_orderkey = l.l_orderkey
GROUP BY c.c_custkey, c.c_name
HAVING SUM(l.l_quantity) >= :quantity_threshold
ORDER BY total_quantity DESC;
/* EXEC RESULT
c_custkey c_name total_quantity
68513 Customer#000068513 3779
114308 Customer#000114308 3612
58421 Customer#000058421 3605
147472 Customer#000147472 3544
48853 Customer#000048853 3535
... TRUNCATED ...
78145 Customer#000078145 2801
2648 Customer#000002648 2800
22985 Customer#000022985 2800
39151 Customer#000039151 2800
102176 Customer#000102176 2800
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.1` -----
/*
{
"id": "GQRY-A.1",
"parameter_names": [
"quantity_threshold"
],
"parameter_values": {
"quantity_threshold": 2800
},
"other_exec_results": [],
"required_columns": [
1
],
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] high purchase quantities": "large number of line items",
"[B] high purchase quantities": ":quantity_threshold"
}
}
}
*/
SELECT c.c_custkey, c.c_name, COUNT(*) as total_lineitems
FROM customer c
JOIN orders o ON c.c_custkey = o.o_custkey
JOIN lineitem l ON o.o_orderkey = l.l_orderkey
GROUP BY c.c_custkey, c.c_name
HAVING COUNT(*) >= :quantity_threshold
ORDER BY total_lineitems DESC;
/* EXEC RESULT
Empty DataFrame
Columns: [c_custkey, c_name, total_lineitems]
Index: []
*/
----- END OF GOLD QUERY -----
----- START OF GOLD QUERY `GQRY-A.2` -----
/*
{
"id": "GQRY-A.2",
"parameter_names": [
"quantity_threshold"
],
"parameter_values": {
"quantity_threshold": 2800
},
"other_exec_results": [],
"required_columns": [
1
],
"required_sorted": false,
"extra_info": {
"ambiguity_resolution": {
"[A] high purchase quantities": "large number of orders",
"[B] high purchase quantities": ":quantity_threshold"
}
}
}
*/
SELECT c.c_custkey, c.c_name, COUNT(DISTINCT o.o_orderkey) as total_orders
FROM customer c
JOIN orders o ON c.c_custkey = o.o_custkey
GROUP BY c.c_custkey, c.c_name
HAVING COUNT(DISTINCT o.o_orderkey) >= :quantity_threshold
ORDER BY total_orders DESC;
/* EXEC RESULT
Empty DataFrame
Columns: [c_custkey, c_name, total_orders]
Index: []
*/
----- END OF GOLD QUERY -----