http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.4.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.4.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.4.update.aql
new file mode 100644
index 0000000..251674f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.4.update.aql
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse test;
+
+delete $l from dataset LineItem where $l.l_suppkey>=2 or $l.l_linenumber>1;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.query.aql
new file mode 100644
index 0000000..a66862f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.query.aql
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse test;
+     
+for $c in dataset('LineItem')
+where $c.l_suppkey<150
+order by $c.l_orderkey, $c.l_linenumber
+return $c

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.1.ddl.aql
new file mode 100644
index 0000000..fc8d366
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.1.ddl.aql
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type LineItemType as closed {
+  l_orderkey: int64,
+  l_partkey: int64,
+  l_suppkey: int64,
+  l_linenumber: int64,
+  l_quantity: int64,
+  l_extendedprice: double,
+  l_discount: double,
+  l_tax: double,
+  l_returnflag: string,
+  l_linestatus: string,
+  l_shipdate: string,
+  l_commitdate: string,
+  l_receiptdate: string,
+  l_shipinstruct: string,
+  l_shipmode: string,
+  l_comment: string
+}
+
+create dataset LineItem(LineItemType)
+  primary key l_orderkey, l_linenumber;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.2.update.aql
new file mode 100644
index 0000000..e239584
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.2.update.aql
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse test;
+
+load dataset LineItem 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"))
 pre-sorted;
+
+delete $l from dataset LineItem where $l.l_orderkey>=10;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.3.query.aql
new file mode 100644
index 0000000..614ecc1
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-from-loaded-dataset/delete-from-loaded-dataset.3.query.aql
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse test;
+  
+for $c in dataset('LineItem')
+order by $c.l_orderkey, $c.l_linenumber
+return $c 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.1.ddl.aql
new file mode 100644
index 0000000..d614290
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.1.ddl.aql
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+drop dataverse tpch if exists;
+create dataverse tpch;
+
+use dataverse tpch;
+
+create type LineItemType as closed {
+  l_orderkey: int32,
+  l_partkey: int32,
+  l_suppkey: int32,
+  l_linenumber: int32,
+  l_quantity: int32,
+  l_extendedprice: double,
+  l_discount: double,
+  l_tax: double,
+  l_returnflag: string,
+  l_linestatus: string,
+  l_shipdate: string,
+  l_commitdate: string,
+  l_receiptdate: string,
+  l_shipinstruct: string,
+  l_shipmode: string,
+  l_comment: string
+}
+
+create type OrderType as closed {
+  o_orderkey: int32,
+  o_custkey: int32,
+  o_orderstatus: string,
+  o_totalprice: double,
+  o_orderdate: string,
+  o_orderpriority: string,
+  o_clerk: string,
+  o_shippriority: int32,
+  o_comment: string
+}
+
+create type CustomerType as closed {
+  c_custkey: int32,
+  c_name: string,
+  c_address: string,
+  c_nationkey: int32,
+  c_phone: string,
+  c_acctbal: double,
+  c_mktsegment: string,
+  c_comment: string
+}
+
+create type SupplierType as closed {
+  s_suppkey: int32,
+  s_name: string,
+  s_address: string,
+  s_nationkey: int32,
+  s_phone: string,
+  s_acctbal: double,
+  s_comment: string
+}
+
+create type NationType as closed {
+  n_nationkey: int32,
+  n_name: string,
+  n_regionkey: int32,
+  n_comment: string
+}
+
+create type RegionType as closed {
+    r_regionkey: int32,
+    r_name: string,
+    r_comment: string
+}
+
+create type PartType as closed {
+  p_partkey: int32,
+  p_name: string,
+  p_mfgr: string,
+  p_brand: string,
+  p_type: string,
+  p_size: int32,
+  p_container: string,
+  p_retailprice: double,
+  p_comment: string
+}
+
+create type PartSuppType as closed {
+  ps_partkey: int32,
+  ps_suppkey: int32,
+  ps_availqty: int32,
+  ps_supplycost: double,
+  ps_comment: string
+}
+
+create dataset LineItem(LineItemType)
+  primary key l_orderkey, l_linenumber;
+create dataset Orders(OrderType)
+  primary key o_orderkey;
+create dataset Supplier(SupplierType)
+  primary key s_suppkey;
+create dataset Region(RegionType)
+  primary key r_regionkey;
+create dataset Nation(NationType)
+  primary key n_nationkey;
+create dataset Part(PartType)
+  primary key p_partkey;
+create dataset Partsupp(PartSuppType)
+  primary key ps_partkey, ps_suppkey;
+create dataset Customer(CustomerType)
+  primary key c_custkey;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.2.update.aql
new file mode 100644
index 0000000..c976330
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.2.update.aql
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse tpch;
+
+load dataset LineItem 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load dataset Orders 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load dataset Supplier 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load dataset Region 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load dataset Nation 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load dataset Part 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/part.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load dataset Partsupp 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/partsupp.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load dataset Customer 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+delete $l from dataset LineItem;
+delete $o from dataset Orders;
+delete $s from dataset Supplier;
+delete $s from dataset Region;
+delete $s from dataset Nation;
+delete $s from dataset Part;
+delete $s from dataset Partsupp;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.3.query.aql
new file mode 100644
index 0000000..820946b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-multi-statement/delete-multi-statement.3.query.aql
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse tpch;
+
+for $c in dataset Customer
+return $c;
+ 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change.aql
new file mode 100644
index 0000000..88620fc
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change.aql
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : Test variant syntax for delete
+ *              : Ending semi-colon is optional for delete
+ * Expected Res : Success
+ * Date         : 6th March 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type LineItemType as closed {
+  l_orderkey: int32, 
+  l_partkey: int32, 
+  l_suppkey: int32, 
+  l_linenumber: int32, 
+  l_quantity: int32, 
+  l_extendedprice: double,
+  l_discount: double, 
+  l_tax: double,
+  l_returnflag: string, 
+  l_linestatus: string, 
+  l_shipdate: string,
+  l_commitdate: string, 
+  l_receiptdate: string, 
+  l_shipinstruct: string, 
+  l_shipmode: string, 
+  l_comment: string
+}
+
+create dataset LineItem(LineItemType)
+  primary key l_orderkey, l_linenumber;
+
+load dataset LineItem 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"))
 pre-sorted;
