alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 1 | /* |
alexander.behm | a52976c | 2012-05-03 09:06:21 +0000 | [diff] [blame] | 2 | * Test case Name : empty-load-with-index.aql |
| 3 | * Description : Check that an empty load doesn't preclude a future non-empty load on primary index |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 4 | * Expected Result : Success |
| 5 | * Date : May 2 2012 |
| 6 | */ |
| 7 | |
| 8 | drop dataverse test if exists; |
| 9 | create dataverse test; |
| 10 | use dataverse test; |
| 11 | |
alexander.behm | a52976c | 2012-05-03 09:06:21 +0000 | [diff] [blame] | 12 | create type LineItemType as closed { |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 13 | l_orderkey: int32, |
alexander.behm | a52976c | 2012-05-03 09:06:21 +0000 | [diff] [blame] | 14 | l_partkey: int32, |
| 15 | l_suppkey: int32, |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 16 | l_linenumber: int32, |
alexander.behm | a52976c | 2012-05-03 09:06:21 +0000 | [diff] [blame] | 17 | l_quantity: double, |
| 18 | l_extendedprice: double, |
| 19 | l_discount: double, |
| 20 | l_tax: double, |
| 21 | l_returnflag: string, |
| 22 | l_linestatus: string, |
| 23 | l_shipdate: string, |
| 24 | l_commitdate: string, |
| 25 | l_receiptdate: string, |
| 26 | l_shipinstruct: string, |
| 27 | l_shipmode: string, |
| 28 | l_comment: string |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 29 | } |
| 30 | |
alexander.behm | a52976c | 2012-05-03 09:06:21 +0000 | [diff] [blame] | 31 | create dataset LineItem(LineItemType) |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 32 | partitioned by key l_orderkey, l_linenumber; |
| 33 | |
alexander.behm | a52976c | 2012-05-03 09:06:21 +0000 | [diff] [blame] | 34 | create index part_index on LineItem(l_partkey); |
| 35 | |
| 36 | load dataset LineItem |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 37 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 38 | (("path"="nc1://data/empty.adm"),("format"="delimited-text"),("delimiter"="|")) pre-sorted; |
| 39 | |
alexander.behm | a52976c | 2012-05-03 09:06:21 +0000 | [diff] [blame] | 40 | load dataset LineItem |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 41 | using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter" |
| 42 | (("path"="nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted; |
| 43 | |
| 44 | write output to nc1:"rttest/dml_empty-load.adm"; |
alexander.behm | a52976c | 2012-05-03 09:06:21 +0000 | [diff] [blame] | 45 | for $c in dataset('LineItem') |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 46 | order by $c.l_orderkey, $c.l_linenumber |
| 47 | limit 1 |
alexander.behm | a52976c | 2012-05-03 09:06:21 +0000 | [diff] [blame] | 48 | return $c |