blob: 7c38a645980d214424ad2817d2777ef5f4810feb [file] [log] [blame]
vinayakb38b7ca42012-03-05 05:44:15 +00001drop dataverse test if exists;
vinayakb38b7ca42012-03-05 05:44:15 +00002create dataverse test;
3use dataverse test;
4
5create type LineItemType as closed {
6 l_orderkey: int32,
7 l_partkey: int32,
8 l_suppkey: int32,
9 l_linenumber: int32,
10 l_quantity: double,
11 l_extendedprice: double,
12 l_discount: double,
13 l_tax: double,
14 l_returnflag: string,
15 l_linestatus: string,
16 l_shipdate: string,
17 l_commitdate: string,
18 l_receiptdate: string,
19 l_shipinstruct: string,
20 l_shipmode: string,
21 l_comment: string
22}
23
24create type LineIDType as closed {
25 l_orderkey: int32,
26 l_linenumber: int32,
27 l_suppkey: int32
28}
29
vinayakb38b7ca42012-03-05 05:44:15 +000030create dataset LineItem(LineItemType)
khfaraaz82@gmail.com502731f2012-05-02 20:38:16 +000031 partitioned by key l_orderkey, l_linenumber;
vinayakb38b7ca42012-03-05 05:44:15 +000032
33create dataset LineID(LineIDType)
khfaraaz82@gmail.com502731f2012-05-02 20:38:16 +000034 partitioned by key l_orderkey, l_linenumber;
vinayakb38b7ca42012-03-05 05:44:15 +000035
36load dataset LineItem
37using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
38(("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
39
40load dataset LineID
41using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
42(("path"="nc1://data/tpch0.001/lineitem_0.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
43
44
45insert into dataset LineID (
46for $l in dataset('LineItem')
47 where $l.l_orderkey<10
48 return {
49 "l_orderkey": $l.l_orderkey,
50 "l_partkey": $l.l_linenumber,
51 "l_suppkey": $l.l_partkey
52 }
53);
54
55write output to nc1:"rttest/dml_insert.adm";
56for $c in dataset('LineID')
57order by $c.l_orderkey, $c.l_linenumber
58return $c
59