+
+delete $l from dataset LineItem where $l.l_orderkey>=10
+
+write output to asterix_nc1:"rttest/dml_delete-syntax-change.adm";      
+for $c in dataset('LineItem')
+order by $c.l_orderkey, $c.l_linenumber
+return $c 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.1.ddl.aql
new file mode 100644
index 0000000..32d4ac9
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.1.ddl.aql
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description  : Test variant syntax for delete
+ *              : Ending semi-colon is optional for delete
+ * Expected Res : Success
+ * Date         : 6th March 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type LineItemType as closed {
+  l_orderkey: int64,
+  l_partkey: int64,
+  l_suppkey: int64,
+  l_linenumber: int64,
+  l_quantity: int64,
+  l_extendedprice: double,
+  l_discount: double,
+  l_tax: double,
+  l_returnflag: string,
+  l_linestatus: string,
+  l_shipdate: string,
+  l_commitdate: string,
+  l_receiptdate: string,
+  l_shipinstruct: string,
+  l_shipmode: string,
+  l_comment: string
+}
+
+create dataset LineItem(LineItemType)
+  primary key l_orderkey, l_linenumber;
+
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.2.update.aql
new file mode 100644
index 0000000..e239584
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.2.update.aql
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse test;
+
+load dataset LineItem 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"))
 pre-sorted;
