blob: 48555760563fa494f4852c93413e9e7b0a762f0f [file] [log] [blame]
vinayakb38b7ca42012-03-05 05:44:15 +00001drop dataverse loj-super-key_01 if exists;
2
3create dataverse loj-super-key_01;
4
5use dataverse loj-super-key_01;
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/loj-super-key_01.adm";
67
68create dataset LineItems(LineItemType)
ramangrover29669d8f62013-02-11 06:03:32 +000069 primary key l_partkey, l_linenumber on group1;
vinayakb38b7ca42012-03-05 05:44:15 +000070create dataset PartSupp(PartSuppType)
ramangrover29669d8f62013-02-11 06:03:32 +000071 primary key ps_partkey, ps_suppkey on group1;
vinayakb38b7ca42012-03-05 05:44:15 +000072
73
74for $li in dataset('LineItems')
75let $partsupp :=
76 for $ps in dataset('PartSupp')
77 where $li.l_partkey = $ps.ps_partkey
78 and $li.l_suppkey = $ps.ps_suppkey
79 and $li.l_extendedprice = $ps.ps_supplycost
80 return $ps
81return {
82 "li": $li,
83 "partsupp": $partsupp
84}
85
86