alexander.behm | 048a2a3 | 2012-05-03 06:18:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Test case Name : insert-into-empty-dataset.aql |
| 3 | * Description : Check that we can insert into an empty dataset |
| 4 | * Expected Result : Success |
| 5 | * Date : May 2 2012 |
| 6 | */ |
| 7 | |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 8 | drop dataverse test if exists; |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 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 | |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 18 | create dataset LineID(LineIDType) |
ramangrover29 | 669d8f6 | 2013-02-11 06:03:32 +0000 | [diff] [blame] | 19 | primary key l_orderkey, l_linenumber; |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 20 | |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 21 | insert into dataset LineID ( |
| 22 | let $x:=1 |
| 23 | let $y:=2 |
| 24 | let $z:=3 |
| 25 | return { |
| 26 | "l_orderkey": $x, |
alexander.behm | 8ebed0d | 2012-05-04 00:05:52 +0000 | [diff] [blame] | 27 | "l_linenumber": $y, |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 28 | "l_suppkey": $z |
| 29 | } |
| 30 | ); |
| 31 | |
| 32 | insert into dataset LineID ( |
| 33 | let $x:=2 |
| 34 | let $y:=3 |
| 35 | let $z:=4 |
| 36 | return { |
| 37 | "l_orderkey": $x, |
alexander.behm | 8ebed0d | 2012-05-04 00:05:52 +0000 | [diff] [blame] | 38 | "l_linenumber": $y, |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 39 | "l_suppkey": $z |
| 40 | } |
| 41 | ); |
| 42 | |
alexander.behm | c05489d | 2012-05-04 01:26:41 +0000 | [diff] [blame] | 43 | write output to nc1:"rttest/dml_insert-into-empty-dataset.adm"; |
vinayakb | 38b7ca4 | 2012-03-05 05:44:15 +0000 | [diff] [blame] | 44 | for $c in dataset('LineID') |
| 45 | where $c.l_suppkey < 100 and $c.l_linenumber<5 |
| 46 | order by $c.l_orderkey, $c.l_linenumber |
| 47 | return $c |