+
+delete $l from dataset LineItem where $l.l_orderkey>=10;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.3.query.aql
new file mode 100644
index 0000000..d822a06
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/delete-syntax-change/delete-syntax-change.3.query.aql
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse test;
+    
+for $c in dataset('LineItem')
+order by $c.l_orderkey, $c.l_linenumber
+return $c 
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.1.ddl.aql
new file mode 100644
index 0000000..e5c25e4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.1.ddl.aql
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description     : Drop empty secondary index.
+ * Expected Result : Success
+ * Date            : 8th Feb 2013
+ *
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+create type Name as open {
+first : string,
+last : string
+}
+
+create type Person as open {
+name : Name
+}
+
+create type TestType as open {
+id : int32,
+name : string,
+locn : point,
+zip : string,
+person : Person
+}
+
+create dataset t1(TestType) primary key id;
+
+create index rtree_index_point on t1(locn) type rtree;
+
+create index rtree_index_point_open on t1(open_locn:point?) type rtree 
enforced;
+
+create index keyWD_indx on t1(name) type keyword;
+
+create index keyWD_indx_open on t1(nickname:string?) type keyword enforced;
+
+create index secndIndx on t1(zip);
+
+create index nested on t1(person.name.first);
+
+create index secndIndx_open on t1(address:string?) enforced;
+
+drop index t1.rtree_index_point;
+
+drop index t1.rtree_index_point_open;
+
+drop index t1.keyWD_indx;
+
+drop index t1.keyWD_indx_open;
+
+drop index t1.secndIndx;
+
+drop index t1.nested;
+
+drop index t1.secndIndx_open;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.2.update.aql
new file mode 100644
index 0000000..e99f055
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.2.update.aql
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description     : Drop empty secondary index.
+ * Expected Result : Success
+ * Date            : 8th Feb 2013
+ *
+ */
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.query.aql
new file mode 100644
index 0000000..b01b106
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-empty-secondary-indexes/drop-empty-secondary-indexes.3.query.aql
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description     : Drop empty secondary index.
+ * Expected Result : Success
+ * Date            : 8th Feb 2013
+ *
+ */
+
+use dataverse test;
+
+for $l in dataset('Metadata.Index')
+where $l.IsPrimary=false
+return $l;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.1.ddl.aql
new file mode 100644
index 0000000..a805ac8
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.1.ddl.aql
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description     : Drop secondary index.
+ * Expected Result : Success
+ * Date            : 12th July 2012
+ *
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type Schema as closed {
+unique1:  int64,
+unique2:  int64,
+two:  int64,
+four:  int64,
+ten:  int64,
+twenty:  int64,
+onePercent: int64,
+tenPercent:  int64,
+twentyPercent:  int64,
+fiftyPercent:  int64,
+unique3:  int64,
+evenOnePercent: int64,
+oddOnePercent:  int64,
+stringu1:  string,
+stringu2:  string,
+string4:  string
+}
+
+create dataset t1(Schema) primary key unique2;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.2.update.aql
new file mode 100644
index 0000000..ac20f14
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.2.update.aql
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description     : Drop secondary index.
+ * Expected Result : Success
+ * Date            : 12th July 2012
+ *
+ */
+
+use dataverse test;
+
+// Load data
+load dataset t1
+using localfs
+(("path"="asterix_nc1://data/wisc/onektup.adm"),("format"="delimited-text"),("delimiter"="|"))
 pre-sorted;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.3.ddl.aql
