blob: 3f1daad962060046228239808a0eca075d82c411 [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
vinayakb38b7ca42012-03-05 05:44:15 +000031create dataset LineItem(LineItemType)
khfaraaz82@gmail.com502731f2012-05-02 20:38:16 +000032 partitioned by key l_orderkey, l_linenumber;
vinayakb38b7ca42012-03-05 05:44:15 +000033
34create dataset LineID(LineIDType)
khfaraaz82@gmail.com502731f2012-05-02 20:38:16 +000035 partitioned by key l_orderkey, l_linenumber;
vinayakb38b7ca42012-03-05 05:44:15 +000036
37load dataset LineItem
38using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
39(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
40
41load dataset LineID
42using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
43(("path"="nc1://data/tpch0.001/lineitem_0.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
44
45insert into dataset LineID (
46for $l in dataset('LineItem')
47 where $l.l_orderkey<1000
48 return {
49 "l_orderkey": $l.l_orderkey,
50 "l_partkey": $l.l_linenumber,
51 "l_suppkey": $l.l_partkey
52 }
53);
54
55insert into dataset LineID (
56for $l in dataset('LineItem')
57 where $l.l_orderkey>=1000
58 die after 1000
59 return {
60 "l_orderkey": $l.l_orderkey,
61 "l_partkey": $l.l_linenumber,
62 "l_suppkey": $l.l_partkey
63 }
64);
65
66write output to nc1:"rttest/failure_insert.adm";
67for $c in dataset('LineID')
68order by $c.l_orderkey, $c.l_linenumber
69return $c
70