alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Test case Name : insert-into-empty-dataset-with-index.aql |
| 3 | * Description : Check that we can insert into an empty dataset and its empty secondary indexes |
| 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 | |
| 12 | create type LineIDType as closed { |
| 13 | l_orderkey: int32, |
| 14 | l_linenumber: int32, |
| 15 | l_suppkey: int32 |
| 16 | } |
| 17 | |
| 18 | create dataset LineID(LineIDType) |
| 19 | partitioned by key l_orderkey, l_linenumber; |
| 20 | |
| 21 | create index idx_LineID_partkey on LineID(l_linenumber); |
| 22 | create index idx_LineID_suppkey on LineID(l_suppkey); |
| 23 | |
| 24 | insert into dataset LineID ( |
| 25 | let $x:=1 |
| 26 | let $y:=2 |
| 27 | let $z:=3 |
| 28 | return { |
| 29 | "l_orderkey": $x, |
alexander.behm | 8ebed0d | 2012-05-04 00:05:52 +0000 | [diff] [blame] | 30 | "l_linenumber": $y, |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 31 | "l_suppkey": $z |
| 32 | } |
| 33 | ); |
| 34 | |
| 35 | insert into dataset LineID ( |
| 36 | let $x:=2 |
| 37 | let $y:=3 |
| 38 | let $z:=4 |
| 39 | return { |
| 40 | "l_orderkey": $x, |
alexander.behm | 8ebed0d | 2012-05-04 00:05:52 +0000 | [diff] [blame] | 41 | "l_linenumber": $y, |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 42 | "l_suppkey": $z |
| 43 | } |
| 44 | ); |
| 45 | |
alexander.behm | b57d833 | 2012-05-10 08:01:56 +0000 | [diff] [blame^] | 46 | write output to nc1:"rttest/dml_insert-into-empty-dataset-with-index.adm"; |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 47 | for $c in dataset('LineID') |
alexander.behm | b57d833 | 2012-05-10 08:01:56 +0000 | [diff] [blame^] | 48 | where $c.l_suppkey < 100 and $c.l_linenumber<5 |
alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 49 | order by $c.l_orderkey, $c.l_linenumber |
| 50 | return $c |