new file mode 100644
index 0000000..2b00a1b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.3.ddl.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse test;
+
+// create secondary indexes
+create index idx_t1_str1 on t1(stringu1);
+create index idx_t1_unique1 on t1(unique1);
+
+// drop secondary indexes
+drop index t1.idx_t1_str1;
+drop index t1.idx_t1_unique1;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.4.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.4.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.4.query.aql
new file mode 100644
index 0000000..3898d01
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/drop-index/drop-index.4.query.aql
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Description     : Drop secondary index.
+ * Expected Result : Success
+ * Date            : 12th July 2012
+ *
+ */
+
+use dataverse test;
+
+for $a in dataset('t1')
+where $a.unique1 > 10 and $a.stringu1="DGAAAAXXXXXXXXXXXXXXXXXXX"
+return $a

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.1.ddl.aql
new file mode 100644
index 0000000..5803a12
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.1.ddl.aql
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : empty-load-with-index.aql
+ * Description     : Check that an empty load doesn't preclude a future 
non-empty load on primary and secondary indexes
+ * Expected Result : Success
+ * Date            : May 2 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type LineItemType as closed {
+  l_orderkey: int64,
+  l_partkey: int64,
+  l_suppkey: int64,
+  l_linenumber: int64,
+  l_quantity: double,
+  l_extendedprice: double,
+  l_discount: double,
+  l_tax: double,
+  l_returnflag: string,
+  l_linestatus: string,
+  l_shipdate: string,
+  l_commitdate: string,
+  l_receiptdate: string,
+  l_shipinstruct: string,
+  l_shipmode: string,
+  l_comment: string
+}
+
+create dataset LineItem(LineItemType)
+  primary key l_orderkey, l_linenumber;
+
+create index part_index on LineItem(l_partkey);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.2.update.aql
new file mode 100644
index 0000000..76a6545
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.2.update.aql
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* 
+ * Test case Name  : empty-load-with-index.aql
+ * Description     : Check that an empty load doesn't preclude a future 
non-empty load on primary and secondary indexes
+ * Expected Result : Success
+ * Date            : May 2 2012
+ */
+
+use dataverse test;
+
+load dataset LineItem 
+using localfs
+(("path"="asterix_nc1://data/empty.adm"),("format"="delimited-text"),("delimiter"="|"))
 pre-sorted;
+
+load dataset LineItem 
+using localfs
+(("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|"))
 pre-sorted;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.3.query.aql
