| /* | |
| { | |
| "qid": "007", | |
| "task_type": "ambig", | |
| "has_intended_resolution": true, | |
| "language": "SQLite", | |
| "db": "retails", | |
| "question": "Count total number of distinct parts shipped in Q4 1996 and 1997 from orders with high order priority.", | |
| "gold_ambiguity_points": [ | |
| { | |
| "id": "A", | |
| "phrase": "Count total number of distinct parts shipped in Q4 1996 and 1997", | |
| "type": "finite", | |
| "ambiguity_type": "syntactic_computation", | |
| "interpretations": [ | |
| "count all distinct part in the specified period", | |
| "count total parts in Q4 1996 and count total parts in Q4 1997 (two separate counts)" | |
| ], | |
| "intended_interpretation_idx": 0 | |
| }, | |
| { | |
| "id": "B", | |
| "phrase": "Q4 1996 and 1997", | |
| "type": "finite", | |
| "ambiguity_type": "syntactic_value", | |
| "interpretations": [ | |
| "Q4 1996 and Q4 1997", | |
| "Q4 1996 and entire 1997" | |
| ], | |
| "intended_interpretation_idx": 1 | |
| }, | |
| { | |
| "id": "C", | |
| "phrase": "high order priority", | |
| "type": "finite", | |
| "ambiguity_type": "semantic_value", | |
| "interpretations": [ | |
| "orderpriority is HIGH or URGENT", | |
| "orderpriority is exactly HIGH" | |
| ], | |
| "intended_interpretation_idx": 0 | |
| } | |
| ], | |
| "gold_intended_query_id": "GQRY-A.0-B.1-C.0", | |
| "extra_info": {} | |
| } | |
| */ | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.0-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.0-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Q4 1996 and 1997": "Q4 1996 and Q4 1997", | |
| "[B] Count total number of distinct parts shipped in Q4 1996 and 1997": "count all distinct part in the specified period", | |
| "[C] high order priority": "orderpriority is HIGH or URGENT" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT COUNT(DISTINCT p.p_partkey) as total_distinct_parts | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority IN ('1-URGENT', '2-HIGH') | |
| AND ( | |
| (l.l_shipdate >= '1996-10-01' AND l.l_shipdate < '1997-01-01') OR | |
| (l.l_shipdate >= '1997-10-01' AND l.l_shipdate < '1998-01-01') | |
| ); | |
| /* EXEC RESULT | |
| total_distinct_parts | |
| 120499 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.0-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.0-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Q4 1996 and 1997": "Q4 1996 and Q4 1997", | |
| "[B] Count total number of distinct parts shipped in Q4 1996 and 1997": "count all distinct part in the specified period", | |
| "[C] high order priority": "orderpriority is exactly HIGH" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT COUNT(DISTINCT p.p_partkey) as total_distinct_parts | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority = '2-HIGH' | |
| AND ( | |
| (l.l_shipdate >= '1996-10-01' AND l.l_shipdate < '1997-01-01') OR | |
| (l.l_shipdate >= '1997-10-01' AND l.l_shipdate < '1998-01-01') | |
| ); | |
| /* EXEC RESULT | |
| total_distinct_parts | |
| 74114 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.1-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.1-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Q4 1996 and 1997": "Q4 1996 and entire 1997", | |
| "[B] Count total number of distinct parts shipped in Q4 1996 and 1997": "count all distinct part in the specified period", | |
| "[C] high order priority": "orderpriority is HIGH or URGENT" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT COUNT(DISTINCT p.p_partkey) as total_distinct_parts | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority IN ('1-URGENT', '2-HIGH') | |
| AND ( | |
| (l.l_shipdate >= '1996-10-01' AND l.l_shipdate < '1997-01-01') OR | |
| (l.l_shipdate >= '1997-01-01' AND l.l_shipdate < '1998-01-01') | |
| ); | |
| /* EXEC RESULT | |
| total_distinct_parts | |
| 179839 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.1-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.1-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Q4 1996 and 1997": "Q4 1996 and entire 1997", | |
| "[B] Count total number of distinct parts shipped in Q4 1996 and 1997": "count all distinct part in the specified period", | |
| "[C] high order priority": "orderpriority is exactly HIGH" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT COUNT(DISTINCT p.p_partkey) as total_distinct_parts | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority = '2-HIGH' | |
| AND ( | |
| (l.l_shipdate >= '1996-10-01' AND l.l_shipdate < '1997-01-01') OR | |
| (l.l_shipdate >= '1997-01-01' AND l.l_shipdate < '1998-01-01') | |
| ); | |
| /* EXEC RESULT | |
| total_distinct_parts | |
| 136931 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.0-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.0-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Q4 1996 and 1997": "Q4 1996 and Q4 1997", | |
| "[B] Count total number of distinct parts shipped in Q4 1996 and 1997": "count total parts in Q4 1996 and count total parts in Q4 1997 (two separate counts)", | |
| "[C] high order priority": "orderpriority is HIGH or URGENT" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| (SELECT COUNT(DISTINCT p.p_partkey) | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority IN ('1-URGENT', '2-HIGH') | |
| AND l.l_shipdate >= '1996-10-01' | |
| AND l.l_shipdate < '1997-01-01' | |
| ) as q4_1996_count, | |
| (SELECT COUNT(DISTINCT p.p_partkey) | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority IN ('1-URGENT', '2-HIGH') | |
| AND l.l_shipdate >= '1997-10-01' | |
| AND l.l_shipdate < '1998-01-01' | |
| ) as q4_1997_count; | |
| /* EXEC RESULT | |
| q4_1996_count q4_1997_count | |
| 73977 73514 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.0-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.0-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Q4 1996 and 1997": "Q4 1996 and Q4 1997", | |
| "[B] Count total number of distinct parts shipped in Q4 1996 and 1997": "count total parts in Q4 1996 and count total parts in Q4 1997 (two separate counts)", | |
| "[C] high order priority": "orderpriority is exactly HIGH" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| (SELECT COUNT(DISTINCT p.p_partkey) | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority = '2-HIGH' | |
| AND l.l_shipdate >= '1996-10-01' | |
| AND l.l_shipdate < '1997-01-01' | |
| ) as q4_1996_count, | |
| (SELECT COUNT(DISTINCT p.p_partkey) | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority = '2-HIGH' | |
| AND l.l_shipdate >= '1997-10-01' | |
| AND l.l_shipdate < '1998-01-01' | |
| ) as q4_1997_count; | |
| /* EXEC RESULT | |
| q4_1996_count q4_1997_count | |
| 41607 40890 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.1-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.1-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Q4 1996 and 1997": "Q4 1996 and entire 1997", | |
| "[B] Count total number of distinct parts shipped in Q4 1996 and 1997": "count total parts in Q4 1996 and count total parts in Q4 1997 (two separate counts)", | |
| "[C] high order priority": "orderpriority is HIGH or URGENT" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| (SELECT COUNT(DISTINCT p.p_partkey) | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority IN ('1-URGENT', '2-HIGH') | |
| AND l.l_shipdate >= '1996-10-01' | |
| AND l.l_shipdate < '1997-01-01' | |
| ) as q4_1996_count, | |
| (SELECT COUNT(DISTINCT p.p_partkey) | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority IN ('1-URGENT', '2-HIGH') | |
| AND l.l_shipdate >= '1997-01-01' | |
| AND l.l_shipdate < '1998-01-01' | |
| ) as q4_1997_count; | |
| /* EXEC RESULT | |
| q4_1996_count q4_1997_count | |
| 73977 167937 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.1-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.1-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": null, | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Q4 1996 and 1997": "Q4 1996 and entire 1997", | |
| "[B] Count total number of distinct parts shipped in Q4 1996 and 1997": "count total parts in Q4 1996 and count total parts in Q4 1997 (two separate counts)", | |
| "[C] high order priority": "orderpriority is exactly HIGH" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| (SELECT COUNT(DISTINCT p.p_partkey) | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority = '2-HIGH' | |
| AND l.l_shipdate >= '1996-10-01' | |
| AND l.l_shipdate < '1997-01-01' | |
| ) as q4_1996_count, | |
| (SELECT COUNT(DISTINCT p.p_partkey) | |
| FROM lineitem l | |
| JOIN part p ON l.l_partkey = p.p_partkey | |
| JOIN orders o ON l.l_orderkey = o.o_orderkey | |
| WHERE o.o_orderpriority = '2-HIGH' | |
| AND l.l_shipdate >= '1997-01-01' | |
| AND l.l_shipdate < '1998-01-01' | |
| ) as q4_1997_count; | |
| /* EXEC RESULT | |
| q4_1996_count q4_1997_count | |
| 41607 120171 | |
| */ | |
| ----- END OF GOLD QUERY ----- |