blob: f0251ad69279747a3be916b83cf9e1d9d2b94c25 [file] [log] [blame]
vinayakb38b7ca42012-03-05 05:44:15 +00001drop dataverse join-super-key_1 if exists;
2
3create dataverse join-super-key_1;
4
5use dataverse join-super-key_1;
6
7create type SupplierType as closed {
8 s_suppkey: int32,
9 s_name: string,
10 s_address: string,
11 s_nationkey: int32,
12 s_phone: string,
13 s_acctbal: double,
14 s_comment: string
15}
16
17create type NationType as closed {
18 n_nationkey: int32,
19 n_name: string,
20 n_regionkey: int32,
21 n_comment: string
22}
23
24create type LineItemType as closed {
25 l_orderkey: int32,
26 l_partkey: int32,
27 l_suppkey: int32,
28 l_linenumber: int32,
29 l_quantity: double,
30 l_extendedprice: double,
31 l_discount: double,
32 l_tax: double,
33 l_returnflag: string,
34 l_linestatus: string,
35 l_shipdate: string,
36 l_commitdate: string,
37 l_receiptdate: string,
38 l_shipinstruct: string,
39 l_shipmode: string,
40 l_comment: string
41}
42
43create type PartType as closed {
44 p_partkey: int32,
45 p_name: string,
46 p_mfgr: string,
47 p_brand: string,
48 p_type: string,
49 p_size: int32,
50 p_container: string,
51 p_retailprice: double,
52 p_comment: string
53}
54
55create type PartSuppType as closed {
56 ps_partkey: int32,
57 ps_suppkey: int32,
58 ps_availqty: int32,
59 ps_supplycost: double,
60 ps_comment: string
61}
62
63
64create nodegroup group1 if not exists on nc1, nc2;
65
66write output to nc1:"/tmp/join-super-key_01.adm";
67
68create dataset LineItems(LineItemType)
69 partitioned by key l_partkey, l_linenumber on group1;
70create dataset PartSupp(PartSuppType)
71 partitioned by key ps_partkey, ps_suppkey on group1;
72
73
74for $li in dataset('LineItems')
75for $ps in dataset('PartSupp')
76where $li.l_partkey = $ps.ps_partkey and $li.l_suppkey = $ps.ps_suppkey and
77 $li.l_extendedprice = $ps.ps_supplycost
78return {
79 "l_partkey": $li.l_partkey
80}
81
82