blob: 570f4bc6869a97aca39d427e77db734a64b343a3 [file] [log] [blame]
vinayakb38b7ca42012-03-05 05:44:15 +00001drop dataverse test if exists;
2
3create dataverse test;
4use dataverse test;
5
6create type LineItemType as closed {
7 l_orderkey: int32,
8 l_partkey: int32,
9 l_suppkey: int32,
10 l_linenumber: int32,
11 l_quantity: double,
12 l_extendedprice: double,
13 l_discount: double,
14 l_tax: double,
15 l_returnflag: string,
16 l_linestatus: string,
17 l_shipdate: string,
18 l_commitdate: string,
19 l_receiptdate: string,
20 l_shipinstruct: string,
21 l_shipmode: string,
22 l_comment: string
23}
24
25create type LineIDType as closed {
26 l_orderkey: int32,
27 l_linenumber: int32,
28 l_suppkey: int32
29}
30
31create nodegroup group1 if not exists on nc1, nc2;
32
33create dataset LineItem(LineItemType)
34 partitioned by key l_orderkey, l_linenumber on group1;
35
36create dataset LineID(LineIDType)
37 partitioned by key l_orderkey, l_linenumber on group1;
38
39load dataset LineItem
40using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
41(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
42
43load dataset LineID
44using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
45(("path"="nc1://data/tpch0.001/lineitem_0.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
46
47insert into dataset LineID (
48for $l in dataset('LineItem')
49 where $l.l_orderkey<1000
50 return {
51 "l_orderkey": $l.l_orderkey,
52 "l_partkey": $l.l_linenumber,
53 "l_suppkey": $l.l_partkey
54 }
55);
56
57insert into dataset LineID (
58for $l in dataset('LineItem')
59 where $l.l_orderkey>=1000
60 die after 1000
61 return {
62 "l_orderkey": $l.l_orderkey,
63 "l_partkey": $l.l_linenumber,
64 "l_suppkey": $l.l_partkey
65 }
66);
67
68write output to nc1:"rttest/failure_insert.adm";
69for $c in dataset('LineID')
70order by $c.l_orderkey, $c.l_linenumber
71return $c
72