new file mode 100644
index 0000000..2fbc519
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/empty-load-with-index/empty-load-with-index.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* 
+ * Test case Name  : empty-load-with-index.aql
+ * Description     : Check that an empty load doesn't preclude a future 
non-empty load on primary and secondary indexes
+ * Expected Result : Success
+ * Date            : May 2 2012
+ */
+
+use dataverse test;
+
+for $c in dataset('LineItem')
+order by $c.l_orderkey, $c.l_linenumber
+limit 1
+return $c

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.1.ddl.aql
new file mode 100644
index 0000000..3540a77
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.1.ddl.aql
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-and-scan-dataset-with-index-on-open-field.aql
+ * Description     : This test is intended to test inserting into a dataset 
that has a secondary index on opened field and scan
+ * the data at the same time where we insert a materializing to prevent the 
possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : November 15 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+create type test.Emp as open {
+id:int32,
+lname:string,
+age:int32,
+dept:string
+}
+
+create type test.EmpClosed as closed {
+id:int32,
+fname:string,
+lname:string,
+age:int32,
+dept:string
+}
+
+create dataset test.employee(Emp) primary key id;
+create dataset test.employeeClosed(EmpClosed) primary key id;
+
+create index idx_employee_first_name on test.employee(fname:string?) enforced;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.2.update.aql
new file mode 100644
index 0000000..acdb5fe
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.2.update.aql
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-and-scan-dataset-with-index-on-open-field.aql
+ * Description     : This test is intended to test inserting into a dataset 
that has a secondary index on opened field and scan
+ * the data at the same time where we insert a materializing to prevent the 
possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : November 15 2013
+ */
+
+use dataverse test;
+
+load dataset test.employeeClosed
+using localfs
+(("path"="asterix_nc1://data/names.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+insert into dataset test.employee (
+for $x in dataset test.employeeClosed
+return {
+    "id": $x.id,
+    "fname": $x.fname,
+    "lname": $x.lname,
+    "age": $x.age,
+    "dept": $x.dept
+}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.3.query.aql
new file mode 100644
index 0000000..3fdeb9c
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index-on-open-field/insert-and-scan-dataset-with-index-on-open-field.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-and-scan-dataset-with-index-on-open-field.aql
+ * Description     : This test is intended to test inserting into a dataset 
that has a secondary index on opened field and scan
+ * the data at the same time where we insert a materializing to prevent the 
possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : November 15 2013
+ */
+
+use dataverse test;
+
+for $l in dataset('test.employee')
+order by $l.id
+return $l

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.1.ddl.aql
new file mode 100644
index 0000000..2fd67a7
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.1.ddl.aql
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-and-scan-dataset-with-index.aql
+ * Description     : This test is intended to test inserting into a dataset 
that has a secondary index and scan
+ * the data at the same time where we insert a materializing to prevent the 
possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : July 11 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type test.Emp as closed {
+id: int64,
+fname: string,
+lname: string,
+age: int64,
+dept: string
+}
+
+create dataset test.employee(Emp) primary key id;
+
+create index idx_employee_first_name on test.employee(fname);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.2.update.aql
new file mode 100644
index 0000000..35d2ee8
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.2.update.aql
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-and-scan-dataset-with-index.aql
+ * Description     : This test is intended to test inserting into a dataset 
that has a secondary index and scan
+ * the data at the same time where we insert a materializing to prevent the 
possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : July 11 2013
+ */
+
+use dataverse test;
+
+load dataset test.employee
+using localfs
+(("path"="asterix_nc1://data/names.adm"),("format"="delimited-text"),("delimiter"="|"));
+
+
+insert into dataset test.employee (
+for $x in dataset test.employee
+return {
+    "id": $x.id + 10000,
+    "fname": $x.fname,
+    "lname": $x.lname,
+    "age": $x.age,
+    "dept": $x.dept
+}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.query.aql
new file mode 100644
index 0000000..d93b348
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset-with-index/insert-and-scan-dataset-with-index.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* 
+ * Test case Name  : insert-and-scan-dataset-with-index.aql
+ * Description     : This test is intended to test inserting into a dataset 
that has a secondary index and scan
+ * the data at the same time where we insert a materializing to prevent the 
possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : July 11 2013
+ */
+ 
+use dataverse test;
+
+for $l in dataset('test.employee')
+order by $l.id
+return $l

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.1.ddl.aql
new file mode 100644
index 0000000..085fb52
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.1.ddl.aql
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-and-scan-dataset.aql
+ * Description     : This test is intended to test inserting into a dataset 
and scan it at the same time
+ * where we insert a materializing to prevent the possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : July 11 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type myDataType as open {
+  id: int64
+}
+
+create dataset myData(myDataType)
+  primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.2.update.aql
new file mode 100644
index 0000000..7e16c0b
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.2.update.aql
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-and-scan-dataset.aql
+ * Description     : This test is intended to test inserting into a dataset 
and scan it at the same time
+ * where we insert a materializing to prevent the possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : July 11 2013
+ */
+
+use dataverse test;
+
+load dataset myData
+using localfs
+(("path"="asterix_nc1://data/odd-numbers.adm"),("format"="adm"))pre-sorted;
+
+
+insert into dataset myData (
+for $x in dataset myData
+return {
+    "id": $x.id + 1
+}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.3.query.aql
new file mode 100644
index 0000000..61c5c4e
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-dataset/insert-and-scan-dataset.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* 
+ * Test case Name  : insert-and-scan-dataset.aql
+ * Description     : This test is intended to test inserting into a dataset 
and scan it at the same time
+ * where we insert a materializing to prevent the possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : July 11 2013
+ */
+ 
+use dataverse test;
+
+for $c in dataset('myData')
+order by $c.id
+return $c 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.1.ddl.aql
new file mode 100644
index 0000000..5b778d4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.1.ddl.aql
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-and-scan-joined-datasets.aql
+ * Description     : This test is intended to test inserting into a dataset 
where the incoming stream
+  is involve a join operation that has the same dataset. We insert a 
materializing to prevent the
+  possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : July 11 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type myDataType as open {
+  id: int64
+}
+
+create dataset myData(myDataType)
+  primary key id;
+
+create dataset myData2(myDataType)
+  primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.2.update.aql
new file mode 100644
index 0000000..08a7bb8
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.2.update.aql
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-and-scan-joined-datasets.aql
+ * Description     : This test is intended to test inserting into a dataset 
where the incoming stream
+  is involve a join operation that has the same dataset. We insert a 
materializing to prevent the
+  possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : July 11 2013
+ */
+
+use dataverse test;
+
+load dataset myData
+using localfs
+(("path"="asterix_nc1://data/odd-numbers.adm"),("format"="adm"))pre-sorted;
+
+load dataset myData2
+using localfs
+(("path"="asterix_nc1://data/odd-numbers-2.adm"),("format"="adm"))pre-sorted;
+
+insert into dataset myData (
+for $x in dataset myData2
+for $y in dataset myData
+where $x.id = $y.id
+return {
+    "id": $x.id + 1
+}
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.3.query.aql
new file mode 100644
index 0000000..446dd2f
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-and-scan-joined-datasets/insert-and-scan-joined-datasets.3.query.aql
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* 
+ * Test case Name  : insert-and-scan-joined-datasets.aql
+ * Description     : This test is intended to test inserting into a dataset 
where the incoming stream
+ * is involve a join operation that has the same dataset. We insert a 
materializing to prevent the 
+ * possibility of deadlatch.
+ * Expected Result : Success
+ * Date            : July 11 2013
+ */
+ 
+use dataverse test;
+
+for $c in dataset('myData')
+order by $c.id
+return $c 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.1.ddl.aql
new file mode 100644
index 0000000..77cd5d8
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.1.ddl.aql
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+drop dataverse STBench if exists;
+create dataverse STBench;
+use dataverse STBench;
+
+create type SimpleGeoPlaceType as closed {
+    coordinates: point,
+    id: int64,
+    name: string,
+    tags: string,
+    categories: string,
+    phone: string
+}
+create dataset SimpleGeoPlace (SimpleGeoPlaceType) primary key id;
+create index btreeName on SimpleGeoPlace(name) type btree;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.2.update.aql
new file mode 100644
index 0000000..db53159
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.2.update.aql
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse STBench;
+
+insert into dataset SimpleGeoPlace
+{ "coordinates": point("-2.423658,53.0842802"), "id": 5, "name": "20:20 
Mobile", "tags": "mobile", "categories": "Professional Services Computer 
Services", "phone": "" }
+;
+
+/* this should return TreeIndexDuplicateKeyException */
+insert into dataset SimpleGeoPlace
+{ "coordinates": point("-2.423658,53.0842802"), "id": 5, "name": "20:20 
Mobile", "tags": "mobile", "categories": "Professional Services Computer 
Services", "phone": "" }
+;
+
+/* this should return TreeIndexDuplicateKeyException without hang*/
+insert into dataset SimpleGeoPlace
+{ "coordinates": point("-2.423658,53.0842802"), "id": 5, "name": "20:20 
Mobile", "tags": "mobile", "categories": "Professional Services Computer 
Services", "phone": "" }
+;
+
+/* this should return TreeIndexDuplicateKeyException without hang*/
+insert into dataset SimpleGeoPlace
+{ "coordinates": point("-2.423658,53.0842802"), "id": 5, "name": "20:20 
Mobile", "tags": "mobile", "categories": "Professional Services Computer 
Services", "phone": "" }
+;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.3.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.3.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.3.ddl.aql
new file mode 100644
index 0000000..a0c4ac3
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-duplicated-keys/insert-duplicated-keys.3.ddl.aql
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* this should successfully drop STBench dataverse */
+drop dataverse STBench;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.1.ddl.aql
new file mode 100644
index 0000000..a1e320e
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.1.ddl.aql
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-into-empty-dataset-with-index.aql
+ * Description     : Check that we can insert into an empty dataset and its 
empty secondary indexes
+ * Expected Result : Success
+ * Date            : May 2 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type LineIDType as closed {
+  l_orderkey: int64,
+  l_linenumber: int64,
+  l_suppkey: int64
+}
+
+create dataset LineID(LineIDType)
+  primary key l_orderkey, l_linenumber;
+
+create index idx_LineID_partkey on LineID(l_linenumber);
+create index idx_LineID_suppkey on LineID(l_suppkey);
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.2.update.aql
new file mode 100644
index 0000000..a4faba1
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.2.update.aql
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-into-empty-dataset-with-index.aql
+ * Description     : Check that we can insert into an empty dataset and its 
empty secondary indexes
+ * Expected Result : Success
+ * Date            : May 2 2012
+ */
+
+use dataverse test;
+
+insert into dataset LineID (
+let $x:=1
+let $y:=2
+let $z:=3
+return {
+    "l_orderkey": $x,
+    "l_linenumber": $y,
+    "l_suppkey": $z
+}
+);
+
+insert into dataset LineID (
+let $x:=2
+let $y:=3
+let $z:=4
+return {
+    "l_orderkey": $x,
+    "l_linenumber": $y,
+    "l_suppkey": $z
+}
+);
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.query.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.query.aql
new file mode 100644
index 0000000..db0fe03
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset-with-index/insert-into-empty-dataset-with-index.3.query.aql
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/* 
+ * Test case Name  : insert-into-empty-dataset-with-index.aql
+ * Description     : Check that we can insert into an empty dataset and its 
empty secondary indexes 
+ * Expected Result : Success
+ * Date            : May 2 2012
+ */
+
+use dataverse test;
+   
+for $c in dataset('LineID')
+where $c.l_suppkey < 100 and $c.l_linenumber<5
+order by $c.l_orderkey, $c.l_linenumber
+return $c 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset/insert-into-empty-dataset.1.ddl.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset/insert-into-empty-dataset.1.ddl.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset/insert-into-empty-dataset.1.ddl.aql
new file mode 100644
index 0000000..4d4cca4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset/insert-into-empty-dataset.1.ddl.aql
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-into-empty-dataset.aql
+ * Description     : Check that we can insert into an empty dataset
+ * Expected Result : Success
+ * Date            : May 2 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type LineIDType as closed {
+  l_orderkey: int64,
+  l_linenumber: int64,
+  l_suppkey: int64
+}
+
+create dataset LineID(LineIDType)
+  primary key l_orderkey, l_linenumber;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/c4dbb614/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset/insert-into-empty-dataset.2.update.aql
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset/insert-into-empty-dataset.2.update.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset/insert-into-empty-dataset.2.update.aql
new file mode 100644
index 0000000..945ea50
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/dml/insert-into-empty-dataset/insert-into-empty-dataset.2.update.aql
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Test case Name  : insert-into-empty-dataset.aql
+ * Description     : Check that we can insert into an empty dataset
+ * Expected Result : Success
+ * Date            : May 2 2012
+ */
+
+use dataverse test;
+
+insert into dataset LineID (
+let $x:=1
+let $y:=2
+let $z:=3
+return {
+    "l_orderkey": $x,
+    "l_linenumber": $y,
+    "l_suppkey": $z
+}
+);
+
+insert into dataset LineID (
+let $x:=2
+let $y:=3
+let $z:=4
+return {
+    "l_orderkey": $x,
+    "l_linenumber": $y,
+    "l_suppkey": $z
+}
+);
+

Reply via email to